How can I choose which stream to display using gst-launch-1.0?

485 Views Asked by At

I have a parrot drone that has 4 cameras being streamed with RTSP. The 4 cameras are being streamed by the same location (rtsp://192.168.53.1:554/live). Is it possible to choose which stream I want to be displayed using gst-launch-1.0?

When I run:

gst-launch-1.0 rtspsrc location=rtsp://192.168.53.1:554/live latency=0 ! queue ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! videoscale ! video/x-raw,width=1920,height=1080 ! autovideosink

I can see one of the streams, the problem is that the stream displayed is a random one from the four. The output from the gst-launch-1.0 is the following:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://192.168.53.1:554/live
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (request) SETUP stream 1
Progress: (request) SETUP stream 2
Progress: (request) SETUP stream 3
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request

The following images are frames that I extracted from 2 of the 4 streams where, one time the displayed stream was the one from the main camera and another time the one from stereo.

Frame of the main camera stream:

Frame of one stereo camera stream:

1

There are 1 best solutions below

0
Chris On

gst-inspect-1.0 shows us that rtspsrc has a "select-stream" signal. The select-stream signal calls a select_stream_callback that allows you to conditionally accept streams.

Unfortunately, gst-launch-1.0 doesn't allow us to interpret signals or specify callbacks. This can only be done from code.