[Live-devel] using stdin for live555MediaServer
Ross Finlayson
finlayson at live555.com
Mon Aug 24 07:08:32 PDT 2020
> On Aug 25, 2020, at 1:33 AM, Simon Brown <sbrown at microvideo.co.uk> wrote:
>
>> I suggest doing the following, in order (making sure that each step works OK before moving to the next step):
>> 1/ Capture ‘stdin’ into a “.ts” file - e.g., running
>> cat < your-encoder-source > source.ts
>> 2/ Make sure that that the “source.ts” file plays normally (e.g., using VLC)
>> 3/ Try streaming the “source.ts” file (e.g., using the LIVE555 Media Server), and receiving it (over the network), using “openRTSP”, rather than VLC
>> See http://www.live555.com/openRTSP
>> 4/ Rename the resulting "VIDEO-*” file to “received.ts”, and try playing that file using VLC
>> 5/ Use VLC (instead of “openRTSP”) as a RTSP client, to play the stream from the “rtsp://“ URL
>> 6/ Connect your encoder source to “testOnDemandRTSPServer” (modified as noted above), by running
>> your-modified-testOnDemandRTSPServer < your-encoder-source
>> 7/ Try receiving the stream remotely using “openRTSP”
>> 8/ Rename the resulting "VIDEO-*” file to “received.ts”, and try playing that file using VLC
>> 9/ Use VLC (instead of “openRTSP”) as a RTSP client, to play the stream from the “rtsp://“ URL
> […]
> Ok, I've done 1, 2, 3, 4 and 5 without problem. I stall at 6. I connect the output of my encoder to stdin by spawning the testOnDemandRTSPServer from within my main program and connect pipes to it and then pushing the data into this pipe. As soon as I do this, my program stalls, yet if I change my program back to pushing data out on UDP it's fine.
>
> Similarly, if I add a second option to testOnDemandRTSPServer to stream a test.ts file on mpeg2TransportStreamTest and to stream stdin on mpeg2TransportStreamStdin then the server launched through my main program streams neither, yet if I launch it from the command line then the test file works (but obviously without a file connected to stdin the stdin doesn't work).
>
> Is there any reason why or how test testOnDemandRTSPServer would be blocking my main program from running?
No, but it sounds like there’s something wrong in the way that you’re “spawning the testOnDemandRTSPServer from within my main program and connect pipes to it and then pushing the data into this pipe”.
You should make sure that you can walk, before you try running.
Why not simply do the following:
1/ Have your encoder simply output to ‘stdout’, rather than trying to spawn “testOnDemandRTSPServer”, and creating pipes itself. Then run, from the command line (again, make sure that each step works OK before moving to the next step):
2/ your-encoder-program > source.ts
3/ your-modified-testOnDemandRTSPServer < source.ts (make sure that RTSP clients (“openRTSP” and “VLC”) can receive data OK from this)
4/ your-encoder-program | your-modified-testOnDemandRTSPServer (again, make sure that RTSP clients can receive data OK from this)
In other words, why bother having your program go through all the work of setting up/writing to a pipe, and spawning “testOnDemandRTSPServer”? Instead, simply do all of this from your shell's command line. That’s one of the good things about Unix.
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
More information about the live-devel
mailing list