Take the 2-minute tour ×
Video Production Stack Exchange is a question and answer site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation. It's 100% free, no registration required.

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 to 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

share|improve this question
1  
A mediainfo output of one of those file would be helpful. mediaarea.net/en/MediaInfo –  Professor Sparkles Jul 17 at 16:27

2 Answers 2

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. It's an easy to use tool for h264 encoding that lets you choose to convert your video to a constant frame rate.

share|improve this answer
    
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 Jul 29 at 7:34
    
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. –  Professor Sparkles Jul 29 at 13:15

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.

share|improve this answer
    
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 Jul 23 at 16:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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