[MPlayer-users] Make a clip with subtitles?

Miriam English mim at miriam-english.org
Sat Apr 14 13:15:18 EEST 2018


Just occured to me that I seem to recall the original reason for 
splitting the video into frames with subtitles hardcoded in was to make 
an animgif. ffmpeg can do this for you.


convert mp4 video to 10fps animated gif

The framerate -r 10 is not necessary, but can reduce filesize
and most animgifs are played at 10fps anyway.

ffmpeg -i input.mp4 -r 10 out.gif


You could probably burn the subtitles into the result while converting 
it to an animgif in just one step, though I haven't tried this.

ffmpeg -i input.mp4  -vf subtitles=subtitles.srt  -r 10  out.gif


Animgifs I've made looked fine with the conversion above, but you may 
have difficulties with colors. They can be improved with a custom 
palette. The following is copied from a suggestion I found online 
somewhere. I haven't tried it, so haven't bothered to find out what all 
the options are for. They're left as an exercise for the reader. :)

generate the palette

ffmpeg -y -ss 30 -t 3 -i input.mp4 \
-vf fps=10,scale=320:-1:flags=lanczos,palettegen palette.png

convert using the palette

ffmpeg  -ss 30  -t 3  -i input.mp4  -i palette.png -filter_complex \
"fps=10,scale=320:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif


Hope this helps,

     - Miriam

-- 
What is the most important thing in the world you could be working on 
right now, and if you are not working on that, why aren't you?
  -- Aaron Swartz (internet genius, philanthropist)



More information about the MPlayer-users mailing list