Php-ffmpeg: How to run this ffmpeg command through PHP-FFMpeg

Created on 18 Feb 2017  路  2Comments  路  Source: PHP-FFMpeg/PHP-FFMpeg

| Q | A
| -------------- | ---
| Bug? | no
| New Feature? | no
| Version Used | 0.9.0
| FFmpeg Version | FFmpeg 3.2.4
| OS | macOS 10.12

I've been trying to convert .gif to .mp4 and it works with below code:

$ffmpeg = FFMpeg\FFMpeg::create();
$video = $ffmpeg->open('animated.gif');
$video->save(new FFMpeg\Format\Video\X264(), 'export-x264.mp4');

But the converted file doesn't play in browsers. I've found this ffmpeg ssh command that works great (the converted file does work in browsers) but I have no idea how to do it with package. Here is command:

ffmpeg -i animated.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video.mp4

Thank you for your great package BTW.

Most helpful comment

Hi!
$format->setAdditionalParameters(array('foo', 'bar')); may help you.

All 2 comments

Hi!
$format->setAdditionalParameters(array('foo', 'bar')); may help you.

Thanks man, that did the trick

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mdolnik picture mdolnik  路  4Comments

jenky picture jenky  路  3Comments

htvanj picture htvanj  路  4Comments

miraklo picture miraklo  路  6Comments

pascalbaljet picture pascalbaljet  路  4Comments