[Live-devel] Proper way to stream several files with live libraries?

Ross Finlayson finlayson at live.com
Tue Nov 23 08:59:21 PST 2004

>I've been looking to the code, doxygen docs and examples but I'm not sure 
>what will be the best way to stream several video files to several "channels".

This is actually fairly easy to do.  Just use one of the existing 
"test*Streamer" applications as a model, but modify it to have more than 
one file source, and more than one "RTPSink" (with corresponding 
"RTCPInstance") - one for each indended destination 'channel'.  You would 
then call "startPlaying()" multiple times - once for each desired 
source-destination pair.

>I have two lists of several MPEG2 ES video files and I would like to use 
>RTP to stream the files on each list to separate "channels", one for each 
>list (being these "channels" the same multicast address and different 
>ports or two different multicast addresses), one video file after another 
>and then start again from the beginning.

The fact that you're streaming the files one after the other - rather than 
simultaneously - adds a bit of complexity.  This means that you can't make 
the (multiple) calls to "startPlaying()" all at once.  Instead, you need to 
call stream N's "startPlaying()" from within stream N-1's 'after playing' 

>For streaming several files I've seen ByteStreamMultiFileSource class, 
>which should be passed to a MPEG1or2VideoStreamFramer object, right?

No, don't use "ByteStreamMultiFileSource".  You would use this only if you 
were streaming multiple files - one after the other - to the *same* 

>For having 2 different "channels", I thought of having two threads with 
>different env, sink and source for each one.

No, don't do this.  There's absolutely no need to use multiple threads 
here.  Just use a single thread, with a single "UsageEnvironment", but with 
multiple sources and sinks, and with "startPlaying()" called multiple times 
- once for each desired source-sink pair.

	Ross Finlayson

More information about the live-devel mailing list