opencv - C++/Ubuntu/openCv:gopro 非常低的 fps/分辨率
问题描述
https://www.amazon.fr/gp/product/B08CGVSRQV/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1
我的系统:
gopro3 => microHDMI 转 HDMI => HDMI 转 USB3(我在上面购买的)=> 我的电脑。
和:
gst-launch-1.0 -v v4l2src! video/x-raw, framerate=30/1 ! xvimagesink
终端:
...
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw, framerate=(fraction)30/1, format=(string)YUY2, width=(int)720, height=(int)480, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:5:1, interlace-mode=(string)progressive
...
=>宽度=(int)720,高度=(int)480
我的 gopro 给我 1920/1080/60,只需更改 fps 捕获,分辨率就会自动调整。
例如,如果我强制解决:
gst-launch-1.0 -v v4l2src! video/x-raw, framerate=30/1,width=1920,height=1080! xvimagesink
gst-launch 或 opencv 总是崩溃:
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.000049118
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
除了 1920/1080/ 5fps或 1280/720/ 10fps或 800/600/ 20fps或 720/480/ 30fps之外,60 fps 是不可能的。但是我的 gopro3 black 发送给我 1920/1080/60fps,有什么解释吗??我真的不明白发生了什么。gopro可以,cable可以,采集卡可以,我的电脑可以……
Morover,在 1080p 中,大约 1 秒延迟和 5 fps,在 720p 中大约 0.5 秒延迟,对于 800/600 延迟是可以的,而 480p 延迟大约是 0.2 秒(对我来说完美)。
对于 opencv,它和 gst-streamer 一样糟糕:
cv::VideoCapture video_capture(0, cv::CAP_V4L2);
显示480p,非常流畅
cv::VideoCapture video_capture(0, cv::CAP_GSTREAMER);
显示 1080p 具有很强的延迟
我在哪里做错了?我不明白。是我的采集卡坏了吗?我在 gst-launch-1.0 中的参数是否错误?(那肯定我对 gstreamer 了解甚少)
解决方案
我发现这似乎有效
gst-launch-1.0 -v v4l2src ! "image/jpeg;video/x-raw" ! decodebin ! glimagesink
对于opencv,就是这个:
cv::VideoCapture video_capture("v4l2src ! image/jpeg;video/x-raw,framerate=30/1 ! decodebin ! videoconvert ! appsink", cv::CAP_GSTREAMER);
推荐阅读
- php - PHP sqlsrv_fetch_array with "while loop" crosses the first row
- java - Stream.findFirst 与 Optional.of 不同?
- c# - 尝试在基抽象类中使用标记为内部的接口注入受保护的构造函数时出现不一致的可访问性错误
- tsql - pyspark中的窗口函数(滞后,领先)实现?
- pthreads - 线程再次遇到thread_create语句会不会重新启动?
- php - 表单提交/PHP AJAX 后在同一页面上获取成功消息
- tensorflow - Tensorflow 不接受输入占位符的向量
- typescript - 为什么在 TypeScript 中声明 const foo = 3 是合法的?
- go - 使用 golang.org/x/oauth2 通过 golang Facebook 身份验证获取电子邮件数据
- c - 为什么 sockaddr_in 和 sockaddr 都不兼容?