How to recognize if a stream contains both video and audio OR contains just one of them

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

How to recognize if a stream contains both video and audio OR contains just one of them

Xinheng
Hello,

I have a hls stream with with both video and audio and I have also a hls stream with only video. Instead of playbin, I use hlsdemux and tsdemux to play them. But for the two different cases, I have to construct two different pipelines.

The question is, is there any way to recognize the stream (if it contains both or just video) before I construct the pipeline in order to play it correctly? Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: How to recognize if a stream contains both video and audio OR contains just one of them

Baby Octopus
Administrator
You can attach decodebin after hlsdemux and wait for the callback. You will get callback such as "pad-added" signal which will tell you the caps of decoded media

Alternatively, see if gst-discoverer helps you