This page was partly generated by ChatGPT AI.
FFmpeg is a free tool that helps you work with videos and audio files. One cool thing you can do with it is take pictures (frames) out of a video, like an MP4 file. Here’s how you can do that step by step.
MP4 will be used in the following commands, but FFmpeg also supports other video formats like AVI, MOV, MKV and MPEG.
Before you start, make sure you have:
FFmpeg Installed:
Command Line Access:
A Video File:
Before running any commands, make sure to prepare the following:
It’s important to see file extensions like .mp4
or .avi
when renaming your video file.
On Windows:
On macOS:
output_frames
in the directory where the FFmpeg executable is located. This is where your extracted frames will be saved.input
followed by its file extension (e.g., input.mp4
, input.avi
, etc.). This ensures that the commands below will work without modification.Before you can use FFmpeg, you need to open it using the command line. Here’s how you can do it step by step on Windows and macOS.
Open the Command Prompt:
Windows
key and the R
key at the same time to open the Run box.cmd
and press Enter. This opens the Command Prompt.Go to the FFmpeg Folder:
cd
command to go to the folder where you saved FFmpeg.ffmpeg-2024\bin
on your desktop, type this:cd C:\Users\YourUsername\Desktop\ffmpeg-2024\bin
(Replace "YourUsername" with your actual username on the computer.)Check That FFmpeg Works:
ffmpeg -version
Open the Terminal:
Command
and Space
at the same time to open Spotlight Search.Terminal
and press Enter to open it.Go to the FFmpeg Folder:
cd
command to go to the folder where you saved FFmpeg.Downloads
folder, type this:cd ~/Downloads/ffmpeg-2024/bin
Check That FFmpeg Works:
./ffmpeg -version
To save all frames from a video, use this command:
ffmpeg -i input.mp4 output_frames/%d.png
-i input.mp4
: This is your input video file. It should be in the same directory as the FFmpeg executable. Make sure to change input.mp4
to the correct file name and extension.output_frames/frame_%04d.png
: This is how the frames will be saved:output_frames/
: Saves all frames in a folder called output_frames
.%d.png
: The frames will be named using numbers like 1.png
, 2.png
, and so on, keeping them in order.If you don’t want all the frames, you can save one frame every second (or other intervals). Use this command:
ffmpeg -i input.mp4 -vf "fps=1" output_frames/%d.png
-i input.mp4
: This is your input video file. It should be in the same directory as the FFmpeg executable. Make sure to change input.mp4
to the correct file name and extension.-vf "fps=1"
: This saves one frame per second. Change the 1
to another number if you want frames more or less often (e.g., fps=0.5
saves one frame every two seconds, and fps=2
saves two frames every second).output_frames/%d.png
: Saves the frames in a folder named output_frames
with names like 1.png
, 2.png
, and so on.You can also adjust the size and quality of the frames you save. Here’s how:
ffmpeg -i input.mp4 -vf "scale=1280:720" -q:v 2 output_frames/%d.png
-i input.mp4
: This is your input video file. It should be in the same directory as the FFmpeg executable. Make sure to change input.mp4
to the correct file name and extension.-vf "scale=1280:720"
: Changes the frame size to 1280x720 pixels.-q:v 2
: Sets the picture quality (1 is best, higher numbers mean lower quality).output_frames/%d.png
: Saves the frames in a folder named output_frames
with names like 1.png
, 2.png
, and so on.Save Space:
Learn More:
ffmpeg -h
in your terminal to see all the cool things FFmpeg can do.