<p>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.</p>

<p>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.</p>

<p>This means, that I Frame compression can be smaller, than single frames.</p>

CC BY-SA 4.0
2019-02-14T18:50:52.010Z
Yes, now I understand why download some streaming in half way is not possible to recover without original image.
林果皞
CC BY-SA 4.0
2019-02-14T20:34:13.833Z
@林果皞 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
Timothy Lukas H.
CC BY-SA 4.0
2019-02-15T09:05:18.817Z
I think I already understand with `Intra-frames` info in this answer https://unix.stackexchange.com/a/500672/64403 ,  but I get confuse after read your comment about "Mainframe" and "Main" frame.
林果皞
CC BY-SA 4.0
2019-02-16T02:10:21.360Z
"Mainframe" and "Main" Frame are the same, my bad.
Timothy Lukas H.
CC BY-SA 4.0
2019-02-14T18:38:52.727Z
2019-02-14T18:38:52.727Z
Timothy Lukas H.
<p>I noticed if I extract frames with this command:</p>

<pre><code>ffmpeg -i sample_nosound.mp4 $filename%03d.jpg
</code></pre>

<p>It will extract depends on fps by default. <code>ffmpeg -i</code> 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.</p>

<p>But 1630 jpg frames total size is 13 MB:</p>

<pre><code>$ du -h extracted_jpg_folder
13M      extracted_jpg_folder
</code></pre>

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

<pre><code>$ ls -la sample_nosound.mp4
-rw-rw-r-- 1 xiaobai xiaobai 1814889 Feb  13 15:42 'sample_nosound.mp4'
</code></pre>

<p>That means ffmpeg extract frames by referring fps info.</p>

<p>Therefore my question is, <strong>how to make ffmpeg extract frames by "real frames" without rely on fps ?</strong> </p>

<p>I expect I can get total frames size which almost equivalent with the mp4 files size.  </p>

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

CC BY-SA 4.0
2019-02-14T16:05:57.150Z
Video in MP4 typically uses [interframe](http://www.canon.com.hk/cpx/en/technical/va_EOS_Movie_Compression_Options_All_I_and_IPB.html) compression, so your expectation is mistaken.
Gyan
<ffmpeg>
How to extract the "real frames" without rely on fps?
林果皞
# How to extract the "real frames" without rely on fps?

(Asked by: username_0 on 2019-02-14)

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.

**Tags:** ffmpeg

> **Comments:**
> **username_1**: Video in MP4 typically uses [interframe](http://www.canon.com.hk/cpx/en/technical/va_EOS_Movie_Compression_Options_All_I_and_IPB.html) compression, so your expectation is mistaken.  

---

## 1 answers

### Answer by username_2 on 2019-02-14. Score: 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.

> **Comments:**
> **username_0**: Yes, now I understand why download some streaming in half way is not possible to recover without original image.  
> **username_2**: @username_0 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  
> **username_0**: I think I already understand with `Intra-frames` info in this answer https://unix.stackexchange.com/a/500672/64403 ,  but I get confuse after read your comment about "Mainframe" and "Main" frame.  
> **username_2**: "Mainframe" and "Main" Frame are the same, my bad.  

---

