I noticed if I extract frames with this command:

ffmpeg -i sample_nosound.mp4 $filename%03d.jpg

It will extract depends on fps by default. ffmpeg -i shows this video has 6 fps, so it extracted 1630 jpg frame files, which 1630/6 = 271.6 seconds equivalent to the 4:32 total video duration.

But 1630 jpg frames total size is 13 MB:

$ du -h extracted_jpg_folder
13M      extracted_jpg_folder

, while the file size of the mp4 is 1.8 MB, far lower than the total frames size:

$ ls -la sample_nosound.mp4
-rw-rw-r-- 1 xiaobai xiaobai 1814889 Feb  13 15:42 'sample_nosound.mp4'

That means ffmpeg extract frames by referring fps info.

Therefore my question is, how to make ffmpeg extract frames by "real frames" without rely on fps ?

I expect I can get total frames size which almost equivalent with the mp4 files size.

I don't expect exact match file size, since mp4 may contains some metadata.

  • 2
    Video in MP4 typically uses interframe compression, so your expectation is mistaken.
    – Gyan
    Feb 14, 2019 at 16:05

1 Answer 1


You don't quite understand how this works. h.264 doesn't save single images, but much rather one image, than f.e. 4 estimations what should come after.

For example: Imagine a ball rolling from left to right, you could noe either store 30 frames of the ball rolling, or you store 1 frame of the ball in the beginning and one in the end, and when you play the video, just take the first image, and copy the ball a bit to the right.

This means, that I Frame compression can be smaller, than single frames.

  • Yes, now I understand why download some streaming in half way is not possible to recover without original image.
    – 林果皞
    Feb 14, 2019 at 18:50
  • @林果皞 Well; if I understand you correctly, Interframes aren't the problem with this. You don't just have one "Main" frame and the rest are generated. It's more like One "Mainframe" and then 4 generated ones. Not being able to download just the half is another problem Feb 14, 2019 at 20:34
  • I think I already understand with Intra-frames info in this answer unix.stackexchange.com/a/500672/64403 , but I get confuse after read your comment about "Mainframe" and "Main" frame.
    – 林果皞
    Feb 15, 2019 at 9:05
  • "Mainframe" and "Main" Frame are the same, my bad. Feb 16, 2019 at 2:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.