FFmpeg Logo new.svg

FFmpeg's logo.


Although for these times it seems archaic to continue using commands, it is the only interface that this program has, unfortunately.

There are times when extracting frames from a video with its highest quality (*.png format) using the VLC media player is tedious, and more so if there are several consecutive frames (the ones needed to select the best frame or create an animated gif with these).

To facilitate the work of extracting all the frames of a video in an accurate way, FFmpeg is used.

The process of knowing how to manipulate is going to be a bit of a pain in the beginning, but once learned (through practice), you will have the great satisfaction of having one of the best programs to extract frames from videos.

NOTE: FFmpeg is a program that uses only commands. You do not need deep knowledge of computer science, since this tutorial will explain in a detailed and simple way how to use this program.

Download (modified version)

I recommend downloading the Kyle Schwarz's modified version, which can be used directly (this is the 64-bit version of Windows) and it doesn't need be installed:


NOTE: The version to be used during this tutorial is 3.1.4, which is the version that has the program modified and uploaded to MEGA.

Prepare a video to extract its frames

Ffmpeg tutorial 01
  • Within the folder where the FFmpeg files are hosted, there is a folder called bin, there you must host a copy of the video whose frames you want to extract.
  • Rename the video by a shorter and simpler name.
    • For example, if your video is called "Dogs dancing with Cats (5).mkv", rename it by "ddwc5.mkv", using only lowercase letters and numbers (avoid using spaces or other non-alphanumeric symbols).
  • Do not forget to keep its original format. If the video is *.mkv format, do not change forciblyit to *.avi or *.mp4.

Identify video parameters


Frame rate

Here you have to use the VLC media player:

  • NOTE 1: In the vast majority of cases, the frame rate is constant.
  • NOTE 2: Usually animés have 24 fps (frames per second).

Time interval (measured in seconds)

I do not recommend that you extract all the frames of a video, and worse if the video lasts more than 5 minutes. You must only extract them from the interval of time where the giantess or para-giantess has participated.

For example, the gallery of Pokémon - EP0022 was obtained with FFmpeg, and thanks to it also have been elaborated gifs. Let's look at its case:

  • Initial moment: 14m04s
  • Final moment: 17m21s

But these parameters must be expressed in seconds. In case you have problems converting them to seconds, just use this simple equation:

Total seconds = 3600*Hours + 60*Minutes + Seconds

For example, if during a long movie the GTS scene is given at 2:11:13 (or 2h11m13s), that value expressed in seconds will be:

Sec = 3600*2 + 60*11 + 13
Sec = 7200 + 660 + 13
Sec = 7873

In the case of Pokémon - EP0022, its initial and final moment will be expressed in seconds:

  • Initial moment: 14m04s
    • Since there are no hours, then it is automatically considered "0", or this variable is simply ignored.
    • Sec = 60*14+4 = 840+4 = 844
    • Initial moment (in seconds): 844
  • Final moment: 17m21s
    • Sec = 60*17+21 = 1020+21 = 1041
    • Final moment (in seconds): 1041

In conclusion:

  • Initial moment (in seconds): 844
  • Final moment (in seconds): 1041

Start the extraction process

Once you have done all the above, you should open the file ff-prompt.bat, which is when you enter the FFmpeg folder:

Ffmpeg tutorial 07

Do not be afraid of the command window, as here will explain what to do next.

Let's take the example of Pokémon - EP0022, with its parameters already identified:

  • The file was called "Pokémon 22.mp4", but it was renamed as "pkmn22.mp4", then a copy of it was hosted in the folder "bin" of FFmpeg.
  • Format: mp4
  • Frame rate: 24 (exactly)
    • Animated series based on drawings always have 24 frames per second, but European ones have 25 (a minimum difference). If you see that an animated video based on drawings has more than 25 (sometimes they can reach 30), then the video has unnecessary extra frames and you will have to use yes or yes 24 fps.
  • Initial moment (in seconds): 844
  • Final moment (in seconds): 1041

Now we have to transfer these parameters to ff-prompt.bat (the command window), using the following expression:

ffmpeg -i video.avi -pix_fmt bgr24 -r ?? -ss ?? -to ?? frame%d.png

Where each command means the following:

  • -i: "input", is the video file name that will be tested.
  • -pix_fmt: "pixel format", it prevents that the image from having unnecessarily high weight, that is why bgr24 (the most appropriate) is used.
  • -r: "rate", is the frame rate per second.
  • -ss: "start second", is the initial second number.
  • -to: "to" (until), is the final second number.
  • The last parameter is called "frame%d.png", which will be the name of the extracted frames. Do not forget to put "%d" at the end of the frame name and the "*.png" format!

For the case of Pokémon - EP0022, you must write:

ffmpeg -i pkmn22.mp4 -pix_fmt bgr24 -r 24 -ss 844 -to 1041 sabrina%d.png
Ffmpeg tutorial 08

Press the "Enter (or Intro)" key and wait, as this process takes time. When the extraction process has finished, you should give the following:

Ffmpeg tutorial 09

Go to the folder "bin" of FFmpeg, and you will notice that there are many images. In our case, we will have 4731 files, of which: 4728 are the extracted images, 1 is the video file (which you must delete if you are not going to extract more images) and the other 2 are the executable files that no reason to delete.

I recommend that you send these images to a new folder, in order to have more organization.

And this ends the tutorial. Now it is your duty to discriminate which images are the ones that deserve to be preserved for publication on the wiki. However, you should not ignore the following warnings:


Predict the number of extracted images

Here is a simple arithmetic calculation, given by the following formula:

Images = R*(Mf-M0)


  • R = Frame rate per second
  • M0 = Initial moment (in seconds)
  • Mf = Final moment (in seconds)

In the example we made of Pokémon - EP0022, the amount of images, in theory, should be:

Images = 24*(1041-844)
Images = 24*(197)
Images = 4728

And what is predicted fits in with what has been achieved in practice!

However, you must take into account that in itself, 4728 are many. In addition, that huge amount was obtained from only a range of 197 seconds (3 minutes and 17 seconds).

Now imagine that you are going to work with a movie that has 60 frames per second and that lasts 1 hour, do you know how many images you are going to get? 216 thousand images!

Images = 60*(3600-0)
Images = 216000

That is why it is recommended to identify the time intervals where the GTS scenes are given, and then not be working with thousands of images that may not have GTS scenes.

You should have plenty of free space on your hard drive

Now that we know how to predict the number of images, we can also predict the disk size we will need. Simply multiply the number of predicted images with the size of a sample image (extracted from VLC, to make it faster).

In our example of Pokémon - EP0022, an extracted image weighs around 420 kb (round it to 512 kb by precaution). Then, we can predict (in the worst case) how much space on the hard drive we will have to use:

Space = 4728*(512 kilobytes)
Space = 2420736 kilobytes
Space = 2364 megabytes
Space = 2,31 gigabytes

However, in practice it reached 1.32 gigabytes (almost 1 gigabyte difference). It is worth speculating with the worst case (images heavier than normal), because this way we can have space on the spare hard disk (and avoid saturation).

Now let's see an extreme case, where you have a movie with 60 frames per second, which lasts 1 hour and has 1920x1080 resolution (this resolution is the famous "Full HD"). By sampling, an image weighs 2.87 megabytes (we round it to 3 megabytes). Therefore, in the worst case:

Space = 216000*(3 megabytes)
Space = 648000 megabytes
Space = 633 gigabytes

633 gigabytes! Do you have so much free space on your hard drive? You would need a 1 terabyte (or more) disk to work with.

That is why it has been warned that you should identify the intervals where the GTS scenes are, so you only extract what is necessary and do not saturate your hard disk.

Never forget to write "-pix_fmt bgr24"

If you do not, the extracted images will have a ridiculously high weight. See the following examples of the same image:

Additional information and curiosities

  • If your video has *.mkv format with deactivatable subtitles, then the extracted frames will not have the subtitles (that's good).

In which cases does FFmpeg not work?

Damaged files

At the moment, it has only been possible to see that it fails with damaged or poorly downloaded or half-downloaded files: it simply does not work. In this case, there will be no other than extracting the frames manually with VLC.

  • In my case, I have several damaged files of Mirmo Zibang!, so I had no other than to use VLC. Even this GIF I created using the extracted frames from VLC (it was more laborious):
Mirmo 85

Videos not "ripped"

Sometimes the videos are not exposed as explicitly as they are in *.mkv, *.mp4, or *.avi formats.

In DVD or Blu-Ray, the videos are in the VOB format (heavy and complicated to handle). So, if you do not know how to "rip" these videos, better manually extract the frames with VLC.

  • In my personal experience, the Teen Titans - SE5-EP01-EP02's gallery was obtained from a DVD, which did not allow me to use FFmpeg. The images I had to extract with VLC and still I could elaborate the following GIFs:

For more information

See also