jeudi 29 septembre 2016

Laravel FFMPEG Error Encoding Failed using Laravel Queue

I am using "php-ffmpeg/php-ffmpeg": "~0.5" with Laravel 5. I am using this library for compression and conversion of recorded videos. I will explain the scenario first.

When I execute following code from controller it works like charm.

$ffmpeg = FFMpeg::create();
$video = $ffmpeg->open(public_path()."/videos/harsh.webm");
$video
    ->filters()
    ->resize(new \FFMpeg\Coordinate\Dimension(640, 480))
    ->synchronize();
$video
    ->frame(\FFMpeg\Coordinate\TimeCode::fromSeconds(10))
    ->save(public_path().'/videos/converted/kaushik.jpg');
$format=new \FFMpeg\Format\Video\X264('libmp3lame', 'libx264'); 
$format-> setKiloBitrate(300);
$video->save($format,public_path().'videos/converted/kaushik.mp4');``

But when I put this code in a queue job then it fails with following error

[FFMpeg\Exception\RuntimeException]
Encoding failed [Alchemy\BinaryDriver\Exception\ExecutionFailureException]
ffmpeg failed to execute command '/usr/bin/ffmpeg' '-y' '-i' '/opt/lampp/htdocs/candidate/public/videos/harsh.webm' '-async' '1' '-metadata:s:v:0 ' 'start_time=0' '-s' '640x480' '-vcodec' 'libx264' '-acodec' 'libmp3lame' '-b:v' '1000k' '-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-passes57ece7d794da4wdw13/pass-57ece7d794e2a' 'videos/converted/kaushik.mp4' ``

I am able to convert video in MWV and WEBM using following

$video->save(new \FFMpeg\Format\Video\WMV(), 'export-wmv.wmv');
$video->save(new \FFMpeg\Format\Video\WebM(), 'export-webm.webm');

only mp4 fails if I use the

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

What would be the issue?

Sorry for my code markup in this question, I tried lot but faild, I am new to it!



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2cDDIhM
via IFTTT

Aucun commentaire:

Enregistrer un commentaire