Gstreamer无法从USB摄像机捕获视频

时间:2019-12-03 14:08:33

标签: gstreamer v4l2 gstreamer-1.0 nvidia-jetson-nano usb-camera

我有一个 HikVision MV-CA050-20UC USB相机(USB 3.0)。我想使用 gstreamer Ubuntu Nvidia Jetson Nano 上捕获视频。安装驱动程序后,import numpy as np import matplotlib.pyplot as plt vegetables = ["cucumber", "tomato", "lettuce", "asparagus", "potato", "wheat", "barley"] farmers = ["Farmer Joe", "Upland Bros.", "Smith Gardening", "Agrifun", "Organiculture", "BioGoods Ltd.", "Cornylee Corp."] farmers_to_vegetables = dict(zip(farmers, vegetables)) harvest = np.array([[0.8, 2.4, 2.5, 3.9, 0.0, 4.0, 0.0], [2.4, 0.0, 4.0, 1.0, 2.7, 0.0, 0.0], [1.1, 2.4, 0.8, 4.3, 1.9, 4.4, 0.0], [0.6, 0.0, 0.3, 0.0, 3.1, 0.0, 0.0], [0.7, 1.7, 0.6, 2.6, 2.2, 6.2, 0.0], [1.3, 1.2, 0.0, 0.0, 0.0, 3.2, 5.1], [0.1, 2.0, 0.0, 1.4, 0.0, 1.9, 6.3]]) fig, ax = plt.subplots() im = ax.imshow(harvest) # We want to show all xticks... ax.set_xticks(np.arange(len(farmers))) # ... and label them with the respective list entries ax.set_xticklabels(farmers) # Rotate the tick labels and set their alignment. plt.setp(ax.get_xticklabels(), rotation=45, ha="right", rotation_mode="anchor") ax2 = fig.add_subplot(111, label="secondary") ax2.set_aspect("equal") ax2.set_xlim(ax.get_xlim()) ax2.set_ylim(ax.get_ylim()) ax2.tick_params(left=False, labelleft=False, bottom=False, labelbottom=False, top=True, labeltop=True) ax2.set_facecolor("none") for _, spine in ax2.spines.items(): spine.set_visible(False) ax2.set_xticks(ax.get_xticks()) ax2.set_xticklabels([farmers_to_vegetables[x.get_text()] for x in ax.get_xticklabels()]) plt.setp(ax2.get_xticklabels(), rotation=45, ha="left", rotation_mode="anchor") fig.tight_layout() plt.show() 会在连接相机后显示(在断开相机连接后它也会消失)。

/dev/video0

或使用此命令

gst-launch-1.0 v4l2src device="/dev/video0" name=e ! 'video/x-raw, width=640, height=480' ! videoconvert ! 'video/x-raw, width=640, height=480, format=(string)YUY2' ! xvimagesink

它显示没有任何视频的此消息:

gst-launch-1.0 -v v4l2src device=/dev/video0 ! video/x-raw,framerate=30/1,width=1280,height=720 ! xvimagesink

我确定已正确安装 v4l2 。但是它无法检测到插入的USB摄像机。

Setting pipeline to PAUSED ...
ERROR: Pipeline doesnt want to pause.
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Error getting capabilities for device /dev/video0: It isnt a v4l2 driver. Check if it is a v4l1 driver.
Additional debug info:
v4l2_calls.c(94): gst_v4l2_get_capabilities (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
system error: No such file or directory
Setting pipeline to NULL ...
Freeing pipeline ...

或对于1050Ti系统(另一个系统)的此结果:

v4l2-ctl --all


VIDIOC_QUERYCAP: failed: No such file or directory
/dev/video0: not a v4l2 node

也通过运行Failed to query video capabilities: No such file or directory libv4l2: error getting capabilities: No such file or directory VIDIOC_QUERYCAP: failed: No such file or directory /dev/video0: not a v4l2 node  我收到相同的消息。

Gstreamer版本

v4l2-ctl -d /dev/video0 --list-formats-ext

我该如何解决此问题。预先感谢。

0 个答案:

没有答案