I am generated an MP4 file from an animated GIF which works well but I want to make the MP4 file have a few loops of the GIF. Is this possible?
Something like this: https://video.stackexchange.com/a/16933
This isn't implemented yet. You may end up using SimpleFilter to achieve this functionality.
Sorry, what is SimpleFilter?
In a nutshell: https://github.com/PHP-FFMpeg/PHP-FFMpeg/blob/d386cc0ceae5d74506acd909d2e188bd9f80fdb9/src/FFMpeg/Media/Video.php#L70
You can do simple parameters with it.
Ah okay, thanks.
When I do
ffmpeg -stream_loop 3 -i input.gif output.mp4
I get exactly what I want but if I do,
$video = $ffmpeg->open($path);
$video->addFilter(new SimpleFilter(['-stream_loop', '2']));
$video->save($format, $videoPath);
I get "encoding failed". If I remove the call to addFilter() it works but then I don't get the loop I need.
The filters are getting appended in the middle, so between input.gif and output.mp4, does it work for you also when you do the filter between it? I don't think so.
Oh, I see what you mean. I was looking through the code and I see there is an option to set a priority on the filter but that won't but it before the input I don't think. Is there away to specify that the filter goes before the input?
Ehm, at least they're not exposed to the user.
Okay, so I guess this falls under 2 potential new features
I would be open to creating a pull request for these things, for now I think I am just going to revert back to a shell script for my project. Anyone reading this please feel free to post your input on what the API should look like for these features and ideas for implementation.
Thanks for the help @jens1o
I would be open to creating a pull request for these things
Perfect, I'm lacking of time at the moment, again. Class tests :( Thanks in advance!
Most helpful comment
In a nutshell: https://github.com/PHP-FFMpeg/PHP-FFMpeg/blob/d386cc0ceae5d74506acd909d2e188bd9f80fdb9/src/FFMpeg/Media/Video.php#L70
You can do simple parameters with it.