Getting video resolution from plugins before recording

Faraz Sherwani farazsherwani at gmail.com
Tue Nov 25 10:48:18 PST 2014


I am using gstreamer for python to record videos. I am using "v4l2src" and
"ximagesrc" as video source plugins. I am not setting the video resolution,
so the output resolution is determined by the input resolution. At what
point can I find out what that resolution is and what is the correct way of
getting the resolution (width and height)? I have looked through the
documentation and know it has something to do with pads or caps but have
tried and not succeeded in finding the resolution unless I set it myself.
Thanks for your help!

This is my pipeline setup code :
`
bin = gst.Bin()

filesink = gst.element_factory_make('filesink', 'filesink')
filesink.set_property('location', self.location)
bin.add(filesink)

videoqueue = gst.element_factory_make("queue", "videoqueue")
bin.add(videoqueue)

videocodec = gst.element_factory_make("theoraenc", "videocodec")
videocodec.set_property("bitrate", self.config.video_bitrate)
bin.add(videocodec)

# Setup ghost pads
videopad = videoqueue.get_pad("sink")
video_ghostpad = gst.GhostPad("videosink", videopad)
bin.add_pad(video_ghostpad)

# Link Elements
videoqueue.link(videocodec)
videocodec.link(muxer)

# Link muxer to filesink
muxer.link(filesink)
`

Later I am linking my mixer plugin, with my video input plugin:
`
self.player = gst.Pipeline('player')
bus = self.player.get_bus()
bus.add_signal_watch()
bus.enable_sync_message_emission()
bus.connect('message', self.on_message)
bus.connect('sync-message::element', self.on_sync_message)

self.video_tee = gst.element_factory_make('tee', 'video_tee')
self.player.add(self.video_tee)

self.player.add(self.videomixer)
self.videomixer.link(self.video_tee)

self.player.add(input)
input.link(mixer)
`

There might be some code in the middle connecting them that I have not put
here but I hope this will give you enough of an idea what I'm doing.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20141125/e31514a6/attachment.html>


More information about the gstreamer-devel mailing list