Skip to content

Instantly share code, notes, and snippets.

@chaojian-zhang
Last active September 26, 2023 23:44
Show Gist options
  • Save chaojian-zhang/8f90f82c336363fb1afca2795cf75b64 to your computer and use it in GitHub Desktop.
Save chaojian-zhang/8f90f82c336363fb1afca2795cf75b64 to your computer and use it in GitHub Desktop.
FFMPEG Snippets
  • Convert images to video: ffmpeg -framerate 4 -start_number 51 -i _DSC12%d.jpg -c:v libx264 -r 4 output.mp4 (Recommendataion) Use Screen2Gif's editor instead.
  • Convert video into gif
  • Convert video into image sequence:
  • Crop video: ffmpeg -i in.mp4 -vf crop=w:h:x:y out.mp4
  • Change video frame rate:
  • Scale video resolution: ffmpeg -i input.avi -vf scale=320:240 output.avi
  • Scaleing while keeping aspect ratio: ffmpeg -i input.jpg -vf scale=320:-1 output_320.png
  • Scale images: ffmpeg -i input.jpg -vf scale=320:240 output_320x240.png
  • Multiple filters (separate using comma): ffmpeg -i 1.mp4 -vf "crop=720:720:264:0, scale=320:-1" 1.gif
  • Trim/Cut video: ffmpeg -i input.mp4 -ss 00:05:20 -t 00:10:00 -c:v copy -c:a copy output1.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment