ffmpeg is complaining about there being a missing %d in the filename because you've asked it to convert multiple frames.

This post suggests this would be a better way of using ffmpeg to extract single frames

ffmpeg -i n.wmv -ss 00:00:20 -t 00:00:1 -s 320×240 -r 1 -f singlejpeg myframe.jpg

[edit]

After a bit more research, here is a command line which works outputing single png frames

ffmpeg -i test.avi -vcodec png -ss 10 -vframes 1 -an -f rawvideo test.png

Tested on my ubuntu 12.04 laptop

Answer from Nick Craig-Wood on Stack Overflow
🌐
api.video
api.video › blog › tutorials › extract-a-set-of-frames-from-a-video-with-ffmpeg-and-python
Extract a set of frames from a video with FFMPEG and Python
April 21, 2021 - This information could be used to do a quick skim of a video or create a trailer for the video programmatically - you could stitch the frames back together afterwards into a short video. If you need a place to upload and host your video from, api.video has you covered! Sign up here: api.video sign up · And check out the reference documentation for our API here: API reference documentation · You need to have Python and FFMPEG installed. The code sample for how to extract images for your video uses the ffmpeg-python module.
Discussions

python - extracting frames using FFMPEG? - Stack Overflow
I'm trying to write code to extract 16 frames from a video file using ffmpeg (or openCV - open to suggestions) and python but I'm having a lot of trouble figuring out how to get started. Can I use ... More on stackoverflow.com
🌐 stackoverflow.com
video - Fastest way to extract frames using ffmpeg? - Stack Overflow
Hi I need to extract frames from videos using ffmpeg.. Is there a faster way to do it than this: ffmpeg -i file.mpg -r 1/1 $filenamed.jpg ? More on stackoverflow.com
🌐 stackoverflow.com
images/frame extraction
Hi, I am trying to extract images from a video both for a whole video and for specific duration of the video. I tried to implement the commands of fffmpeg (from its documnetation) but unable to run them using ffmpeg-python package. I hav... More on github.com
🌐 github.com
2
November 5, 2020
The fast way to extract all frames from video
Use BMP and extract to an m.2 SSD. Be aware that filesize will be ~25x as much as jpeg, but it's lossless and fast to encode. More on reddit.com
🌐 r/ffmpeg
10
0
July 8, 2021
🌐
Medium
medium.com › codex › extract-a-set-of-frames-from-a-video-with-ffmpeg-and-python-dec2293a6856
Extract a Set of Frames From a Video with FFMPEG and Python | by Erikka Innes | CodeX | Medium
June 17, 2021 - import ffmpeg YOUR_FILE = 'sample-mov-file.mov' probe = ffmpeg.probe(YOUR_FILE) time = float(probe['streams'][0]['duration']) // 2 width = probe['streams'][0]['width'] # Set how many spots you want to extract a video from. parts = 7 intervals = time // parts intervals = int(intervals) interval_list = [(i * intervals, (i + 1) * intervals) for i in range(parts)] i = 0 for item in interval_list: ( ffmpeg .input(YOUR_FILE, ss=item[1]) .filter('scale', width, -1) .output('Image' + str(i) + '.jpg', vframes=1) .run() ) i += 1 · You should have the video you want to extract images from in…
Author: fabienbaradel
🌐
DEV Community
dev.to › api_video › unleashing-the-power-of-python-and-ffmpeg-extracting-and-stitching-video-frames-with-ease-2ded
Unleashing the power of python and FFMPEG: Extracting and stitching video frames with ease - DEV Community
October 12, 2023 - Learn how to harness the capabilities of Python and the FFMPEG library to effortlessly extract frames from a video at regular intervals. Explore the step-by-step process, from leveraging the ffmpeg-python module to extracting frames, and discover how to seamlessly stitch them back together into a dynamic video sequence.
🌐
Gumlet
gumlet.com › learn › ffmpeg-extract-frames
How to extract frames from video using FFmpeg? - Gumlet
July 3, 2024 - #!/bin/bash for file in /path/to/videos/*.mp4; do ffmpeg -i "$file" -vf fps=1 /path/to/frames/"$(basename "$file" .mp4)"_d.png done · This script extracts one frame per second (fps=1) from each .mp4 video in the specified directory and saves ...
🌐
Stack Overflow
stackoverflow.com › questions › 35687984 › extracting-frames-using-ffmpeg › 35689725
python - extracting frames using FFMPEG? - Stack Overflow
This example will get the desired info from the first video stream only; otherwise it will also show entries for audio, etc. As the example shows there is no need for additional processes such as grep, sed, awk or anything like that. If you want to remove the avg_frame_rate= and duration= keys then change nk=0 to nk=1. Python people like JSON format, right? If that's the case then you can change -of default=nw=1:nk=0 to -of json. See FFmpeg Wiki: FFprobe Tips for more examples.
Find elsewhere
🌐
Cloudinary
cloudinary.com › home › how to extract frames from video in python
How to Extract Frames from Video in Python | Cloudinary
February 19, 2026 - A simple command like ffmpeg -i video.mp4 -vf "fps=1" frame_d.jpg extracts 1 frame per second efficiently.
🌐
GitHub
github.com › technetbytes › FFMPEG
GitHub - technetbytes/FFMPEG: Get Video frames using ffmpeg library in python · GitHub
Get frames as an image from video files using ffmpeg library. ... $ sudo add-apt-repository ppa:mc3man/trusty-media $ sudo apt-get update $ sudo apt-get install ffmpeg gstreamer0.10-ffmpeg · python ffmpegframeextractor.py -i /home/administrator/Docs/video/WA0012.mp4 -o /home/administrator/Docs/video/frames/ -f 1
Author: technetbytes
🌐
Appdividend
appdividend.com › how-to-extract-and-save-video-frames-with-python
How to Extract and Save Video Frames with Python
September 6, 2025 - To use this approach, you need to install the FFMpeg module in your system. ... If you are using Windows or Linux OS, then you need to install based on your system requirements. import subprocess import os # Custom function def extract_fram...
🌐
GitHub
github.com › singulainthony › frameExtractor
GitHub - singulainthony/frameExtractor: Use python to extract all the frames of a video · GitHub
This Python script extracts all frames from an MP4 video using ffmpeg and then creates a zip file containing all the extracted PNG frames.
🌐
GitHub
gist.github.com › ramsafin › a3b46638911f20ca1108e24dbacad8eb
Extract frames FFmpeg (Python) · GitHub
Extract frames FFmpeg (Python) Raw · extract_frames.py · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
🌐
MoviePy
zulko.github.io › blog › 2013 › 09 › 27 › read-and-write-video-frames-in-python-using-ffmpeg
Read and write video frames in Python using FFMPEG - __del__( self )
If the video has a size of 420x320 pixels, then the first 420x360x3 bytes outputed by FFMPEG will give the RGB values of the pixels of the first frame, line by line, top to bottom. The next 420x360x3 bytes afer that will represent the second frame, etc. In the next lines we extract one frame ...
Top answer
1 of 2
3

This prints the frame number on the left upper corner of each frame output and selects only 1 frame every 30 frames:

ffmpeg -reinit_filter 0 -i "input.mkv" -vf "drawtext=text='%{n}':start_number=1:fontcolor=white:bordercolor=black:borderw=3:fontsize=200,select='not(mod(n,30))',scale=-1:720" -fps_mode vfr -y "IMG_Folder\%6d.jpg"

If you want the counter to start at 0 then 30,60,90 instead of 1,31,61,91 remove the startnumber part.

In Windows you can use something like this to do this to all videos inside a folder and save the pictures in a folder same name as video:

for %a in (*.mp4 *.mkv) do if not exist "%~na" md "%~na"& ffmpeg -reinit_filter 0 -i "%~a" -vf "drawtext=text='%{n}':fontcolor=white:bordercolor=black:borderw=3:fontsize=200,select='not(mod(n,30))',scale=-1:720" -fps_mode vfr -y "%~na\%6d.jpg"
2 of 2
1

At it's most simple, extract single image from frame of video:

ffmpeg -i video.mp4 -ss HH:MM:SS -vframes 1 image.jpg
#!/bin/bash

file="$1"
name="${file%.*}"

# Extract the first frame
ffmpeg -hide_banner -i "$file" -vf "select=eq(n\,0)" -vsync vfr "$name-first_frame.jpg"

# Set the frame interval
frame_interval=30

# Calculate digits required for frame numbering
total=$(ffmpeg -i "$file" -map 0:v:0 -c copy -f null -y /dev/null 2>&1 | grep -Eo 'frame= *[0-9]+' | grep -Eo '[0-9]+' | tail -1)
digits=${#total}

# Extract every nth frame and rename to include actual frame number
ffmpeg -hide_banner -i "$file" -vf "select='not(mod(n\,$frame_interval))',showinfo" -vsync vfr temp_%0${digits}d.jpg 2>&1 | grep 'pts_time' | awk -v name="$name" -v digits="$digits" -F'|' '{ 
    split($5, a, "="); 
    split($8, b, "="); 
    printf "mv temp_%0" digits "d.jpg " name "-frame_%0" digits "d.jpg\n", b[2], b[2]*30 
}' | bash

# Remove temporary files
rm temp_*.jpg

exit 0

Save as: frame_extract.sh
Change mode executable: chmod +x frame_extract.sh
Usage: ./frame_extract.sh input_file.mkv


# Define the file path as a parameter
param(
    [Parameter(Mandatory=$true)]
    [string]$FilePath
)

# Get the file name without extension
$name = [System.IO.Path]::GetFileNameWithoutExtension($FilePath)

# Extract the first frame
& ffmpeg -hide_banner -i $FilePath -vf "select=eq(n\,0)" -vsync vfr "$name-first_frame.jpg"

# Set the frame interval
$frameInterval = 30

# Calculate digits required for frame numbering with zero padding
$totalFramesOutput = & ffmpeg -i $FilePath -hide_banner -map 0:v:0 -c copy -f null - 2>&1
$totalFrames = ($totalFramesOutput | Select-String -Pattern 'frame=\s*[0-9]+' | ForEach-Object { $_.Matches } | ForEach-Object { $_.Value.TrimStart("frame=") } | Select-Object -Last 1)
$digits = $totalFrames.Length

# Extract every nth frame and rename to include actual frame number
$output = & ffmpeg -hide_banner -i $FilePath -vf "select='not(mod(n\,$frameInterval))',showinfo" -vsync vfr "temp_%0${digits}d.jpg" 2>&1
$output | Select-String -Pattern 'pts_time' | ForEach-Object {
    if ($_ -match 'pts_time:(\d+)') {
        $frameNumber = int
        $paddedFrameNumber = $frameNumber.ToString("D$digits")
        $tempFileName = "temp_" + $frameNumber.ToString("D$digits") + ".jpg"
        $newFileName = "$name-frame_$paddedFrameNumber.jpg"
        Rename-Item -Path $tempFileName -NewName $newFileName
    }
}

# Remove temporary files
Remove-Item "temp_*.jpg"

I'm not the greatest at PowerShell, but this should be close.
I have no way to test it, but it should help. (Hopefully!)


Added logic to grab the first frame.
Output filename uses frame count, not sequential numbers.

🌐
Medium
medium.com › @alibugra › extract-frames-as-an-image-from-video-files-using-ffmpeg-65b52d3d97db
Extract frames as an image from video files using FFMPEG | by Ali Buğra Kanburoğlu, PhD | Medium
June 14, 2018 - After the installation of FFMPEG, terminal (command prompt) will recognize FFMPEG commands, so we can use it from terminal as below. ... In the above code, the command outputs a frame as an image for every second in “img” folder. By changing the “fps” parameter, output frames could be changed such as; fps=1 means every second, fps=1/60 means every minute, fps=1/600 means every ten minutes. I shared a structure that helps to extract images from video files with the help of Python’s subprocess module that runs the above command.
🌐
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 ...
🌐
GitHub
github.com › kkroening › ffmpeg-python › issues › 441
images/frame extraction · Issue #441 · kkroening/ffmpeg-python
November 5, 2020 - I am trying to extract images from a video both for a whole video and for specific duration of the video. I tried to implement the commands of fffmpeg (from its documnetation) but unable to run them using ffmpeg-python package. I have already gone thgrough some related closed issues but did not succeeded while trying custom filter option.
Author: kkroening
🌐
RenderIO
renderio.dev › blogs › ffmpeg-extract-frames
FFmpeg Extract Frames from Video: Every Method | RenderIO Blog
March 19, 2026 - Frame count adds up fast. A 60-second video at 30fps has 1,800 frames. A 5-minute video at 30fps produces 9,000. Extract all of them as PNG and you're looking at 10-45GB of disk space. Be deliberate about what you extract. ... -frames:v 1 tells FFmpeg to stop after one video frame.
🌐
Pixotter
pixotter.com › home › blog › extract frames from video: 5 methods that actually work
Extract Frames from Video: 5 Methods That Actually Work
June 4, 2026 - Pull one frame every 30 seconds from a feature-length video to get a visual timeline: ffmpeg -i movie.mp4 -vf "fps=1/30" storyboard_d.jpg · A 90-minute film yields 180 frames. That is a complete storyboard in under a minute.