If the JPEG encoding step is too performance intensive, you could always store the frames uncompressed as BMP images:

ffmpeg -i file.mpg -r 1/1 $filename%03d.bmp

This also has the advantage of not incurring more quality loss through quantization by transcoding to JPEG. (PNG is also lossless but tends to take much longer than JPEG to encode.)

Answer from Multimedia Mike on Stack Overflow
🌐
Bannerbear
bannerbear.com › blog › how-to-extract-images-from-a-video-using-ffmpeg
How to Extract Images from a Video Using FFmpeg - Bannerbear
November 18, 2024 - To extract only an image at a given time like how you would normally take a screenshot, add -frames:v 1 to the command. This will output a single frame at the time specified. For example, this command will output a single frame at 00:04 of the ...
People also ask

How do I extract frames from a specific time range?
Combine -ss (start) with -t (duration):
ffmpeg -ss 00:01:00 -i input.mp4 -t 10 -vf "fps=1" range_%03d.jpg
This extracts one frame per second from the 1:00 to 1:10 mark.
🌐
ffmpeg-micro.com
ffmpeg-micro.com › blog › how to extract frames from video with ffmpeg
How to Extract Frames from Video with FFmpeg | FFmpeg Micro
Can I extract frames as PNG instead of JPEG?
Yes. Change the extension to .png. FFmpeg picks the encoder from the file extension. PNG is lossless but much larger. The same frame that was 23KB as JPEG was 269KB as PNG. About 11x bigger.
ffmpeg -ss 5 -i input.mp4 -frames:v 1 frame.png
🌐
ffmpeg-micro.com
ffmpeg-micro.com › blog › how to extract frames from video with ffmpeg
How to Extract Frames from Video with FFmpeg | FFmpeg Micro
What's the fastest way to extract a single frame?
Put -ss before -i and add -frames:v 1. FFmpeg seeks to the nearest keyframe, decodes forward to your timestamp, outputs one frame, and exits. On a 2GB file, this typically completes in under 100ms.
🌐
ffmpeg-micro.com
ffmpeg-micro.com › blog › how to extract frames from video with ffmpeg
How to Extract Frames from Video with FFmpeg | FFmpeg Micro
🌐
Baeldung
baeldung.com › home › scripting › extracting frames from a video using ffmpeg
Extracting Frames From a Video Using FFmpeg | Baeldung on Linux
March 18, 2024 - We can also extract multiple frames from the desired time offset. Let’s extract 25 frames from the video starting at five seconds with the rate of 10 frames per second: $ ffmpeg -i big_buck_bunny_720p_2mb.mp4 -ss 00:00:05 -r 10 -s 640x360 -q:v 2 -vframes 25 framed.jpg
🌐
FFmpeg Micro
ffmpeg-micro.com › blog › how to extract frames from video with ffmpeg
How to Extract Frames from Video with FFmpeg | FFmpeg Micro
May 16, 2026 - Grab one frame from a specific point in the video. ffmpeg -ss 00:00:05 -i input.mp4 -frames:v 1 frame.jpg · Two things matter here. Put -ss before -i. This tells FFmpeg to seek before decoding, which is dramatically faster on long videos.
🌐
CodeGenes
codegenes.net › blog › fastest-way-to-extract-frames-using-ffmpeg
The Fastest Way to Extract Frames Using FFmpeg: Optimized Command Tutorial for Speed — codegenes.net
ffmpeg -c:v h264_cuvid -i input.mp4 \ # NVIDIA GPU decoding -threads 0 \ # Use all CPU cores -vsync vfr \ # Preserve original timestamps -r 5 \ # Extract 5 frames/second -q:v 3 \ # JPEG quality (fast) -pix_fmt yuv420p \ # Efficient pixel format output_d.jpg
Find elsewhere
🌐
RenderIO
renderio.dev › blogs › ffmpeg-extract-frames
FFmpeg Extract Frames from Video: Every Method | RenderIO Blog
March 19, 2026 - When you ask FFmpeg to extract ... practical consequences: Seeking is not instant. Put -ss before -i for fast (but slightly imprecise) seeking that uses the container's index....
🌐
Medium
hansheng0512.medium.com › extract-frames-from-video-with-ffmpeg-in-one-minute-526da15090ec
Extract Frames From Video with FFmpeg in One Minute | by Liang Han Sheng | Medium
December 25, 2022 - And fps=1/10 will extract 1 frame per 10 seconds. ... To read more about the FFmpeg, feel free to checkout their documentation.
🌐
Shotstack
shotstack.io › home › learn › use ffmpeg to extract frames from video
Use FFmpeg to extract frames from video — Shotstack
March 26, 2024 - Use the command below to extract a frame from a specific timestamp in your video. ffmpeg -i input.mp4 -ss 00:00:02 -frames:v 1 specific.jpg
🌐
Creatomate
creatomate.com › blog › how-to-extract-images-from-a-video-using-ffmpeg
How to Extract Images From a Video using FFmpeg - Creatomate
October 17, 2022 - To extract every 10 seconds, use -r 1/10. Here's how to get only the images between a given period of time: $ ffmpeg -ss 5 -to 8 -i input.mp4 framed.png The -ss 5 -to 8 arguments instruct FFmpeg to only extract frames between 5 and 8 seconds of the video. This argument should be placed before ...
🌐
Fast.ai
forums.fast.ai › part 1 (2019)
Extracting frames from video file with ffmpeg - Part 1 (2019) - fast.ai Course Forums
November 9, 2018 - Here is a bit of code to extract individual frames from a video: The code expects that ffmpeg is installed and in your PATH. the inputs to the function: filename = video file name saved_directory is a path to save the files. frame_list is a list of dictionaries where each dictionary contains ‘frame_number’ and ‘filename’. frame_number is the index of the frame to extract. filename is the name of the image after its been extracted example of frame list: first_item = {‘frame_number’:10, ‘...
🌐
FFmpeg Cookbook
ffmpeg-cookbook.com › home › video conversion › extract frames from video with ffmpeg — save as png or jpg
Extract Frames from Video with FFmpeg — Save as PNG or JPG
June 27, 2026 - ffmpeg -i input.mp4 -ss 00:00:05 -frames:v 1 output.png · Cause: PNG is lossless, so high-resolution or noisy images stay large. Fix: Try JPG with -q:v, or a smaller resolution, on a short part of the video first. Q1. What’s the difference between extracting frames and making a thumbnail?
🌐
Trek View
trekview.org › blog › choosing-right-frame-extraction-rate-ffmpeg
Setting the right frame rate for video extraction using ffmpeg | Trek View
February 11, 2022 - speed m/s = distance between points (metres) / duration (secs) speed m/s = 100/20 speed m/s = 5 extraction rate fps = speed (m/s) / desired spacing of frames (metres) extraction rate fps = 5/1 extraction rate fps = 5 · Using this value, you can use ffmpeg like before, adjusting the -r value; $ ffmpeg -i VIDEO.mp4 -r 5 -q:v 2 FRAMES/img%d.jpg ... More accurate than option 1 as it accounts for differing people (e.g. some walk faster than others).
🌐
GitHub
gist.github.com › loretoparisi › a9277b2eb4425809066c380fed395ab3
Extract all frames from a movie using ffmpeg · GitHub
@illtellyoulater Just skip the frame rate parameters. It should look something like this: ffmpeg -i input.mkv outd.png ... If you have an HDR movie, you can extract high quality images using: ffmpeg -i HDR.mov -vf zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p 'd.png'
Top answer
1 of 1
3

Using -r 0.1 sets the output framerate to 0.1Hz, but it's not guaranteed to get frame from the input video exactly every 10 seconds (I am not sure why).

One way for solving it is using select filter.

Example (without GPU acceleration):

ffmpeg -i input.mp4 -vf "select=bitor(gte(t-prev_selected_t\,10)\,isnan(prev_selected_t))" -vsync 0 f%09d.jpg

  • bitor(gte(t-prev_selected_t\,10) is 1 when difference between "passed" timestamps is grater of equal 10 seconds.
    When expression is evaluated to 1, the frame is "selected" and passed to the output.
  • bitor with isnan(prev_selected_t) passes the first frame, where prev_selected_t is NaN (has no value).
  • -vsync 0 applies "passthrough" - Each frame is passed with its timestamp from the demuxer to the muxer.

Here is an example with scale_cuda and thumbnail_cuda:

ffmpeg \
    -loglevel error \
    -hwaccel cuvid \
    -hwaccel_output_format cuda \
    -c:v h264_cuvid \
    -i "$video_file" \
    -filter:v "scale_cuda=w=-1:h=100,thumbnail_cuda=2,hwdownload,format=nv12,select=bitor(gte(t-prev_selected_t\,10)\,isnan(prev_selected_t))" \
    -vsync 0 \
    -color_range 2 \
    f%09d.jpg   
  • Due to the usage of thumbnail_cuda filter, we have to place the select filter at the end.

Testing:
Build synthetic video with frame counter at 10fps:

ffmpeg -y -f lavfi -r 10 -i testsrc=size=128x72:rate=1:duration=1000 -vf setpts=N/10/TB -vcodec libx264 -pix_fmt yuv420p input.mp4

Output frames after executing the above command:


As you can see, the selected frames are exactly every 10 seconds.