Getting sample rate / sample format/ channels cound of playbin in python
Pavel Hofman
pavel.hofman at ivitera.com
Fri Dec 8 07:01:07 UTC 2017
Hi Tim,
>
> The signal gives you the pad. From the pad you can query the caps with
> something like
>
> caps = pad.get_current_caps()
>
> and then from the caps you can get the rate/channel fields from the
> first caps structure:
>
> rate = caps[0]['rate']
> chans = caps[0]['channels']
Thanks a lot. Actually I was able to find examples of getting the rate
from the pad -> caps, but I cannot find/do not know how to get the
correct pad from the gst 1.0 playbin (playbin2 ). May I ask you for help
with this?
>
> If you don't actually need to play the file you can also use the
> GstDiscoverer API from the pbutils library instead.
Very good to know. For this I am using Python audio tools
http://audiotools.sourceforge.net/ but perhaps standardizing on
gstreamer would be an advantage.>
> With playbin3 this is slightly nicer, you get a STREAM_COLLECTION
> message on the bus with the streams and can query the info (caps etc.)
> from the stream object instead.
I will take a look at playbin3, my project needs no backward
compatibility. Is playbin3 stable enough?
I very much appreciate your help, thanks a lot.
Pavel.
More information about the gstreamer-devel
mailing list