How can we sync audio and video in RTP:
-----------------------------------------
1.Receive RTP video and RTP audio in a separate filter
we will get RTCP packets for N number of RTP packets constantly;
For RTP video, we will get RTCP NTP timestamp and RTP timestamp; and at the same time, we will get the RTP packet and
Extract it Timestamp;
NTP - is network time; it is used as a reference clock;
NTP is common to audio and video; we are adjusting avideo based on NTP and adjusting audio based on NTP; So it makes them be in sync;
Do the calculation as follows:
Video Timestamp = (RTP Timestamp of RTCP video packet / NTP timestamp of RTCP video packet) * RTP video Packet's RTP timestamp;
Audio Timestamp = (RTP Timestamp of RTCP Audio packet / NTP timestamp of RTCP Audio packet) * RTP audio Packet's RTP timestamp;
RTCP is sent +1 port of the RTP;
RTP Video Port number = 5000;
RTCP video Port number = RTP Video Port number + 1; ( 5001)
RTP audio Port number = 6000;
RTCP audio Port number = RTP audio Port number + 1; ( 6001 )
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment