Converting Video Files: Difference between revisions
Jump to navigation
Jump to search
(Created page with "== Converting mp4 to animated gif == Using `ffmpeg` without any options will create a gif file that looks very close to the source, but can be 300+ Mb for a 2+ Mb mp4 source file. <syntaxhighlight lang="bash"> $ ffmpeg -i source.mp4 -o output.gif </syntaxhighlight> This [https://superuser.com/questions/1049606/reduce-generated-gif-size-using-ffmpeg StackOverflow thread] contains some useful options for reducing the size: <syntaxhighlight lang="bash"> $ ffmpeg -y -i...") Tag: wikieditor |
(No difference)
|
Latest revision as of 16:51, 17 December 2023
Converting mp4 to animated gif[edit]
Using ffmpeg without any options will create a gif file that looks very close to the source, but can be 300+ Mb for a 2+ Mb mp4 source file.
$ ffmpeg -i source.mp4 -o output.gif
This StackOverflow thread contains some useful options for reducing the size:
$ ffmpeg -y -i source.mp4 -filter_complex "fps=5,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=32[p];[s1][p]paletteuse=dither=bayer" output.gif
With the options above the gif still comes out maybe 4 times the size of the source mp4.
Reducing the palette to 32 colors is extreme, but it does reduce the file size significantly. Also 5 frames per second is pretty jerky if the source video contains smooth motion at 24 or 30 fps.