[Live-devel] Re: Audio Video Synchronization-some queries

shobana meenakshi vshobs at yahoo.com
Thu Sep 1 09:17:22 PDT 2005


Hi all
 
As I am new to implementing RTSP/RTCP protocol, I thought I would seek help from this mailing list.

I would like to explain my understanding here with respect to audio video synchronization after PAUSE/RESUME and during seek.Request you to correct me if Iam wrong.There are ideally 2 ways the streaming server gives the client,synchronization information for audio and video.

1. RTSP PLAY Response
If RTSP is used as the control channel, after an RTSP PAUSE and PLAY the server sends a play response before sending the first packet after resume in which it tells the RTP time stamp for both audio and video which would be in synch.
Ideally the implementation on the Client for the audio video synchronization would be , after getting the first packet after resume calculate the offset for the first packet's RTP timestamp from the reference RTPtimestamp  got from the PLay response in both the audio and video threads seperately and increment the presentation time by that offset(after dividing it by the RTp timestamp frequency say 44100 for audio) so that they would be in synch.
Am I right in this understanding?
Now given this understanding is right, we won't need the wallclock synchronization at all as the RTP timestamp is purely based on the number of samples sent in the packet in which case we won't need the RTCP implementation at all.
What am I missing here?
 
2.RTCP sender report
The RTP sender report sends the NTP timestamp which would be synchronized for both server and client and for both audio and video and an RTP timestamp associated with it.Ideally after pause and resume after we get the RTCP sender report, we take the RTP timesatamp sent in the RTCP sender report use that as a reference calculate the offset of the first audio and video packets after resume from the reference RTP timestamp and calculate the presentation time in the same way as explained above.

If this is correct what I don't understand is 
 
1.How is the NTP time associated with the RTP timestamp if RTp timestamp is purely based on the sample count in the packet?
 
In general I have the following queries regarding how the server sends the RTP time stamp in the play response as well as in the RTCP sender report.
 
1.Suppose the RTPtimestamp for audio=12345 and RTP Timestamp for Video=123456 at the point they were paused.
After Resume the first audio and video packet should have an RTP timestamp of say audio=12360 and video=123486 ideally if we assume that the packets sent has 15 audio samples and 30 video samples respectively.Is my understanding right or is the duration of PAUSE has to do anything with the RTPtimestamps(in the sense would the server calculate the RTPtimestamp of the first packet based on what it would have been if we did not pause at all based on the wall clocktime?)
 
It would be really helpful if anyone could validate or clarify my understanding.Though this is slightly out of topic I think it would be really useful for those who are new to this.
 
Thanks and Regards
Shobana V
 


live-devel-request at ns.live.com wrote:
Send live-devel mailing list submissions to
live-devel at lists.live.com

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.live.com/mailman/listinfo/live-devel
or, via email, send a message with subject or body 'help' to
live-devel-request at lists.live.com

You can reach the person managing the list at
live-devel-owner at lists.live.com

When replying, please edit your Subject line so it is more specific
than "Re: Contents of live-devel digest..."


Today's Topics:

1. RTP URL (Omenkeukwu, Gregory)
2. Re: RTP URL (Ross Finlayson)
3. RTSP url (Uday Sinha)
4. Re: RTSP url (Ross Finlayson)
5. Re: RTSP url (Uday Sinha)
6. Re: RTSP url (Ross Finlayson)
7. Re: RTSP url (Uday Sinha)
8. Re: RTSP url (Ross Finlayson)
9. WebCam as Frame Source (Ioannis Skazikis)


----------------------------------------------------------------------

Message: 1
Date: Wed, 31 Aug 2005 16:14:06 -0500
From: "Omenkeukwu, Gregory" 
Subject: [Live-devel] RTP URL
To: "'live-devel at lists.live.com'" 

Message-ID:
<3D083A0287FC9648B9D6F907A94A354D01EA8342 at xchsrv01.DEERFIELD.AIM.local>

Content-Type: text/plain; charset=iso-8859-1



> 
> 
> Hello, 
> I am developing a web based application for RTP urls but I am having
> problems finding internet radio stations transmitting RTP. It seems most
> of the internet radio stations are transmitting HTTP. Please I will like
> to get a list of online streaming audio urls in RTP. If you have any
> available please send them to me, I will greatly appreciate it. Thanks
> 
> Greg Omenkeukwu
> gregsnips at yahoo.com 


------------------------------

Message: 2
Date: Wed, 31 Aug 2005 14:29:16 -0700
From: Ross Finlayson 
Subject: Re: [Live-devel] RTP URL
To: "LIVE.COM Streaming Media - development & use"


Message-ID: <6.2.3.4.1.20050831142550.03209eb0 at localhost>
Content-Type: text/plain; charset="us-ascii"; format=flowed


> > I am developing a web based application for RTP urls but I am having
> > problems finding internet radio stations transmitting RTP. It seems most
> > of the internet radio stations are transmitting HTTP. Please I will like
> > to get a list of online streaming audio urls in RTP. If you have any
> > available please send them to me, I will greatly appreciate it. Thanks

RTP URLs have never been standardized, and are generally a bad idea, 
because they don't convey enough information to fully describe a stream.

Instead, RTSP URLs (i.e., beginning with "rtsp://") are the standard.

You can find several such URLs by typing "url:rtsp" into Google.


Ross Finlayson
LIVE.COM



------------------------------

Message: 3
Date: Wed, 31 Aug 2005 22:07:15 +0000
From: "Uday Sinha" 
Subject: [Live-devel] RTSP url
To: live-devel at ns.live.com
Message-ID: 
Content-Type: text/plain; charset="us-ascii"

An HTML attachment was scrubbed...
URL: http://lists.live.com/pipermail/live-devel/attachments/20050831/569423a2/attachment-0001.html

------------------------------

Message: 4
Date: Wed, 31 Aug 2005 15:18:39 -0700
From: Ross Finlayson 
Subject: Re: [Live-devel] RTSP url
To: "LIVE.COM Streaming Media - development & use"


Message-ID: <6.2.3.4.1.20050831151746.03200430 at localhost>
Content-Type: text/plain; charset="us-ascii"; format=flowed


>I am trying use LIVE.COM streaming client using openRTSP.exe. I need 
>a rtsp url, preferably with windows, mpeg content, and that does not 
>use real codecs since they are not supported on LIVE.COM's. Will 
>appreciate a url that works with LIVE.COM streamer. Thanks.

Try
rtsp://christianchallenge.org/ccistream/sunday.mp4

This is MPEG-4 video and audio. It plays in QuickTime Player, VLC 
(which uses the "LIVE.COM Streaming Media" code), and "openRTSP".


Ross Finlayson
LIVE.COM



------------------------------

Message: 5
Date: Wed, 31 Aug 2005 23:19:52 +0000
From: "Uday Sinha" 
Subject: Re: [Live-devel] RTSP url
To: live-devel at ns.live.com
Message-ID: 
Content-Type: text/plain; charset="us-ascii"

An HTML attachment was scrubbed...
URL: http://lists.live.com/pipermail/live-devel/attachments/20050831/33dc2a13/attachment-0001.html

------------------------------

Message: 6
Date: Wed, 31 Aug 2005 16:26:49 -0700
From: Ross Finlayson 
Subject: Re: [Live-devel] RTSP url
To: "LIVE.COM Streaming Media - development & use"


Message-ID: <6.2.3.4.1.20050831162510.03213720 at localhost>
Content-Type: text/plain; charset="us-ascii"; format=flowed

At 04:19 PM 8/31/2005, you wrote:

>Thanks for RTSP url. However, I do not get the audio on speaker. An 
>audio file [audio-MPEG4-GENERIC-1] is created yet the file is empty. 
>Am I doing something wrong.

Yes, the "-a" option requests that audio be output to *standard 
output* (and that video not be received).

If you omit the "-a" option, you'll get two output files - one 
containing video; the other containing audio.


Ross Finlayson
LIVE.COM



------------------------------

Message: 7
Date: Thu, 01 Sep 2005 00:38:04 +0000
From: "Uday Sinha" 
Subject: Re: [Live-devel] RTSP url
To: live-devel at ns.live.com
Message-ID: 
Content-Type: text/plain; charset="us-ascii"

An HTML attachment was scrubbed...
URL: http://lists.live.com/pipermail/live-devel/attachments/20050901/fb2c10a9/attachment-0001.html

------------------------------

Message: 8
Date: Wed, 31 Aug 2005 17:44:12 -0700
From: Ross Finlayson 
Subject: Re: [Live-devel] RTSP url
To: "LIVE.COM Streaming Media - development & use"


Message-ID: <6.2.3.4.1.20050831174259.03228110 at localhost>
Content-Type: text/plain; charset="us-ascii"; format=flowed

At 05:38 PM 8/31/2005, you wrote:

>Looks like there is some problem with the server. Can you stream on 
>your end with following command:
>
>openRTSP -e 50.0 rtsp://christianchallenge.org/ccistream/sunday.mp4

Yes, it works for me.

Perhaps you're yet another person who's behind a firewall that's 
blocking UDP? If so, add the "-t" option to "openRTSP", to request 
RTP-over-TCP streaming.


Ross Finlayson
LIVE.COM



------------------------------

Message: 9
Date: Thu, 01 Sep 2005 08:32:50 +0300
From: Ioannis Skazikis 
Subject: [Live-devel] WebCam as Frame Source
To: live-devel at ns.live.com
Message-ID: <43169282.9080004 at intracom.gr>
Content-Type: text/plain; charset="iso-8859-1"

Hallo,

I try to build an RTSP Live Video Stream server based on the live media
library.

I have also read the live Media FAQ + Mailing List and tryed to follow
your answers to questions from the mailing list archive from others
having the same problem like me.

The program is based on the testMPEG4VideoStreammer testprogramm found
in the liveMedia library.

Based on the DeviseSource.cpp I wrote an DeviceSourceCammera subclass of
the FramedSource" which opens a USB Camera, grubs an Image and decodes
it with help of the Revel Lib (XVID encoding Lib) to MPEG4.

The functions which open the device and starts the Server look like this:

void init_play(){

// Open the input source
DeviceParameters params;

fileSource = DeviceSourceCammera::createNew(*env, params);
if (fileSource == NULL) {
*env << "Unable to open source\n";
exit(1);
}

}

void play() {

FramedSource* videoES = fileSource;

// Create a framer for the Video Elementary Stream:
videoSource = MPEG4VideoStreamFramer::createNew(*env, videoES);

// Finally, start playing:
*env << "Beginning to read from file...\n";
videoSink->startPlaying(*videoSource, afterPlaying, videoSink);
}

>From debuging outputs implemented in the DeviceSourceCammera.cpp by
running the programm I can see that it really opens the device, grab a
frame and encodes it (the procedure repeats it self), but if I start the
mplayer, it connects to the servers reads the sdp , it writes as output
at the end "Found video stream: 0" ,but it does not starts to play the
stream. It stays there with out do nothing (like waiting frames, but
never receives them)

Any Idea why (or what?) is happening?

The DeviceSourceCammera.cpp is included in this e-mail.
lvsMain.cpp is the "Main" file with the server start up code (also
included in this e-mail)
DeviceUtil.hh is the Header file which includes the basic Function of my
code for handling the WebCam device. (this works, I have encoded a
video file, before to play with the LiveMedia Lib.)

The subclass Functions look like this. If you need more details please
ask me or have a look in the attached files...

DeviceSourceCammera::DeviceSourceCammera(UsageEnvironment& env,
DeviceParameters params)
: DeviceSource(env, params){

init(); // Open Device
}

void DeviceSourceCammera::doGetNextFrame() {

grab_image(); //Take a Frame from the Camera

if (0 /* the source stops being readable */) {
handleClosure(this);
fprintf(stderr,"In Grab Image V4l, the source stops being readable
!!!!\n");
return;
}

deliverFrame(); // call DeviceSourceCammera::deliverFrame() Function.
}

DeviceSourceCammera::deliverFrame() {

//Encoding the grub frame from the Camera

if (get_grab_size() > fMaxSize){
frameSize = fMaxSize;
}
else frameSize = get_grab_size();

fTo = (unsigned char*)malloc(frameSize);

memcpy(fTo, frame.pixels, frameSize); // frame.pixels is the buffer
where the grubed frame is now encoded, framesize the size of the encoded
frame
}

Thank you very much for your help and your time !!!!
Sorry about my bad english too.

Ioannis.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: DeviceSourceCammera.cpp
Type: text/x-c++src
Size: 6173 bytes
Desc: not available
Url : http://lists.live.com/pipermail/live-devel/attachments/20050901/95c419c3/DeviceSourceCammera.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DeviceSourceCammera.hh
Type: text/x-c++hdr
Size: 679 bytes
Desc: not available
Url : http://lists.live.com/pipermail/live-devel/attachments/20050901/95c419c3/DeviceSourceCammera-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DeviceUtil.cpp
Type: text/x-c++src
Size: 3680 bytes
Desc: not available
Url : http://lists.live.com/pipermail/live-devel/attachments/20050901/95c419c3/DeviceUtil.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DeviceUtil.hh
Type: text/x-c++hdr
Size: 501 bytes
Desc: not available
Url : http://lists.live.com/pipermail/live-devel/attachments/20050901/95c419c3/DeviceUtil-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvsMain.cpp
Type: text/x-c++src
Size: 3670 bytes
Desc: not available
Url : http://lists.live.com/pipermail/live-devel/attachments/20050901/95c419c3/lvsMain.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: revel.h
Type: text/x-chdr
Size: 9981 bytes
Desc: not available
Url : http://lists.live.com/pipermail/live-devel/attachments/20050901/95c419c3/revel.bin

------------------------------

_______________________________________________
live-devel mailing list
live-devel at lists.live.com
http://lists.live.com/mailman/listinfo/live-devel


End of live-devel Digest, Vol 22, Issue 34
******************************************

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.live.com/pipermail/live-devel/attachments/20050901/bd564657/attachment-0001.html


More information about the live-devel mailing list