简体   繁体   English

如何在Windows上使用Gstreamer从UVC获取编码流

[英]How to get encoded stream coming from UVC with Gstreamer on Windows

I want to get encoded stream coming from Logitech HD Webcam (UVC) on Windows with Gstreamer. 我希望在Windows上使用Gstreamer从Logitech HD Webcam(UVC)获得编码流。 I know on Linux you can access via /dev/video1 and etc. However, I don't know how to do it on Windows. 我知道在Linux上您可以通过/ dev / video1等访问。但是,我不知道如何在Windows上执行此操作。

I can get raw buffers via ksvideosrc on Windows but that doesn't solve my problem. 我可以通过Windows上的ksvideosrc获取原始缓冲区,但这并不能解决我的问题。 I must get hardware encoded stream. 我必须获得硬件编码流。 If you know any other library rather than Gstreamer, guide me please. 如果你知道任何其他图书馆而不是Gstreamer,请指导我。

I expect the output like this but for Windows version. 我希望输出像这样,但对于Windows版本。
gst-launch-1.0 v4l2src device=/dev/video0 ! gst-launch-1.0 v4l2src device = / dev / video0! decodebin ! decodebin! ximagesink ximagesink

I found a solution for people who will have this problem. 我找到了解决这个问题的人的解决方案。

gst-launch-1.0 v4l2src device=/dev/video0 ! image/jpeg,width=1280,height=720 ! decodebin ! ximagesink


This will attach the camera's encoded stream, and decode with decodebin and gives the output to the Window. 这将附加摄像机的编码流,并使用decodebin进行解码并将输出提供给Window。 If you do not write image/jpeg etc. , it will automatically attachs to the raw buffer from camera. 如果你不写image / jpeg等,它会自动从相机附加到原始缓冲区。

In C++ Code, it is like 在C ++代码中,它就像

GstElement* v4l2src = gst_element_factory_make("v4l2src","Source");
GstElement* srcFilter = gst_element_factory_make("capsfilter","Filter");

then you will add them into pipeline and link them. 然后你将它们添加到管道并链接它们。 That will do. 那样做。
Note: If the camera does not support that resolution and media type, it will give 注意:如果相机不支持该分辨率和媒体类型,则会给出

streaming stopped, reason not-negotiated (-4)

error. 错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM