Skip to content

Instantly share code, notes, and snippets.

@shmaltorhbooks
Last active August 2, 2022 16:12
Show Gist options
  • Save shmaltorhbooks/fcab5bddcbe68187b59b7c0fe8823934 to your computer and use it in GitHub Desktop.
Save shmaltorhbooks/fcab5bddcbe68187b59b7c0fe8823934 to your computer and use it in GitHub Desktop.
ffmpeg commands
# compress to 960:540 and reduce framerate to 30fps
ffmpeg -i input.mp4 -vf "fps=30,scale=960:540" output.mp4
# cut fragment from 3 sec to 8 sec
ffmpeg -i input.mp4 -ss 00:00:03 -t 00:00:08 -async 1 -c copy fragment.mp4
# concat files: create list and compress
for %%i in (*.mp4) do echo file '%%i'>> mylist.txt
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4
#reverse only video
ffmpeg -i input.mp4 -vf reverse output.mp4
#reverse video and audio
ffmpeg -i input.mp4 -vf reverse -af areverse ouptput.mp4
# flip video horizontally
ffmpeg -i input.mp4 -vf hflip -c:a copy output.mp4
# generate one image every second, named out1.png, out2.png, out3.png, etc.
ffmpeg -i input.mp4 -vf fps=1 out%d.png
# generate one image every minute, named img001.jpg, img002.jpg, img003.jpg, etc. The %03d dictates that the ordinal number of each output image will be formatted using 3 digits.
ffmpeg -i myvideo.avi -vf fps=1/60 img%03d.jpg
# generate one image every ten minutes:
ffmpeg -i test.flv -vf fps=1/600 thumb%04d.jpg
# generate single image with screenshots
ffmpeg -i input.mp4 -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
ffmpeg -ss 00:00:10 -i movie.avi -frames 1 -vf "select=not(mod(n\,1000)),scale=320:240,tile=2x3" out.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment