Question

I coded an application to receive RTP packets via TCP (no packets are lost) from a hardware camera and dump its H264 packets to a file so I could play the video using MPlayer or VLC. This is already working and I pretty much did the steps described here. The commands to play the video are mplayer -fps 24 -demuxer h264es foobar.h264 and vlc foobar.h264.

The issue is now when I play the video. The camera changes the FPS frequently and because I drop the RTP info when writing the H264 file, the timestamp of each frame is lost. My question is: what do I have to do to fix the frame frequency? Should I create empty/blank P-frames (if that is possible)? If so, how would I do it?

Any solution using Linux compatible tools or libraries (like ffmpeg, libx264, libavcodec) using shell, C/C++ or Python is very much welcome.

PS: I have almost no experience with video encoding and RTP.

Was it helpful?

Solution

There is no timing information in a raw h.264 stream. The stream needs to be put into a container such as MP4 or FLV where you can tag each frame with a PTS/DTS.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top