Closed fregante closed 3 years ago
I am missing a bit of context or explanation here, could you detail a bit more what's wrong and maybe dig it a bit?
Compare the input and output: The MP4 loops smoothly but the generated GIF doesn't (because there's an extra frame before the last frame)
Hi @bfred-it, I am not able to easily debug this. gifify is a wrapper around command line tools. It would be great if you could dig this. If you or anyone knows why there's an extra frame, please add a comment/open a pull request
@bfred-it have you tried to match the output fps with the input by using --fps [number of frames per second]
(without brackets)? Because it defaults to 10 I think.
That does indeed work (--fps 30
). I suppose the issue is specifically when the specified framerate doesn't match the input's, even though it's a factor of that.
@bfred-it Maybe we can add that tot the readme?
If that never works with any video then it's best to remove the option and read/set it directly from the video. This last part could be the default behavior anyway.
I maybe failed at the fps computing between:
see https://github.com/vvo/gifify/blob/0b67f6df9d70d9f08ddcefc575450189dd75cb50/index.js#L172 and https://github.com/vvo/gifify/blob/0b67f6df9d70d9f08ddcefc575450189dd75cb50/index.js#L103
https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video some info on ffmpeg.
Original mp4 https://cl.ly/go8i
Generated gif: http://i.imgur.com/WDeM4eu.gif (lasts 5 seconds)