简体   繁体   English

使用 GStreamer 设置 USB 网络摄像头 RTSP 流

[英]Setting up an USB webcam RTSP stream with GStreamer

I'm using GStreamer to send the camera feed of /dev/video1 (Raspberry Pi's usb webcam) through a RTSP server that I can connect with another Raspberry Pi.我正在使用 GStreamer 通过可以与另一个 Raspberry Pi 连接的 RTSP 服务器发送/dev/video1 (Raspberry Pi 的 USB 网络摄像头)的摄像头馈送。

Result of v4l2-ctl -d /dev/video1 --list-formats : v4l2-ctl -d /dev/video1 --list-formats结果:

ioctl: VIDIOC_ENUM_FMT
    Type: Video Capture

    [0]: 'MJPG' (Motion-JPEG, compressed)
    [1]: 'YUYV' (YUYV 4:2:2)

The pipeline I'm using is我正在使用的管道是

./gst-rtsp-launch --port 8555 '( v4l2src device='/dev/video1 ! image/jpeg,width=800,height=600,framerate=30/1 ! jpegparse ! rtpjpegpay name=pay0 pt=96 )' --gst-debug-level=3`

When running it, and letting the other machine connect, the console gives this message:运行它并让另一台机器连接时,控制台会给出以下消息:

0:00:02.097412343  3234 0xb4c1c0c0 FIXME                default gstutils.c:3981:gst_pad_create_stream_id_internal:<appsrc0:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:02.102907578  3234 0xb5a07600 WARN                 v4l2src gstv4l2src.c:692:gst_v4l2src_query:<v4l2src0> Can't give latency since framerate isn't fixated !
0:00:02.170888076  3234 0xb4c1b980 WARN          v4l2bufferpool gstv4l2bufferpool.c:790:gst_v4l2_buffer_pool_start:<v4l2src0:pool:src> Uncertain or not enough buffers, enabling copy threshold
0:00:02.410829991  3234  0x166ba90 FIXME              rtspmedia rtsp-media.c:3581:gst_rtsp_media_suspend: suspend for dynamic pipelines needs fixing
0:00:02.414457433  3234  0x166ba90 FIXME              rtspmedia rtsp-media.c:3581:gst_rtsp_media_suspend: suspend for dynamic pipelines needs fixing
0:00:02.414551635  3234  0x166ba90 WARN               rtspmedia rtsp-media.c:3607:gst_rtsp_media_suspend: media 0xb5a34130 was not prepared
0:00:03.878249884  3234  0x166ba90 WARN               rtspmedia rtsp-media.c:3868:gst_rtsp_media_set_state: media 0xb5a34130 was not prepared

On the client Raspberry Pi, using VLC on the static IP vlc rtsp://192.168.0.10:8555/video , gives this error (and triggers the previous one in the other board):在客户端 Raspberry Pi 上,在静态 IP vlc rtsp://192.168.0.10:8555/video上使用 VLC,会出现此错误(并触发另一块板上的前一个错误):

mmal: mmal_component_create_core: could not create component 'vc.ril.hvs' (1)
mmal: mmal_vc_component_create: failed to create component 'vc.ril.hvs' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component 'vc.ril.hvs' (1)
mmal: mmal_vc_component_create: failed to create component 'vc.ril.hvs' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component 'vc.ril.hvs' (1)
mmal: mmal_vc_component_create: failed to create component 'vc.ril.hvs' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component 'vc.ril.hvs' (1)
mmal: mmal_vc_port_info_set: failed to set port info (3:0): EINVAL
mmal: mmal_vc_port_set_format: mmal_vc_port_info_set failed 0x909bcaa0 (EINVAL)
Falha de segmentação

The last line means "Segmentation fault".最后一行表示“分段错误”。 The screen in the client board flickers black before giving this error, and the board connect to the webcam only shows this error after the client connected.出现此错误之前,客户端板中的屏幕闪烁黑色,并且板连接到网络摄像头仅在客户端连接后显示此错误。

Connecting to localhost on the same board using vlc rtsp://127.0.0.1:8555/video works for a little bit, then it breaks.使用vlc rtsp://127.0.0.1:8555/video连接到同一块板上的 localhost 可以工作一点,然后就中断了。

How can I fix this pipeline, so the video can be shown correctly through connection between the two boards?如何修复此管道,以便通过两个板之间的连接正确显示视频?

For the record:作为记录:

I asked in the comments which version of gstreamer you were using, to which the answer was "1.14.4".我在评论中询问您使用的是哪个版本的 gstreamer,答案是“1.14.4”。

I suggested you update to the latest version (1.20.1), because a segmentation fault where you see it sounds like a potential bug in gstreamer.我建议您更新到最新版本 (1.20.1),因为您看到的分段错误听起来像是 gstreamer 中的潜在错误。

Turns out that it was correct: updating gstreamer (to 1.18.4) resolved the problem!事实证明这是正确的:更新 gstreamer(到 1.18.4)解决了这个问题!

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

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