<p>Your video looks to be variable frame rate, and its maximum frame rate looks to be fairly high. Which is what ffmpeg will use as target frame rate in constant frame rate mode for the output.</p>
<p>To keep 1:1 correspondence between input and output frames, add <code>-fps_mode passthrough</code>. For ffmpeg versions older than 5.1, add <code>-vsync passthrough</code>.</p>

CC BY-SA 4.0
2023-04-28T09:51:23.317Z
thanks a lot, it works! I also found some other ways to do it (see https://superuser.com/questions/1781258/avoid-duplicate-frames-in-ffmpeg). However my original question remains,  is there a reliable way to know how many frames I should expect when exporting my video in a lossless file format? I export to 2246 frames, and I have no idea where that number comes from.
terauser
CC BY-SA 4.0
2023-04-28T03:45:32.747Z
2023-04-28T03:45:32.747Z
Gyan
<p>Newbie here. This is my input.mp4 video, according to VLC:</p>
<ul>
<li><code>codec</code>:  H265 – MPEG-4 AVC (part 10) (avc1)</li>
<li><code>Encoder</code>:    Lavf58.29.100</li>
<li><code>FPS</code>:    70.476432</li>
<li><code>Resolution</code>: 1824 x 1216</li>
<li><code>Duration</code>:   0m31s</li>
</ul>
<p>I need to convert the video into a sequence of images. <strong>Is it possible to predict given the information above, how many frames I will get?</strong></p>
<p>I tried two methods:</p>
<ol>
<li>Using OpenCV (basically with the command <code>cv2.imwrite(name, frame, [cv2.IMWRITE_TIFF_COMPRESSION, 1])</code>)</li>
<li>Using ffmpeg (<code>ffmpeg -i input.mp4 $filename%05d.tiff</code>)</li>
</ol>
<p>With OpenCV I get 2246 TIFF files (~14 GB). With ffmpeg I get more than 17k TIFF files but I had to stop the operation (see below) when it had already generated ~49GB of files.</p>
<p>You can tell that I am not an expert in this since initially I thought that my conversion should be 2185 TIFF files (from 2185 frames, i.e. <code>FPS</code> times <code>Duration</code>). But then I read another <a href="https://video.stackexchange.com/questions/25981/how-to-extract-the-real-frames-without-rely-on-fps">post and changed my expectation</a>.</p>
<p>Anyway, is there a reliable way to know how many frames I should expect when exporting my video in a lossless file format?</p>
<hr />
<p>Detail about ffmpeg: I had to stop the operation because it was taking forever and finding lots of duplicates (I don't know why, will make a separate post). Last lines shown in the operation were as follow:</p>
<pre><code>More than 1000 frames duplicatedN/A time=00:00:01.04 bitrate=N/A dup=976 drop=0 speed=0.0308x                                                                                                
More than 10000 frames duplicated/A time=00:00:10.74 bitrate=N/A dup=9989 drop=0 speed=0.0265x                                                                                               
frame=17673 fps= 26 q=-0.0 Lsize=N/A time=00:00:17.67 bitrate=N/A dup=16428 drop=0 speed=0.0262x 
</code></pre>

<ffmpeg><framerate><export><lossless>
frame rate vs extracted frames
terauser
# frame rate vs extracted frames

(Asked by: username_0 on 2023-04-27)

Newbie here. This is my input.mp4 video, according to VLC:

codec:  H265 – MPEG-4 AVC (part 10) (avc1)
Encoder:    Lavf58.29.100
FPS:    70.476432
Resolution: 1824 x 1216
Duration:   0m31s

I need to convert the video into a sequence of images. Is it possible to predict given the information above, how many frames I will get?
I tried two methods:

Using OpenCV (basically with the command cv2.imwrite(name, frame, [cv2.IMWRITE_TIFF_COMPRESSION, 1]))
Using ffmpeg (ffmpeg -i input.mp4 $filename%05d.tiff)

With OpenCV I get 2246 TIFF files (~14 GB). With ffmpeg I get more than 17k TIFF files but I had to stop the operation (see below) when it had already generated ~49GB of files.
You can tell that I am not an expert in this since initially I thought that my conversion should be 2185 TIFF files (from 2185 frames, i.e. FPS times Duration). But then I read another post and changed my expectation.
Anyway, is there a reliable way to know how many frames I should expect when exporting my video in a lossless file format?

Detail about ffmpeg: I had to stop the operation because it was taking forever and finding lots of duplicates (I don't know why, will make a separate post). Last lines shown in the operation were as follow:
More than 1000 frames duplicatedN/A time=00:00:01.04 bitrate=N/A dup=976 drop=0 speed=0.0308x                                                                                                
More than 10000 frames duplicated/A time=00:00:10.74 bitrate=N/A dup=9989 drop=0 speed=0.0265x                                                                                               
frame=17673 fps= 26 q=-0.0 Lsize=N/A time=00:00:17.67 bitrate=N/A dup=16428 drop=0 speed=0.0262x

**Tags:** ffmpeg, framerate, export, lossless


---

## 1 answers

### Answer by username_1 on 2023-04-28. Score: 1

Your video looks to be variable frame rate, and its maximum frame rate looks to be fairly high. Which is what ffmpeg will use as target frame rate in constant frame rate mode for the output.

To keep 1:1 correspondence between input and output frames, add `-fps_mode passthrough`. For ffmpeg versions older than 5.1, add `-vsync passthrough`.

> **Comments:**
> **username_0**: thanks a lot, it works! I also found some other ways to do it (see https://superuser.com/questions/1781258/avoid-duplicate-frames-in-ffmpeg). However my original question remains,  is there a reliable way to know how many frames I should expect when exporting my video in a lossless file format? I export to 2246 frames, and I have no idea where that number comes from.  

---

