Switching in an rtmpsink

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Switching in an rtmpsink

superlou
I have a pipeline (running via Python bindings) that lets me stream a videotestsrc to UStream successfully, based heavily on http://sourceforge.net/p/snowmix/wiki/Snowmix%20and%20CDNs/.  It looks like the following:

videotestsrc ! videoconvert ! intervideosrc
intervideosink ! queue ! videoconvert ! x264enc ! h264parse ! queue ! flvmux ! queue ! rtmpsink

The UStream channel goes live with the video test pattern.

What I really want to do is start the pipeline with a fakesink in place of the rtmpsink, and then after a few seconds, swap in an rtmpsink.  I do the whole pad-blocking dance to replace the element, and when I'm done, the debug graph shows everything playing, and UStream shows the station is live, but the video is just black with no video test pattern.

The only interesting thing I can see so far is that when returning from the blocking probe callback, I receive the message "TypeError: int() argument must be a string or a number, not 'NoneType'".  I had thought it might be a bindings quirk, but it's the only lead I have right now.

I have tried to make a simpler test case, but it segfaults when leaving the probe callback.  The script is at https://gist.github.com/superlou/9105561.
Reply | Threaded
Open this post in threaded view
|

Re: Switching in an rtmpsink

Baby Octopus
What is the agenda behind switching between the two sinks? I assume you dont want rtmpsink to receive the data during some specific time intervals. If so, why dont you consider using valve element?

~BO
Reply | Threaded
Open this post in threaded view
|

Re: Switching in an rtmpsink

superlou
The issue I had was at the point the pipeline is created, the application doesn't know the user's UStream rtmp url.  Unfortunately, if the rtmpsink tries to start playing with an invalid url, it throws errors.

I guess maybe I could have a valve ahead of the rtmpsink, and leave the rtmpsink in the READY state until it has enough data to configure it's url?  The biggest thing that confused me about the swapping-in approach is that it works if the swap is done very quickly (scripted to happen immediately rather than waiting for use input), and when done later, is still seeing something that UStream identifies as valid data, just only has black video.
Reply | Threaded
Open this post in threaded view
|

Re: Switching in an rtmpsink

Baby Octopus
You can consider modifying rtmpsink plugin or librtmp to increase the timeout of rtmp connection

Alternatively, you can also think of adding a queue before rtmpsink plugin and connect the queue to the sink based on queue callback("running" signal)

~BO
Reply | Threaded
Open this post in threaded view
|

Re: Switching in an rtmpsink

superlou
> Alternatively, you can also think of adding a queue before rtmpsink plugin and connect the queue to the sink based on queue callback("running" signal)

Sorry if I'm missing something important.  How does connecting the rtmpsink plugin on the queue callback signal help?   When looking at the debug messages, it seems like everything gets to PLAYING successfully, and the anomaly is that the video is just a black image.  How does the timeout of the RTMP connection affect the video stream?  It seems like the RTMP connection is successful because UStream says the channel is "live."