PHP-FFMpeg: x264 ERROR

Q A
Bug? YES
New Feature? no
Version Used Specific tag or commit sha
FFmpeg Version Compilation ffmpeg.org: N-89811-g27b9f82, built with gcc 5.4.0
OS Ubuntu 16.04 PHP7

Coding in x264:

require 'vendor/autoload.php';
$ffmpeg = FFMpeg\FFMpeg::create();
$video = $ffmpeg->open('INPUT/video.mp4');
$video
    ->filters()
    ->resize(new FFMpeg\Coordinate\Dimension(320, 240))
    ->synchronize();
$video
    ->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(10))
    ->save('OUTPUT/frame.jpg');
$video
    ->save(new FFMpeg\Format\Video\X264(), 'OUTPUT/output-x264.mp4');

Fatal error: Object(SplObje in /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Media/Video.php on line 96

if I change last line, everything is fine: ->save(new FFMpeg\Format\Video\WMV(), ‘export-wmv.wmv’) or ->save(new FFMpeg\Format\Video\WebM(), ‘export-webm.webm’);

no problem with it: shell_exec("ffmpeg -y -i INPUT/video.mp4 -vcodec libx264 OUTPUT/output.avi </dev/null >/dev/null 2>/var/www/html/log/CODER.log &");

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

Please write in proper English sentences.

I think the users input was valuable. If you dont speak chinese, there are many translating apps to help you

问题解决了,是因为最新版本的ffmpeg不支持–enable-libfaac ,所以PHP-FFMpeg默认用的libfaac会导致错误。 可以这样new FFMpeg\Format\Video\X264(‘libmp3lame’) 或者使用libfdk_aac 也可以直接改写类 public function __construct($audioCodec = ‘libfdk_aac’, $videoCodec = ‘libx264’)

感谢PHP-FFMpeg

php script is default use ‘daemon’ use : ->save(new FFMpeg\Format\Video\WMV(), ‘export-wmv.wmv’) is no problem

But it’s a problem with this: ->save(new FFMpeg\Format\Video\X264(), ‘export-x264.mp4’)