[FFmpeg-user] Saving h264 RTP stream into an mp4 container

Alexander Agranovsky alex at sighthound.com
Thu Jan 5 06:37:46 EET 2017


I'm trying to save incoming RTP stream into an MP4 container -- without 
transcoding it. For the most part, it works well, except two problems.

First problem is mostly cosmetic: at the start of every file there's a 
warning logged:
"Timestamps are unset in a packet for stream ...".
I don't see how it is possible to set both PTS and DTS, given only RTP 

The second problem is related, but is functional rather than cosmetic: 
if the RTP stream contains B-frames, whenever timestamp order decreases 
-- which is normal for that stream -- the packet fails to be written, 
with an error of "Application provided invalid, non monotonically 
increasing dts to muxer ..."

So, the question is -- what is the correct way to assign timestamps when 
muxing raw h264 frames?

More information about the ffmpeg-user mailing list