Tuesday, May 8, 2012

RTP - RTP Timestamp

RTP timestamp is generally telling you the number of media samples in that packets per media unit (fps or ms)

For MPEG video is, it is generally calculated by

clock rate / fps 

That is if the clock rate for video is 90000 Hz for 30fps

90000 / 30 = 3000 sample per frame

In general, audio is

(clock rate / 1000) * duration of audio

for example a G.711 audio with 8000Hz clock rate and your packet has audio of 30ms duration

Then it will be (8000 / 1000) * 30 = 240 samples in 30 ms

This work because G.711 is a 8 bytes per sample codec with 8000 samples per seconds.

For AAC, it is a bit different. It will come in either 1024 or 960 samples per rtp packet.


  1. If i intend to do the lip-sync, i think RTP time stamp will not be of much usage. Is there any way where i can use the RTP or RTCP time stamps in order to have the lip-sync and also find out the lip-sync error. I know the question is not directly related to blog post but still i think if you can give any sort on this, that will be very helpful.

  2. Yes, you have to RTCP time to calculate the lip sync for audio and video. But it is really out of this post. I will try to write something related to lip sync with RTCP soon. Stay tune

  3. Hi Thompson,

    In most of RFC its mentioned that for mpeg-4 video clockrate is 90000Hz as standard!!
    Is 90kHz is the sampling rate of video processing ?
    Why 90kHz is chosen?

    Thanks in Advance,