[FFmpeg-devel] Timestamp issues in live RTP->mpegts bridges

Luca Abeni lucabe72
Mon Jan 19 17:24:10 CET 2009

Hi Alexandre,

Alexandre Ferrieux wrote:
> Hi,
> Thanks to your help guys, I'm now receiving live H263/RTP flow from a 
> mobile phone and the result can be converted to whatever output codec 
> and encapsulation is wanted. Fine !

Ok; good to know that the original problem is solved ;-)

> Now, I still have a small issue with the timing of the produced output:
> If I instruct to transcode to mpeg2video encapsulated in mpegts, and 
> save this to a flat ".ts" file, then when playing back the file (with 
> mplayer or ffplay) I see it is playing at 30fps, regardless of the input 
> fps which is 15fps.

Are you using the ffmpeg program or your own code? In the first case,
can you post the output of ffmpeg? In the second case, how are you
initialising the decoder and the encoder, and the TS muxer?
(can you do "dump_format" on the input and on the output and post the

Also, the TS muxer has some problems... You should probably try an MPEG
PS, or some other format, to check if results are better.

> Question: how are the input RTP stamps supposed to reach the other end ?

You should be able to see the RTP timestamp in the pts field of the AVPacket.
Note that this is expressed in AVStream.time_base units (which is 1/90000
for H.263, I think).

> I'm ready to add some code to rtpdec.c or to my H263-specific dynamic 
> depayloader, but I just need a bit of guidance.

I think the rtpdec.c code already reads the timestamps in the correct way
(and I do not think timestamps need to be handled in a payload-specific way).
Just ensure that after your H.263 modifications finalize_packet() is still


More information about the ffmpeg-devel mailing list