An email on the gst-devel mailing list last week pointed me to a rather interesting example in the gst-python repository: switch.py – shows how to use the GstInputSelector element in a Python script to select between different input streams. When I looked at the example I thought right away that it would be cool to use it to switch between different cameras in my simple DVB setup that uses Gstreamer and GNU Radio.
Here is a short screen recording showing slightly pimped version of the switch.py example in action using video test streams and some text overlays.
Watch video on YouTube.
You’ll notice that the script sucks the electrons out of my i7 CPU… I will have to investigate a bit more before I can say for sure, but I suspect it is indeed the input-selector element since I have previously used pipelines with several video sources and threads with barely noticeable CPU load.
I have also added a tee element (a “splitter”) to split the output stream in two streams, one going to a Theora encoder and Matroska muxer, the other one going to a local monitor. More on that later.
The file is in my gnuradio-dvb repository on Github.