Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # You'll have to modify the script if you want to change start_time and duration.
- # just remember, the longer the duration the bigger the GIF output. Most sites will only allow 3MB GIFs.
- # Here'sa quick little ffmpeg video to GIF converter
- # its all so simple, and all you need to do is change
- # the format settings if desired for different outputs.
- # actually before I can let you get started I just want
- # point out what the current options I have chosen are
- # just for this little script of mine.
- ## -t duration (input/output)
- ## -ss position (input/output) seeks out time where to start at [ minutes - 00:00 | hours - 00:00:00 ]
- ## -y (global) overwrite output files without asking
- ## -vf filtergraph (output) create filtergraph specified by filtergrtaph and filter the stream
- ## -v loglevel
- ## -gifflags
- ## +transdiff (transparency support) / -transdiff (non-transparency support)
- #
- # ok so now that is out the way here is the rest of the script
- #
- start_time=00:00 # start time of GIF
- duration=5 # duration of GIF
- palette="/tmp/palette.png" # temporary palette
- filters="fps=20,scale=440:-1:flags=lanczos" # FPS and Scale of GIF
- ffmpeg -y -v warning -ss $start_time -t $duration -i $1 -vf "$filters,palettegen" $palette
- ffmpeg -y -v warning -ss $start_time -t $duration -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse=dither=bayer:bayer_scale=1" $2
- # you should be able to use the script like so;
- #
- ## $ ./makegif.sh video.mp4 anime.gif
- #
- # All credits to helping to make this script go to http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
- # additional info for ffmpeg usage at https://www.ffmpeg.org/ffmpeg.html
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement