Laravel FFMPEG Error Encoding Failed using Laravel Queue
<p>I am using <code>"php-ffmpeg/php-ffmpeg": "~0.5"</code> with Laravel 5. I am using this library for compression and conversion of recorded videos. I will explain the scenario first.</p>

<p>When I execute following code from controller it works like charm.</p>

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

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

<blockquote>
  <p>[FFMpeg\Exception\RuntimeException]<br>
    Encoding failed  [Alchemy\BinaryDriver\Exception\ExecutionFailureException]<br>
    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' ``</p>
</blockquote>

<p>I am able to convert video in MWV and WEBM using following</p>

<pre><code>$video-&gt;save(new \FFMpeg\Format\Video\WMV(), 'export-wmv.wmv');
$video-&gt;save(new \FFMpeg\Format\Video\WebM(), 'export-webm.webm');
</code></pre>

<p>only mp4 fails if I use the </p>

<pre><code>$format=new \FFMpeg\Format\Video\X264('libmp3lame', 'libx264');
</code></pre>

<p>What would be the issue?</p>

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