how can I grab video from usb video capture + dvb device with gstreamer?

坚强是说给别人听的谎言 提交于 2019-12-11 10:55:33

问题


I own a avermedia volar HX usb stick, I want to capture fromthe composite input , but I can't because I'm unable to select the input. I'm using gstreamer with + python, I think I need to use gsttuner select input but I have no experience using gstreamer's interfaces. Could someone post a simple example?

Thanks!


回答1:


src = gst.element_factory_make("v4l2src", "src")
src.set_state(gst.STATE_PAUSED)
try:
    # channel names will be different for each device
    channels = src.list_channels()
    composite = [x for x in channels if x.label == "Composite1"]
    if composite:
        self.src.set_channel(composite[0])
except AttributeError, e:
    log.warn("Could not tune video source\n")



回答2:


To anyone stumbling on this, some internal gstreamer changes since this was originally posted may require gst.STATE_READY now instead of STATE_PAUSED. Tripped me up as it seems half the capture devices I encounter default to PAL and I need to use the GST_TUNER interface to change it.




回答3:


The code shown above seems basically correct, but it will flounder on the rocks of v4l2. The strings you get will depend on what card you have:

On four different cards so far I've encountered:

  • "Composite"
  • "Composite1"
  • "composite"
  • "Composite Video Input"

Also be aware that some cards will have the driver lie, since the chip set has four inputs, the driver will often report four, even if the manufacturer only connects to two of them.



来源:https://stackoverflow.com/questions/1284008/how-can-i-grab-video-from-usb-video-capture-dvb-device-with-gstreamer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!