Finding out resolution of video of input file using decodebin2?
Dear gstreamer experts,
I need to find out the resolution of the video in my input file, and
in general characteristics of my input streams for later use, like
audio sampling frequency, audio channels and the like. I need this
information to setup some stuff before I can continue building my
My original though was to wait for the 'new-decoded-pad' signal coming
out of decodebin2 but from what I'm seeing, while decodebin2 generates
a pad for every stream it finds the caps of the pad only have the main
decoded format and not other stuff like resolutions or framerates.
Usually decoded video pads come out with caps="video/x-raw-rgb;
video/x-raw-yuv" and decoded audio pads with caps ="audio/x-raw-int,
channels=(int)[ 1, 2 ] ...". they are not fixed caps.
It does seem though, that precise information about the streams is
available using the 'autoplug-select' signal as this is generating the
actual encoded stream pads for decoding. Inspecting the caps coming
out of 'autoplug-select' one can retrieve precise info of the streams
in the input. Sadly, the pads exposed with 'autoplug-select' are not
the final decoded pads from before so I don't see an easy way to
relate the caps information all the way down to when the decoded pads
are emitted. One could assume certain order in which the pads are
being generated but that route sounds funky.
I'm sure there is an easier way to get this sorted out and thus I'm
looking for your enlightenment,
(decoder is the decodebin element). This is done after PAUSE state. So:
* you iterate on the pad of the decodebin element (line 483)
* you check if it's video or audio (line 496 for example)
* then, for video, for example, look at the emotion_video_sink_fill()
function (line 560):