使用Laravel队列的Laravel FFMPEG错误编码失败 [英] Laravel FFMPEG Error Encoding Failed using Laravel Queue

查看:451
本文介绍了使用Laravel队列的Laravel FFMPEG错误编码失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Laravel 5中使用"php-ffmpeg/php-ffmpeg": "~0.5".我正在使用该库来压缩和转换录制的视频.我将首先解释这种情况.

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]
编码失败[Alchemy \ BinaryDriver \ Exception \ ExecutionFailureException]
ffmpeg无法执行命令'/usr/bin/ffmpeg''-y''-i''/opt/lampp/htdocs/candidate/public/videos/harsh.webm''-async''1''-元数据: s:v:0''start_time = 0''-s''640x480''-vcodec''libx264''-acodec''libmp3lame''-b:v''1000k''-refs''6''-编码器''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'``

[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' ``

我可以使用以下内容将视频转换为MWV和WEBM

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');

如果我使用

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

会有什么问题?

很抱歉在这个问题中我的代码标记,我尝试了很多但是失败了,我是新来的!

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

推荐答案

已解决问题.

问题出在我存储转换后的视频的目录中.我授予了对目录的写访问权限,并且效果很好.

The problem was the directory where I was storing the converted video. I gave the write access to directory and It works very well.

这篇关于使用Laravel队列的Laravel FFMPEG错误编码失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆