带有GStreamer(RTSP)的流式网络摄像头

带有GStreamer(RTSP)的流式网络摄像头,gstreamer,rtsp,nvidia-jetson,nvidia-jetson-nano,Gstreamer,Rtsp,Nvidia Jetson,Nvidia Jetson Nano,我已通过USB电缆连接到Jetson Nano或TX2 我希望能够通过浏览器查看视频,无论是使用RTSP流、Webrtc还是其他方式。 就技术而言,它如何工作并不重要,只要它能工作就行。因此,如果你有任何想法或建议,请随意分享 我目前正在尝试运行基本设置 ./test-launch "nvarguscamerasrc ! video/x-raw(memory:NVMM), format=NV12, width=1920, height=1080, framerate=30/1 ! nvvidco

我已通过USB电缆连接到Jetson Nano或TX2

我希望能够通过浏览器查看视频,无论是使用RTSP流、Webrtc还是其他方式。 就技术而言,它如何工作并不重要,只要它能工作就行。因此,如果你有任何想法或建议,请随意分享

我目前正在尝试运行基本设置

./test-launch "nvarguscamerasrc ! video/x-raw(memory:NVMM), format=NV12, width=1920, height=1080, framerate=30/1 ! nvvidconv ! video/x-raw, width=640, height=480, format=NV12, framerate=30/1 ! omxh265enc ! rtph265pay name=pay0 pt=96 config-interval=1"

我得到的错误是

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://127.0.0.1:8554/test
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not get/set settings from/on resource.
Additional debug info:
gstrtspsrc.c(6999): gst_rtspsrc_setup_streams_start (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
SDP contains no streams
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
我也尝试了一个在PC上对我有用的选项,但我无法让它在Jetson上工作。设置如下所示

从下载并运行:

要发送我运行的网络摄像头流,请执行以下操作:

gst-launch-1.0 v4l2src device=/dev/video0 ! decodebin ! videoconvert ! videoscale ! videorate ! jpegenc quality=30 ! tcpclientsink host=127.0.0.1 port=8700
在此之后,我得到:

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(3064): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:03.944998186
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
我的相机的此命令的输出为:

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

像这样用-v运行管道,并向我显示结果:

gst-launch-1.0 v4l2src device=/dev/video0 ! decodebin ! videoconvert ! videoscale ! videorate ! jpegenc quality=30 ! tcpclientsink host=127.0.0.1 port=8700 -v

如果要流式传输,最简单的方法是使用gst rtsp启动,它是GStreamer预构建二进制文件的一部分:

gst-rtsp-launch '( v4l2src device=/dev/video0 ! videoconvert ! queue ! x264enc tune="zerolatency" byte-stream=true bitrate=10000 ! rtph264pay name=pay0 pt=96 )'

稍后您可以调整编解码器,比特率,但对我来说这已经足够了(可在VLC中播放-rtsp://127.0.0.1:8554/test)

``正在将管道设置为暂停。。。管道是带电的,不需要预滚。。。错误:来自元素/GstPipeline:pipeline0/GstV4l2Src:v4l2src0:内部数据流错误。其他调试信息:gstbasesrc.c(3055):gst_base_src_loop():/GstPipeline:pipeline0/GstV4l2Src:v4l2src0:流停止,原因未协商(-4)错误:管道不想预滚。正在将管道设置为暂停。。。正在将管道设置为就绪。。。正在将管道设置为空。。。释放管道```使用-v运行:在管道的末尾添加-v,然后运行它。它在末尾有-v,并返回这个值。我设法用Streamye运行它,但它说jpeg太大了。我使用了这个管道$gst-launch-1.0 v4l2src device=/dev/video1 io mode=2!图像/jpeg,宽度=1280,高度=720,帧速率=30/1!nvjpegdec!视频/x-raw!xImageSink我还发现该解决方案对我不起作用,所以我需要使用gst-rtsp-server。如果你想发送rtp,可以使用这个:gst-launch-1.0 v4l2src device=/dev/video0!实时支付!udpsink端口=2000主机=127.0.0.1。您的src(v4l2src生成jpeg,您不必转换为jpeg)我的视频是4k,3840x2160。当我试着跑的时候,首先我得到:无元素rtmpjpegpay。当我删除该部分时,我得到:警告:从元素/GstPipeline:pipeline0/GstUDPSink:udpsink0:尝试发送大于最大大小的UDP数据包(1554753>65507)其他调试信息:gstmultipudpsink.c(722):gst_multiudpsink_send_messages():/GstPipeline:pipeline0/GstUDPSink:udpsink0:原因:发送消息时出错:消息太长
v4l2-ctl -d /dev/video1 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
    Index       : 0
    Type        : Video Capture
    Pixel Format: 'MJPG' (compressed)
    Name        : Motion-JPEG
        Size: Discrete 3840x2160
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 2880x2880
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 2048x2048
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 1440x1440
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 1920x1080
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 1280x720
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 640x360
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.200s (5.000 fps)
gst-launch-1.0 v4l2src device=/dev/video0 ! decodebin ! videoconvert ! videoscale ! videorate ! jpegenc quality=30 ! tcpclientsink host=127.0.0.1 port=8700 -v
gst-rtsp-launch '( v4l2src device=/dev/video0 ! videoconvert ! queue ! x264enc tune="zerolatency" byte-stream=true bitrate=10000 ! rtph264pay name=pay0 pt=96 )'