Extract Frames From Video with FFmpeg in One Minute


  1. FFmpeg Installation
  2. Learn how to extract frames from video using FFmpeg


First, download or install the FFmpeg packages.

For MacOS, simply do brew install ffmpeg and for Ubuntu, use sudo apt install ffmpeg. For Windows, it’s a bit trickier, you will have to download FFmpeg build and set it up manually. You will need the two steps below:

  1. Download FFmpeg release essentials here.
  2. Add the bin folder to Windows Environment Path Variable to run this tool without having to specify the full path every time.

For more details, check out the previous Medium article I had written — FFmpeg — Your powerful video/audio helper in your application.


You can run the following command to extract every frame in the video.

  • -i : input file(s)
ffmpeg -i video.mp4 output%06d.png

You can further specify how many frames to extract per second. For example, the command below with fps=2 will extract 2 frames per second.

  • -vf : per-stream -filter option for video
ffmpeg -i video.mp4 -vf fps=2 output%06d.png

And fps=1/10 will extract 1 frame per 10 seconds.

ffmpeg -i video.mp4 -vf fps=1/10 output%06d.png

To read more about the FFmpeg, feel free to checkout their documentation.

Here is a quick demo.

Demo (Video source)


  1. https://github.com/FFmpeg/FFmpeg

About Author

This article is written by Han Sheng, Junior Artificial Intelligence Engineer in CertifAI, Penang, Malaysia. He has a passion for Deep Learning, Computer Vision and also Edge Devices. He made several AI-based Web/Mobile Applications to help clients solving real-world problems. Feel free to read about him via his portfolio or Github profile.




Full Stack AI Application Development | Computer Vision | Deep Learning | Edge Devices

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

BIS Certificate For Barcode Scanner | CRS Certification

Handling eventual consistency in a SPA

Client onboarding @ Typeqast — How we work together

Meet the SB Hacks Team: Former Co-Directors SPECIAL!

Peter’s R — diary

Why @HRCrossingis different? 🤔

Grub Rescue Mode — All About Solving The Error

How to become famous on GitHub

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Draden Liang Han Sheng

Draden Liang Han Sheng

Full Stack AI Application Development | Computer Vision | Deep Learning | Edge Devices

More from Medium

Use CUDA 11.0 for RAPIDS 21.12 with TensorFlow 2.4 in Ubuntu 18.04

How to Automatically Design an Efficient Neural Network

How to enable TensorFlow to use GPU drivers on Windows

How to setup CUDA and TensorFlow on Ubuntu 20.04 — 2022