Official ffmpeg documentation on this: Create a thumbnail image every X seconds of the video

Output one image every second:

ffmpeg -i input.mp4 -vf fps=1 out%d.png

Output one image every minute:

ffmpeg -i test.mp4 -vf fps=1/60 thumb%04d.png

Output one image every 10 minutes:

ffmpeg -i test.mp4 -vf fps=1/600 thumb%04d.png
Answer from Vitaliy Fedorchenko on Stack Overflow
🌐
GitHub
gist.github.com › FranciscoG › c63760be6d77ab44d919772b2b7b8f82
Convert Video to Image sequence using ffmpeg · GitHub
Convert Video to Image sequence using ffmpeg. GitHub Gist: instantly share code, notes, and snippets.
People also ask

Does extracting frames affect the original video?
A. No. These commands only read the video and write separate image files. Check the output folder and file names first, so that no important file gets overwritten. If you only need one picture, the browser thumbnail tool saves only the frames you pick instead of thousands of images.
🌐
ffmpeg-cookbook.com
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
What's the difference between extracting frames and making a thumbnail?
A. Extracting frames saves plain stills at the rate you choose. The thumbnail guide is about one representative image: letting FFmpeg pick the frame, and setting its size.
🌐
ffmpeg-cookbook.com
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
🌐
Medium
medium.com › @marycriv › video-to-image-conversion-in-the-command-line-using-ffmpeg-83dace3409ca
Video to image conversion in the Command Line using FFmpeg | by Mary Crivelli | Medium
August 11, 2020 - I personally use this to make GIFs for GIPHY and Reddit, as I find the image results produced by FFmpeg are much higher quality than the results produced by the apps available for MacOS like Adapter Video Converter (a tool built on FFmpeg). It could also prove helpful in producing a random sampling of screen captures of a video for metadata/thumbnails on a home media server, or by pulling video frames you intend to use as pictures.
Top answer
1 of 4
42

Just mux the images

You can simply mux the JPG images to make a video:

ffmpeg -framerate 30 -i input%03d.jpg -codec copy output.mkv

Note that if you omit -framerate then a default of -framerate 25 will be applied to the input.

Lossless optimization

You can use jpegtran to perform lossless optimization on each frame which may provide significant file size savings:

mkdir outputdir
for f in *.jpg; do jpegtran -optimize -copy none -perfect -v "$f" > "outputdir/$f"; done

Now mux with ffmpeg as shown above.

Checking that it is actually lossless

The framehash muxer can be used to compare the unique hash of each frame to ensure that the result is truly lossless:

$ ffmpeg -i input%03d.jpg -f framehash -
stream_index, packet_dts, packet_pts, packet_duration, packet_size, hash
0,          0,          0,        1,   460800, 29bcc2db3726c7dfec1826c5740f603f
0,          1,          1,        1,   460800, b5fdc23d93cbd043dc2b9290dc8378f0
0,          2,          2,        1,   460800, ee0709942f24b458fd2380d134dcb59d
...

$ ffmpeg -i output.mkv -map 0:v -f framehash -
stream_index, packet_dts, packet_pts, packet_duration, packet_size, hash
0,          0,          0,        1,   460800, 29bcc2db3726c7dfec1826c5740f603f
0,          1,          1,        1,   460800, b5fdc23d93cbd043dc2b9290dc8378f0
0,          2,          2,        1,   460800, ee0709942f24b458fd2380d134dcb59d
...

In the above examples each associated frame for the input and output share the same hash ensuring that the frames are identical and that the output is lossless.

Also see

  • FFmpeg image file demuxer documentation
  • FFmpeg Wiki: How do I encode single pictures into movies?
2 of 4
14

This will output a lossless H.264 video where frames will use information from other frames

ffmpeg -f image2 -r 30 -i %09d.jpg -vcodec libx264 -profile:v high444 -refs 16 -crf 0 -preset ultrafast a.mp4

Explanation of options:

  • -f image2 - tells ffmpeg to select a group of images
  • -r 30 - tells ffmpeg to encode at 30 frames (or images) per second (change this to your desired framerate)
  • -i %09d.jpg - tells ffmpeg to use the images 000000000.jpg to 999999999.jpg as the input. Change the 9 in %09d.jpg to how many zeroes the names of your image sequence has. If your file names are, for example, img0001.jpg, then this would be expressed as img%04d.jpg
  • -vcodec libx264 - tells ffmpeg to output to a H.264 compliant file
  • -profile:v high444 - tells libx264 to use the High 4:4:4 Predictive Lossless profile, allowing lossless encoding
  • -refs 16 - tells libx264 to have 16 images stored in a buffer, so that they may be referenced by other images in the video
  • -crf 0 - tells libx264 to perform a lossless encode
  • -preset ultrafast - tells libx264 to prioritise encoding speed over output file size
  • a.mp4 - tells ffmpeg to save the output in an MP4 file called a.mp4. Change this to the file name and format that you wish to use
Find elsewhere
Top answer
1 of 3
342

Use -qscale:v to control quality

Use -qscale:v (or the alias -q:v) as an output option.

  • Normal range for JPEG is 2-31 with 31 being the worst quality.
  • The scale is linear with double the qscale being roughly half the bitrate.
  • Recommend trying values of 2-5.
  • You can use a value of 1 but you must add the -qmin 1 output option (because the default is -qmin 2).

To output a series of images:

ffmpeg -i input.mp4 -qscale:v 2 output_%03d.jpg

See the image muxer documentation for more options involving image outputs.

To output a single image at ~60 seconds duration:

ffmpeg -ss 60 -i input.mp4 -qscale:v 4 -frames:v 1 output.jpg

To continuously overwrite/update/save to a single image

Use -update 1 image muxer option. Example for once per second from a live streaming input:

ffmpeg -i rtmp://input.foo -q:v 4 -r 1 -update 1 output.jpg

Also see

  • FFmpeg FAQ: How do I encode movie to single pictures?
  • FFmpeg Wiki: Create a thumbnail image every X seconds of the video
2 of 3
22

Output the images in a lossless format such as PNG:

mkdir stills
ffmpeg -i my-film.mp4 -vsync 0 -f image2 stills/my-film-%06d.png

Then use another program (where you can more precisely specify quality, subsampling and DCT method – e.g. GIMP) to convert the PNGs you want to JPEG.

It is possible to obtain slightly sharper images in JPEG format this way than is possible with -qmin 1 -q:v 1 and outputting as JPEG directly from ffmpeg.

If you want to extract only the key frames (which are likely to be of higher quality post-edit) you can use something like this:

ffmpeg -skip_frame nokey -i my-film.mp4 -vsync 0 -f image2 stills/my-film-%06d.png

The -vsync 0 parameter avoids needing to specify the frame rate with -r and means all frames in the input file are treated as, um, a frame.

🌐
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 - A. Yes. Use a .jpg output name and -q:v 2 for high quality (section 4). Q4. Why does my image sequence overwrite itself? A. Check whether the command has -update 1, which writes every frame to the same image, and whether you reused an output folder.
🌐
Readthedocs
natron.readthedocs.io › en › rb-2.5 › guide › tutorials-imagesequence.html
How To Convert Videos To Image Sequences — Natron 2.5.0 documentation
ffmpeg -framerate 30 -i inputd.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4 · Import the image “as sequence” in the timeline (or drag’n’drop the folder) and render in your preferred video format.
🌐
Quora
quora.com › How-can-I-extract-a-good-quality-JPEG-image-from-a-video-file-with-FFmpeg
How to extract a good quality JPEG image from a video file with FFmpeg - Quora
Answer (1 of 2): Use [code ]-qscale:v[/code] to control quality Use [code ]-qscale:v[/code] (or the alias [code ]-q:v[/code]) as an output option. * Normal range for JPEG is 2-31 with 31 being the worst quality. * The scale is linear with double the qscale being roughly half the bitrate. * R...
🌐
Zayne
zayne.io › articles › gifs-and-video-from-images-with-ffmpeg
Creating Animated Videos and GIFs from Image Sequences with FFmpeg - zayne.io
December 27, 2024 - Before diving into animation, ensure your images are in an optimal format. Modern devices often capture in HEIC format, which FFmpeg can handle directly, but converting to a more universal format can improve compatibility and processing speed. ... # Convert HEIC to JPEG with quality control mogrify -format jpg -quality 90 *.HEIC # Convert to PNG for lossless quality mogrify -format png *.HEIC # Resize during conversion to optimize file sizes mogrify -format jpg -resize 1920x1080 -quality 85 *.HEIC
🌐
PlainlyVideos
plainlyvideos.com › home › blog › a simple guide to using ffmpeg to convert images to video
A simple guide to using FFmpeg to convert images to video
May 6, 2025 - This tutorial will show you how to create a video slideshow with on-screen text and audio just from a few simple images. Let’s dive right in. FFmpeg aims to be the best technical solution for developers who want to use this command line tool to convert multimedia files between formats.
🌐
GitHub
gist.github.com › rlan › ab255879c2304a25928ddb190de6b552
Convert video to jpg and back using ffmpeg · GitHub
ffmpeg -f image2 -framerate 30 -i d.jpg -c:v libx264 out.mp4 ... You're very welcome. ... @pidgeon777 AFAIK, the frame rate is not saved in the extracted jpg files. So one has to enter that number on the command line when converting back to video.
🌐
Wondershare Filmora
filmora.wondershare.com › basic-video-editing › ffmpeg-image-sequence-to-video.html
How To Convert FFmpeg Image Sequence to Video - Filmora
June 9, 2026 - FFmpeg (Fast Forward Moving Picture ... and programs for handling multimedia data. And it offers a range of customizable options to convert image sequence to high-quality video....
🌐
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 - Similarly, -vf fps=2/4 will output 2 images every 4 seconds. In the tutorial How to Make a GIF from a Video Using FFmpeg, -ss "x seconds" and -t "y seconds” are added to the command to specify the part of the video that we want to convert.
🌐
OTTVerse
ottverse.com › home › ffmpeg › extract frames using ffmpeg: a comprehensive guide
Extract Frames using FFmpeg: A Comprehensive Guide - OTTVerse
August 21, 2023 - The -q:v 1 argument sets the quality of the output image. The quality value can range from 1 (highest quality) to 31 (lowest quality). For JPEG output, the filesize is inversely proportional to the quality value, meaning a lower quality value ...
🌐
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 - By using -1, FFmpeg calculates the height automatically, keeping the image proportional.
🌐
Enlaps
enlaps.io › guide › ffmpeg
Ffmpeg: 5 Steps To Create ffmpeg Video From Images | Enlaps
Yes, FFmpeg is highly effective for working with images. It can convert, edit, and combine images into videos, as well as extract frames from videos, making it a versatile tool for image processing.