Skip to content

Instantly share code, notes, and snippets.

@rogeriochaves
Last active April 23, 2023 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogeriochaves/1e4073db13a3ca3e0851c9254442bb04 to your computer and use it in GitHub Desktop.
Save rogeriochaves/1e4073db13a3ca3e0851c9254442bb04 to your computer and use it in GitHub Desktop.
ffmpeg useful scripts
# Convert video to gif
ffmpeg -i input.mp4 -filter_complex "[0]fps=10" output.gif
ffmpeg -ss 00:00:00.000 -i newtab.mov -pix_fmt rgb24 -r 10 output.gif
convert -verbose -dither none -matte -depth 8 -deconstruct -layers optimizePlus -colors 32 output.gif optimized.gif
# Convert mkv to mp4
ffmpeg -i input.mkv -codec copy output.mp4
# Extract subtitles
ffmpeg -i input.mkv -map 0:s:0 subs.srt
# Change encoding
iconv -f windows-1252 -t utf8 subs.srt > subs-utf8.srt
# Convert mov to mp4
ffmpeg -i movie.mov -vcodec copy out.mp4
ffmpeg -i movie.mov -vcodec h264 -acodec mp2 out.mp4
# Rotate video
ffmpeg -i horizontal-video.mp4 -c copy -metadata:s:v:0 rotate=270 vertical-video.mp4
# Burn subtitles into video
ffmpeg -i genzbreakup.mp4 -vf "subtitles=When Gen Z breaks up.srt:force_style='Alignment=2,Fontsize=12,BorderStyle=1,MarginV=60'" genzbreakup_with_srt.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment