How to choose the program in TS file with gstreamer?


I’m working on Apalis IMX6 using Yocto.
I would like to play a TS file using Gstreamer and choose the played program.
At this time, i use the following command :

gst-launch-1.0 filesrc location=/mnt/usb/HD5_6Mbps_5min_v2.trp ! decodebin name = dec dec. ! queue ! audioconvert ! volume volume=10 ! alsasink dec. ! queue ! videoconvert ! imxg2dvideosink

This works fine but it’s always the first program of the TS file which is played.

Thanks in advance for your help.

  • Use a concrete pipe-line rather than using decodebin trying to detect demuxer.

  • NXP’s i.MX Linux User’s Guide may have some more usage information for multimedia use cases.

  • Their community may also have more specific answers in the multimedia domain.

  • You demuxer of choice may have a property to specify resp. program e.g. have a look at the output of the following command:

    gst-inspect-1.0 aiurdemux


Advantage of using decodebin is that video+audio codec is chosen automatically.
In the same TS, i can have MPEG2 video + MPEG4 Video.
It’s very hard to detect the stream, and build the pipe with good video codec + good audio codec !

Sure, I’m fully aware of decodebin’s advantages however if you want something rather special like being able to choose a particular program from an MPEG transport stream then I guess decodebin might not be able to serve you.

You can't have your cake and eat it too!

You might want to consider playbin rather than decodebin.

It has a property called current-audio and current-video that can be used to select a stream other than the default one.

of course but on my hardware, decodebin works better than playbin.