使用gstreamer和视频混合器&通过UDP传输2台摄像机

时间:2016-04-01 17:34:09

标签: raspberry-pi gstreamer h.264 rtp v4l2

我有一个带2个摄像头的Raspberry Pi Compute模块。我尝试使用gstreamer和v4l2src选择/ dev / video0& / dev / video1连续运行大约20FPS并使用视频混合器并排组合图像然后通过RTP输出H264到UDP端口(由另一个主机读取)/

默认(当前)RPi v4l2src驱动程序不支持两个摄像头,但是到目前为止可以使用测试版,但它需要beta 4.4.6内核。

我遇到的问题是连接调音台。

#!/bin/bash -x
#
# Script to start RPi Compute Module streaming over RTP (RFC3984)
# from both cameras
#
FPS=20                          # Frames per second
WIDTH=640                       # Image width
HEIGHT=480                      # Image height
UPLINK_HOST=192.168.1.73        # Receiving host
PORT=5200                       # UDP port
#
# TESTING WITH ONE CAMERA ONLY FOR THE MOMENT
#
function start_streaming
{
  gst-launch-1.0 -ve videomixer name=mixer  \
  ! x264enc \
  ! h264parse \
  ! rtph264pay config-interval=10 pt=96 \
  ! udpsink host=$UPLINK_HOST port=$PORT \
  v4l2src device=/dev/video0 \
  ! video/x-raw,format=AYUV,width=$WIDTH,height=$HEIGHT,framerate=$FPS/1 \
  ! mixer.
}

# Start streaming on both cameras simultaneously
echo Image size: $WIDTH x $HEIGHT
echo Frame rate: $FPS
echo Starting cameras 0 and 1 streaming to $UPLINK_HOST:$PORT
start_streaming

# Wait until everything has finished
wait

exit 0
# end

我得到的是相当无用的信息:

WARNING: erroneous pipeline: could not link v4l2src0 to mixer

我已经相当多地摆弄并且无处可去 - 它可能是微不足道的,但是如果我能看到它就会被打击!

非常感谢

尼克

1 个答案:

答案 0 :(得分:0)

我认为问题是选择的格式。您在相机不支持时使用AYUV。尝试用I420替换AYUV。