Skip to content

Instantly share code, notes, and snippets.

@Meettya
Created August 16, 2012 08:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Meettya/3368422 to your computer and use it in GitHub Desktop.
Save Meettya/3368422 to your computer and use it in GitHub Desktop.
ffmpeg command to save still images from video
# 1) to save all frames from (-i INPUT_VIDEO) input video file,
# (-ss 00:10:00) started at 10 minute and (-t 10) stop after 10 seconds,
# (-same_quant) use same quantizer as source (-f image2) with image2 muxer and
# (img-%04d.jpg) img-0001.jpg pattern
#
# - you get bunch of files
ffmpeg -i INPUT_VIDEO -ss 00:10:00 -t 10 -same_quant -f image2 img-%04d.jpg
# 2) to save (-r 6) 6 frames in second
#
# - if input file have 24 FPS and you set output to 6
# - you get 1/4 of all frames
ffmpeg -i INPUT_VIDEO -ss 00:10:00 -t 10 -same_quant -r 6 -f image2 img-%04d.jpg
# 3) to save only I-frames ( -vsync 0 -vf select='eq(pict_type\,I)' )
#
# - you get few files
ffmpeg -i INPUT_VIDEO -vsync 0 -vf select='eq(pict_type\,I)' -ss 00:11:00 -t 60 -same_quant -f image2 img-%04d.jpg
# 4) to save only P-frames
# - you get about half of full numbers of files, its depend on original coding settings
ffmpeg -i INPUT_VIDEO -vsync 0 -vf select='eq(pict_type\,P)' -ss 00:11:00 -t 60 -same_quant -f image2 img-%04d.jpg
@RSully
Copy link

RSully commented Oct 12, 2013

Might need an update since -sameq was removed

@apiszcz
Copy link

apiszcz commented Oct 12, 2015

ffmpeg -i INPUTFILE -qscale 0 -f image2 img-%05d.jpg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment