php 使用php-ffmpeg转换一个flv的文件为mp4的格式时,报了一个错,帮忙看看什么问题?

清华大学副院长
  • 92

我的代码:

$ffmpeg = FFMpeg\FFMpeg::create();
$video = $ffmpeg->open($save_path . 'www.flv');
$format = new FFMpeg\Format\Video\X264();
$video->save($format, $save_path . 'test.mp4');

执行的时候报
错误:Encoding failed;/home/ljg/workspace/tools.51safety/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Media/AbstractVideo.php 第106行;追溯:

然后我到106行debug出日志,发现他执行的命令是下面的:

'/usr/local/bin/ffmpeg' '-y' '-i' '/home/ljg/workspace/tools.51safety/upload/anquanwuyouwang/professional/resource/learning/www.flv' '-vcodec' 'libx264' '-acodec' 'libfaac' '-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-passes5be4fc1ec9c1auy3kq/pass-5be4fc1ec9cae' '/home/ljg/workspace/tools.51safety/upload/anquanwuyouwang/professional/resource/learning/test.mp4'

然后我单独把这行命令放在ubuntu14.04的cli下面执行,执行报错信息如下
ffmpeg version 2.1.1 Copyright (c) 2000-2013 the FFmpeg developers
built on Nov 9 2018 11:02:30 with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --enable-nonfree --enable-libfaac --enable-gpl --enable-libx264
libavutil 52. 48.101 / 52. 48.101
libavcodec 55. 39.101 / 55. 39.101
libavformat 55. 19.104 / 55. 19.104
libavdevice 55. 5.100 / 55. 5.100
libavfilter 3. 90.100 / 3. 90.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Input #0, flv, from '/home/ljg/workspace/tools.51safety/upload/anquanwuyouwang/professional/resource/learning/www.flv':
Metadata:

major_brand     : isom
minor_version   : 512
compatible_brands: isomiso2avc1mp41
encoder         : Lavf57.41.100

Duration: 00:03:54.84, start: 0.017000, bitrate: 389 kb/s

Stream #0:0: Video: h264 (High), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 29.97 tbr, 1k tbn, 59.94 tbc
Stream #0:1: Audio: mp3, 22050 Hz, stereo, s16p, 64 kb/s

[libx264 @ 0x2c87b60] using SAR=1/1
[1] 3067 segmentation fault (core dumped) '/usr/local/bin/ffmpeg' '-y' '-i' '-vcodec' 'libx264' '-acodec' 'libfaac'

就是报了一个segmentation fault (core dumped),是什么意思啊?我环境没有配置好么?

回复
阅读 2.2k
2 个回答

没遇到过 估计基础库版本问题吧

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏