<p>Are you sure the files your recorded have indeed a variable framerate? It sounds like you recorded with a constant framerate (even though you get a variable frame rate video feed) which introduced this "artifact" and the players then of course play it back with a constant frame rate even though they shouldn't.</p>

<p>To properly convert variable frame rate footage into constant frame rate footage you can reside to <a href="http://handbrake.fr/downloads.php" rel="nofollow">Handbrake</a>. It's an easy to use tool for h264 encoding that lets you choose to convert your video to a constant frame rate.</p>

CC BY-SA 3.0
2014-07-29T07:34:11.270Z
Yes we can convert the video with a tool to a constant framerate. But if the frame rate is variable the video will be played sometimes too slow and sometimes too fast or not?
Gatschet
CC BY-SA 3.0
2014-07-29T13:15:10.887Z
The encoder should account for that, variable framerate doesn't mean that you will heavy drops in the frame rate, its usually always around a certain values +-2 fps.
timonsku
CC BY-SA 3.0
2014-07-17T16:01:08.467Z
2014-07-17T16:35:38.407Z
2014-07-17T16:35:38.407Z
timonsku
<p>I recently ran into this issue...my transcoded-into-H264 videos started coming
out with VARIABLE frame-rates, whereas in the past, they had come out as fixed
framerate.</p>

<p>I use VLC-cmdline to do my final transcodes (because VLC supports features that
HandBrake and others don't...such as marquee-text and font-color control, etc.</p>

<p>When I recently googled this issue, I noticed that wikipedia, and a few other
comments on variable frame-rate mention that 'container-type' can make a difference on whether fixed or variable frames get generated. (That puzzled me...I never would have guessed that.)</p>

<p>But, sure enough !  In my VLC cmd-line, I changed my 'mux' from MP4 to MKV
and voila.  'Mediainfo' checker shows clearly that I was getting variable
when using MP4-container, and fixed frames with MKV.</p>

<p>[Great...I'd been planning to switch to MKV output files anyway, and this
provided me with a great reason to do so! Be aware -- version 1.x and early VLC supported only MP4-containers, but v2.x now DOES also support MKV.]</p>

<p>Hope this helps others. </p>

CC BY-SA 3.0
2016-01-09T21:05:43.180Z
2016-01-09T21:05:43.180Z
David Cook
<p><strong>Transcode Your Video First</strong>
You need to transcode your video first using a "real" encoder like Apple Compressor or Adobe Media Encoder.</p>

<p>Quicktime
MP4
29.97 or 30 frames per second</p>

<p>Make sure you use a standard resolution like 640x360,720x405,1280x720,1920x1080 or 640x360 for standard def 4x3.</p>

<p>You could also try using HandBrake, it may very well do the trick for you and be a lot easier.</p>

CC BY-SA 3.0
2014-07-23T16:11:33.053Z
640x360 is not the standard SD 4:3 ratio.  640x480, or preferably 720x480 with .9 pixel ratio is the 4:3 ratio.  640x360 is a 16:9 ratio.
AJ Henderson
CC BY-SA 3.0
2014-07-23T07:41:51.500Z
2014-07-23T07:41:51.500Z
mchev
<p>We are using a <a href="http://www.moxa.com/product/VPort_P06-1MP-M12.htm" rel="nofollow noreferrer">streaming camera</a> to record and to play back surveillance video. </p>

<p>This camera sends a RTSP stream which will be recorded by our application as a H264 video.</p>

<p>In our application, the H264 videos will be stored in a MP4 container and will be published on a HTTP-server (Apache2). The stored videos can now be watched with any HTML5 web browser. So far, so good! </p>

<p>Our problem is, that the camera sends his frames with a variable frame rate. This is not a problem as long we watch the stream live. But when we watch the recorded H264/MP4 videos the time begins to drift. This means because of the variable frame rate, sometimes the video will be played too fast and the time is not correct!</p>

<p>So, does someone have experience with H264 videos with variable frame rate (VFR)? How can we play these VFR videos without time drift? Is it possible to convert VFR video to video with constant frame rate?</p>

<p>(All tested players like VLC seems to have the same problem...)</p>

<p>Here the output of mediainfo:</p>

<pre><code>Complete name                            : VIDEO_REPLICA_12.h264
Format                                   : AVC
Format/Info                              : Advanced Video Codec
File size                                : 249 MiB
Overall bit rate mode                    : Variable

Video
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.2
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 1 frame
Format settings, GOP                     : M=1, N=15
Bit rate mode                            : Variable
Maximum bit rate                         : 20.0 Mbps
Width                                    : 1 280 pixels
Height                                   : 800 pixels
Display aspect ratio                     : 1.600
Frame rate mode                          : Variable
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
</code></pre>

CC BY-SA 3.0
2014-07-17T16:27:13.700Z
A mediainfo output of one of those file would be helpful.
http://mediaarea.net/en/MediaInfo
timonsku
<video><framerate>
Recording and playing video with variable frame rate
Gatschet
# Recording and playing video with variable frame rate

(Asked by: username_0 on 2014-07-17)

We are using a streaming camera to record and to play back surveillance video. 
This camera sends a RTSP stream which will be recorded by our application as a H264 video.
In our application, the H264 videos will be stored in a MP4 container and will be published on a HTTP-server (Apache2). The stored videos can now be watched with any HTML5 web browser. So far, so good! 
Our problem is, that the camera sends his frames with a variable frame rate. This is not a problem as long we watch the stream live. But when we watch the recorded H264/MP4 videos the time begins to drift. This means because of the variable frame rate, sometimes the video will be played too fast and the time is not correct!
So, does someone have experience with H264 videos with variable frame rate (VFR)? How can we play these VFR videos without time drift? Is it possible to convert VFR video to video with constant frame rate?
(All tested players like VLC seems to have the same problem...)
Here the output of mediainfo:
Complete name                            : VIDEO_REPLICA_12.h264
Format                                   : AVC
Format/Info                              : Advanced Video Codec
File size                                : 249 MiB
Overall bit rate mode                    : Variable

Video
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.2
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 1 frame
Format settings, GOP                     : M=1, N=15
Bit rate mode                            : Variable
Maximum bit rate                         : 20.0 Mbps
Width                                    : 1 280 pixels
Height                                   : 800 pixels
Display aspect ratio                     : 1.600
Frame rate mode                          : Variable
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive

**Tags:** video, framerate

> **Comments:**
> **username_1**: A mediainfo output of one of those file would be helpful. http://mediaarea.net/en/MediaInfo  

---

## 3 answers

### Answer by username_1 on 2014-07-17. Score: 4

Are you sure the files your recorded have indeed a variable framerate? It sounds like you recorded with a constant framerate (even though you get a variable frame rate video feed) which introduced this "artifact" and the players then of course play it back with a constant frame rate even though they shouldn't.

To properly convert variable frame rate footage into constant frame rate footage you can reside to [Handbrake](http://handbrake.fr/downloads.php). It's an easy to use tool for h264 encoding that lets you choose to convert your video to a constant frame rate.

> **Comments:**
> **username_0**: Yes we can convert the video with a tool to a constant framerate. But if the frame rate is variable the video will be played sometimes too slow and sometimes too fast or not?  
> **username_1**: The encoder should account for that, variable framerate doesn't mean that you will heavy drops in the frame rate, its usually always around a certain values +-2 fps.  

---

### Answer by username_2 on 2016-01-09. Score: 3

I recently ran into this issue...my transcoded-into-H264 videos started coming
out with VARIABLE frame-rates, whereas in the past, they had come out as fixed
framerate.

I use VLC-cmdline to do my final transcodes (because VLC supports features that
HandBrake and others don't...such as marquee-text and font-color control, etc.

When I recently googled this issue, I noticed that wikipedia, and a few other
comments on variable frame-rate mention that 'container-type' can make a difference on whether fixed or variable frames get generated. (That puzzled me...I never would have guessed that.)

But, sure enough ! In my VLC cmd-line, I changed my 'mux' from MP4 to MKV
and voila. 'Mediainfo' checker shows clearly that I was getting variable
when using MP4-container, and fixed frames with MKV.

[Great...I'd been planning to switch to MKV output files anyway, and this
provided me with a great reason to do so! Be aware -- version 1.x and early VLC supported only MP4-containers, but v2.x now DOES also support MKV.]

Hope this helps others.


---

### Answer by username_3 on 2014-07-23. Score: -2

**Transcode Your Video First**
You need to transcode your video first using a "real" encoder like Apple Compressor or Adobe Media Encoder.

Quicktime
MP4
29.97 or 30 frames per second

Make sure you use a standard resolution like 640x360,720x405,1280x720,1920x1080 or 640x360 for standard def 4x3.

You could also try using HandBrake, it may very well do the trick for you and be a lot easier.

> **Comments:**
> **username_4**: 640x360 is not the standard SD 4:3 ratio.  640x480, or preferably 720x480 with .9 pixel ratio is the 4:3 ratio.  640x360 is a 16:9 ratio.  

---

