[Live-devel] Questions on streaming live H263 videos

Ross Finlayson finlayson at live555.com
Mon Dec 17 07:03:11 PST 2007


>I'd like to stream h263-encoded videos to various media players (mainly
>realplayer on mobile phones).
>
>What I do now is starting a thread that captures live frames and encodes
>them in H263 with ffmpeg. The thread writes on a Unix named pipe (FIFO).
>Then I create a RTSPServer instance, create a ServerMediaSession and add
>a subsession, passing the FIFO file name as the subsession parameter.

I presume you're using a "H263plusVideoFileServerMediaSubsession" 
object for your video.  Be sure to set the "reuseFirstSource" 
parameter to "True", because you are streaming from a single (live) 
source, rather than from a file that's stored on disk.


>1) VLC and Mplayer are able to play the live video, while RealPlayer
>isn't.  I captured the network conversation with wireshark, and it seems
>the RTSP negotiation is done correctly, but the server just won't send
>RTP packets (while with VLC or MPlayer it does).

You're going to have to figure out yourself why the server is not 
streaming.  (Remember, You Have Complete Source Code (for the 
server), and also a working client.)  I'm not surprised, however, 
that RealPlayer doesn't wor; it's notoriously non-standards compliant.


>2) VLC and Mplayer correctly view the live video, but they often will
>play a chunk of it, then "freeze" the frame for a few seconds, then play
>another chunk, then freeze again. What could the problem be? Buffering?

That's my guess.  Can you increase the buffer size of your pipe?


>3) In my naive implementation, I start the encoder thread after adding
>the subsession and before the taskScheduler().doEventLoop() call. I'd
>like, instead, to start my decoder thread when and only when a client
>does a request for the stream (sparing resources when the server is
>idle), in an "on demand" fashion.

First, remember to set "reuseFirstSource" to "True" (as noted above), 
so that you create only one source object, regardless of the number 
of clients.

I suggest defining a subclass of 
"H263plusVideoFileServerMediaSubsession", and redefining the 
"createNewStreamSource()" virtual function to start your encoder(sic) 
thread, and then call the parent class 
("H263plusVideoFileServerMediaSubsession")'s 
"createNewStreamSource()".
-- 

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


More information about the live-devel mailing list