How to set passlogfile parameter of laravel-ffmpg

I'm trying to convert an mp4 video to hls using laravel-ffmpeg (https://github.com/pascalbaljetmedia/laravel-ffmpeg). here is my code:

$lowBitrate = (new X264("aac"))->setKiloBitrate(100);
$midBitrate = (new X264("libmp3lame"))->setKiloBitrate(500);
$highBitrate = (new X264("libmp3lame"))->setKiloBitrate(1000);
FFMpegFacade::fromDisk('video_file')
    ->open('b.mp4')
    ->exportForHLS()
//            ->setSegmentLength(10)// optional
    ->addFormat($lowBitrate)
    ->addFormat($midBitrate)
    ->addFormat($highBitrate)
    ->save('b.m3u8');

when i run that code i get error:

ExecutionFailureException in ProcessRunner.php line 95: ffmpeg failed to execute command '/usr/bin/ffmpeg' '-y' '-i' '/home/thanhtv/data/bitbucket/php/aivy_scedu/storage//video/file/b.mp4' '-map' '0' '-flags' '-global_header' '-f' 'segment' '-segment_format' 'mpeg_ts' '-segment_list' '/home/thanhtv/data/bitbucket/php/aivy_scedu/storage//video/file/b_100.m3u8' '-segment_time' '10' '-threads' '12' '-vcodec' 'libx264' '-acodec' 'aac' '-b:v' '100k' '-refs' '6' '-coder' '1' '-sc_threshold' '40' '-flags' '+loop' '-me_range' '16' '-subq' '7' '-i_qfactor' '0.71' '-qcomp' '0.6' '-qdiff' '4' '-trellis' '1' '-b:a' '128k' '-pass' '1' '-passlogfile' '/tmp/ffmpeg-passes5d739c3e51788r0wse/pass-5d739c3e517d2' '/home/thanhtv/data/bitbucket/php/aivy_scedu/storage//video/file/b_100_%05d.ts':

Error Output:

ffmpeg version 4.1.3-0york1~16.04 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609 configuration: --prefix=/usr --extra-version='0york1~16.04' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-nonfree --enable-libfdk-aac --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared libavutil 56. 22.100 / 56. 22.100 libavcodec 58. 35.100 / 58. 35.100 libavformat 58. 20.100 / 58. 20.100 libavdevice 58. 5.100 / 58. 5.100 libavfilter 7. 40.101 / 7. 40.101 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 3.100 / 5. 3.100 libswresample 3. 3.100 / 3. 3.100 libpostproc 55. 3.100 / 55. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/thanhtv/data/bitbucket/php/aivy_scedu/storage//video/file/b.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isomavc1 creation_time : 2012-03-13T08:58:06.000000Z encoder : HandBrake 0.9.6 2012022800 Duration: 00:00:10.03, start: 0.000000, bitrate: 629 kb/s Chapter #0:0: start 0.000000, end 10.000000 Metadata: title : Chapter 1 Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 320x176, 300 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc (default) Metadata: creation_time : 2012-03-13T08:58:06.000000Z encoder : JVT/AVC Coding Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default) Metadata: creation_time : 2012-03-13T08:58:06.000000Z Stream #0:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s Metadata: creation_time : 2012-03-13T08:58:06.000000Z Stream #0:3(und): Data: bin_data (text / 0x74786574), 0 kb/s Metadata: creation_time : 2012-03-13T08:58:06.000000Z Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (aac (native) -> aac (native)) Stream #0:2 -> #0:2 (aac (native) -> aac (native)) Stream

0:3 -> #0:3 (copy) Press [q] to stop, [?] for help [libx264 @ 0x562120a0a940] using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3

SSE4.2 AVX [libx264 @ 0x562120a0a940] profile Main, level 1.2 [segment @ 0x562120a274c0] Opening '/home/thanhtv/data/bitbucket/php/aivy_scedu/storage//video/file/b_100_00000.ts' for writing [segment @ 0x562120a274c0] Failed to open segment '/home/thanhtv/data/bitbucket/php/aivy_scedu/storage//video/file/b_100_00000.ts' Could not write header for output file #0 (incorrect codec parameters ?): Permission denied Error initializing output stream 0:0 -- [libx264 @ 0x562120a0a940] final ratefactor: 36.20 [aac @ 0x5621209e8780] Qavg: 143.810 [aac @ 0x5621209e8780] 2 frames left in the queue on closing [aac @ 0x562120a0ddc0] Qavg: 141.544 [aac @ 0x562120a0ddc0] 2 frames left in the queue on closing Conversion failed!

i have tried to analyze following command (run in terminal):

'/usr/bin/ffmpeg' '-y' '-i' '/home/thanhtv/data/bitbucket/php/aivy_scedu/storage//video/file/b.mp4' '-map' '0' '-flags' '-global_header' '-f' 'segment' '-segment_format' 'mpeg_ts' '-segment_list' '/home/thanhtv/data/bitbucket/php/aivy_scedu/storage//video/file/b_100.m3u8' '-segment_time' '10' '-threads' '12' '-vcodec' 'libx264' '-acodec' 'aac' '-b:v' '100k' '-refs' '6' '-coder' '1' '-sc_threshold' '40' '-flags' '+loop' '-me_range' '16' '-subq' '7' '-i_qfactor' '0.71' '-qcomp' '0.6' '-qdiff' '4' '-trellis' '1' '-b:a' '128k' '-pass' '1' '-passlogfile' '/tmp/ffmpeg-passes5d739c3e51788r0wse/pass-5d739c3e517d2'

and realize that when i remove -passlogfile parameter it will work fine. So the problem is ffmpeg didn't create directory ffmpeg-passes5d739c3e51788r0wse in /tmp for me. So i guess that i have to set -passlogfile myself. But i don't know how. can someone show me how please. I'm using laravel-ffmpeg 1.3, laravel 5.3 and ubuntu 16.04.I can't change version because i'm working with some other people. so please help me on this version. thanks.

Upvotes: 0

Views: 536

Answers (1)

Amid
Amid

Reputation: 185

change codecs

$format = new \FFMpeg\Format\Video\X264('libmp3lame', 'libx264'); 

Upvotes: 0

Related Questions