Subject: Re: Re: Re: [AVT] RTP timestamp calculation for MPEG1 Video and Audio ESsothat itworks with RTSP client like RealOne/QuickTime

From: "Neo Anderson" <[email-masked]>
Date: Wed, 27 Aug 2003 18:42:16 +0530

>>...Which is usually 33 bits, that too is mystery to me as
>>the RTP timestamp is 32 bits. 

First, I am not able to relate the 33 bits you have mentioned to any 
timestamp at all (kindly enlighten with reference)!
and you might have to buy ISO/IEC 11172-2 for reference if u need 
to... 

TS calc in a nutshell:
If u are streaming from a stored file:

Else, some public source decoder will help to get how to extract the 
temporal_reference and the picture_rate/frame_rate_code fields from 
the MPEG-1 ES. From these two parameters, timestamp can be calculated.

When u have the encoder running live at the constant frame rate, the 
timestamp to be carried MAY be directly given by the encoder or we 
can sample the system clock (gettimeofday() etc.) for the RTP 
timestamp (which implies PTS will be sent in the RTP packet) at the 
instant when the frame is generated.

For Audio,
If it is constant bitrate (which I presume will be in most cases of 
streaming), then you will have to increment the timestamp based on 
the samples per frame. RTP timestamp will be the timestamp for the 
first audio frame in the RTP packet (it is most likely that multiple 
audio frames are carried in the RTP packet). convert this into the 
resolution as required by rfc2250 (90kHz). Also check out the RTP FAQ 
on this.
Example: 
Sampling Rate = Fs Hz
Calculated Samples per frame = x
Timestamp in 90kHz units = ((x/Fs) * 90000)

For variable bit rate audio,
Calculate the number of samples per frame for each individual audio 
frame. Based on the sampling frequency, calculate the timestamp which 
is to be sent for each frame and use the timestamp of the first audio 
frame in the rtp packet.

To calculate the number of samples, you will find lot of info on the 
web for the MPEG1 audio frame structure and related formula. 
http://www.wotsit.org is one of them. Check for mp3 frame format for 
audio.

>>You guys are my last hope on this, the helix guys have redirected me
>>to this forum.
Hopefully now...

--Neo
Get your own Free E-mail at Witch Wisdom http://www.witchwisdom.com
__________________
http://www.zzn.com

_______________________________________________
Audio/Video Transport Working Group
[email-masked]
https://www1.ietf.org/mailman/listinfo/avt