Skip to content

Instantly share code, notes, and snippets.

@docPhil99
Last active July 24, 2020 10:12
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 docPhil99/8d8a9b89c2073087cf882bf17dd2bf02 to your computer and use it in GitHub Desktop.
Save docPhil99/8d8a9b89c2073087cf882bf17dd2bf02 to your computer and use it in GitHub Desktop.
Some useful command in ffmpeg

Speed

  • ffmpeg -i input.mkv -filter:v "setpts=0.5*PTS" output.mkv increases doubles playback speed, by dropping frames see

Playback

  • ffmpeg -i input.mp4 -f opengl "window title" or use ffplay

Convertion

  • ffmpeg -i video.flv video.mpeg
  • ffmpeg -i input.webm -qscale 0 output.mp4 keep the same quality
  • ffmpeg -i input.mp4 -t 10 output.avi convert the first 10 seconds
  • ffmpeg -i input.mp4 -ss 00:00:50 -codec copy -t 50 output.mp4 as above but adds a start time
  • ffmpeg -i audio.mp3 -ss 00:01:54 -to 00:06:53 -c copy output.mp3 or specify end time

Frame Size

  • ffmpeg -i input.mp4 -filter:v scale=1280:720 -c:a copy output.mp4
  • ffmpeg -i input.mp4 -filter:v scale=1280:-1 -c:a copy output.mp4

Images

  • ffmpeg -i input.mp4 -r 1 -f image2 image-%2d.png convert to images -r 1 is the number per second, default is 25

Remove Audio

  • ffmpeg -i input.mp4 -an output.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment