Raspberry pi gstreamer从2台easycap设备并排传输视频

Raspberry pi gstreamer从2台easycap设备并排传输视频,raspberry-pi,video-streaming,gstreamer,Raspberry Pi,Video Streaming,Gstreamer,我正在尝试从我的raspberry pi 2同时并排从2个easycap设备流式传输视频 我做了一个小测试,当我将两个easycap设备作为两个单独的进程运行时,它们可以同时流式传输: 从EasyCap 1传输的命令: /usr/bin/gst-launch-1.0 --gst-debug=GST_CAPS:4 -vvv v4l2src device=/dev/video0 norm=NTSC ! videoconvert ! omxh264enc target-bitrate=1000000

我正在尝试从我的raspberry pi 2同时并排从2个easycap设备流式传输视频

我做了一个小测试,当我将两个easycap设备作为两个单独的进程运行时,它们可以同时流式传输:

从EasyCap 1传输的命令:

/usr/bin/gst-launch-1.0 --gst-debug=GST_CAPS:4  -vvv v4l2src device=/dev/video0 norm=NTSC ! videoconvert ! omxh264enc target-bitrate=1000000 control-rate=variable-skip-frames ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=192.168.1.38 port=5000
从EasyCap 2传输的命令:

/usr/bin/gst-launch-1.0 --gst-debug=GST_CAPS:4  -vvv v4l2src device=/dev/video1 norm=NTSC ! videoconvert ! omxh264enc target-bitrate=1000000 control-rate=variable-skip-frames ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=192.168.1.38 port=5001
这两个进程都运行良好,我可以通过top看到它们:

2859 pi        20   0  170m  14m 9940 S  29.1  1.7   0:01.67 gst-launch-1.0
2847 pi        20   0  170m  14m 9.8m S  28.8  1.7   0:02.51 gst-launch-1.0
我可以连接并查看端口5000上EasyCap 1的流以及端口5001上EasyCap 2的流

我还可以将这两个easycaps与“videotestsrc”结合起来进行流式传输。像这样的轻松卡1

/usr/bin/gst-launch-1.0 v4l2src device=/dev/video0 norm=NTSC ! videoscale ! videoconvert ! video/x-raw,format=YUY2,width=640,height=480 ! videobox border-alpha=0 ! videomixer name=mix ! videoconvert ! omxh264enc ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=192.168.1.38 port=5000 sync=false videotestsrc pattern=1 ! videoscale ! videoconvert ! video/x-raw,format=YUY2,width=640,height=480 ! videobox left=-640 ! mix.
或者像这样轻松的2

/usr/bin/gst-launch-1.0 v4l2src device=/dev/video1 norm=NTSC ! videoscale ! videoconvert ! video/x-raw,format=YUY2,width=640,height=480 ! videobox border-alpha=0 ! videomixer name=mix ! videoconvert ! omxh264enc ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=192.168.1.38 port=5000 sync=false videotestsrc pattern=1 ! videoscale ! videoconvert ! video/x-raw,format=YUY2,width=640,height=480 ! videobox left=-640 ! mix.
然而,如果我尝试将两个easycaps合并到一个流中,它将失败。以下是我使用的命令:

/usr/bin/gst-launch-1.0 --gst-debug=GST_CAPS:4 -vvv v4l2src device=/dev/video1 norm=NTSC ! videoscale ! videoconvert ! video/x-raw,format=YUY2,width=640,height=480 ! videobox border-alpha=0 ! videomixer name=mix ! videoconvert ! omxh264enc ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=192.168.1.38 port=5000 sync=false v4l2src device=/dev/video0 norm=NTSC ! videoscale ! videoconvert ! video/x-raw,format=YUY2,width=640,height=480 ! videobox left=-640 ! mix.
这是输出

/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw, format=(string)YUY2, framerate=(fraction)30000/1001, width=(int)720, height=(int)480, interlace-mode=(string)mixed, pixel-aspect-ratio=(fraction)1/1  
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw, format=(string)YUY2, framerate=(fraction)30000/1001, width=(int)720, height=(int)480, interlace-mode=(string)mixed, pixel-aspect-ratio=(fraction)1/1  
/GstPipeline:pipeline0/GstVideoScale:videoscale1.GstPad:src: caps = video/x-raw, framerate=(fraction)30000/1001, width=(int)640, height=(int)480, interlace-mode=(string)mixed, pixel-aspect-ratio=(fraction)1/1, format=(string)YUY2  
/GstPipeline:pipeline0/GstVideoScale:videoscale0.GstPad:src: caps = video/x-raw, framerate=(fraction)30000/1001, width=(int)640, height=(int)480, interlace-mode=(string)mixed, pixel-aspect-ratio=(fraction)1/1, format=(string)YUY2 
/GstPipeline:pipeline0/GstVideoConvert:videoconvert2.GstPad:src: caps = video/x-raw, framerate=(fraction)30000/1001, width=(int)640, height=(int)480, interlace-mode=(string)mixed, pixel-aspect-ratio=(fraction)1/1, format=(string)YUY2  
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, framerate=(fraction)30000/1001, width=(int)640, height=(int)480, interlace-mode=(string)mixed, pixel-aspect-ratio=(fraction)1/1, format=(string)YUY2  
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:src: caps = video/x-raw, framerate=(fraction)30000/1001, width=(int)640, height=(int)480, interlace-mode=(string)mixed, pixel-aspect-ratio=(fraction)1/1, format=(string)YUY2  
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, framerate=(fraction)30000/1001, width=(int)640, height=(int)480, interlace-mode=(string)mixed, pixel-aspect-ratio=(fraction)1/1, format=(string)YUY2  
/GstPipeline:pipeline0/GstVideoBox:videobox1.GstPad:src: caps = video/x-raw, framerate=(fraction)30000/1001, width=(int)1280, height=(int)480, interlace-mode=(string)mixed, pixel-aspect-ratio=(fraction)1/1, format=(string)YUY2  
/GstPipeline:pipeline0/GstVideoBox:videobox0.GstPad:src: caps = video/x-raw, framerate=(fraction)30000/1001, width=(int)640, height=(int)480, interlace-mode=(string)mixed, pixel-aspect-ratio=(fraction)1/1, format=(string)YUY2  
/GstPipeline:pipeline0/GstVideoMixer2:mix.GstVideoMixer2Pad:sink_0: caps = video/x-raw, framerate=(fraction)30000/1001, width=(int)1280, height=(int)480, interlace-mode=(string)mixed, pixel-aspect-ratio=(fraction)1/1, format=(string)YUY2  
/GstPipeline:pipeline0/GstVideoMixer2:mix.GstVideoMixer2Pad:sink_0: caps = video/x-raw, framerate=(fraction)30000/1001, width=(int)1280, height=(int)480, interlace-mode=(string)mixed, pixel-aspect-ratio=(fraction)1/1, format=(string)YUY2  
/GstPipeline:pipeline0/GstVideoBox:videobox1.GstPad:sink: caps = video/x-raw, framerate=(fraction)30000/1001, width=(int)640, height=(int)480, interlace-mode=(string)mixed, pixel-aspect-ratio=(fraction)1/1, format=(string)YUY2  
/GstPipeline:pipeline0/GstVideoBox:videobox1.GstPad:sink: caps = video/x-raw, framerate=(fraction)30000/1001, width=(int)640, height=(int)480, interlace-mode=(string)mixed, pixel-aspect-ratio=(fraction)1/1, format=(string)YUY2  
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:sink: caps = video/x-raw, framerate=(fraction)30000/1001, width=(int)640, height=(int)480, interlace-mode=(string)mixed, pixel-aspect-ratio=(fraction)1/1, format=(string)YUY2  
/GstPipeline:pipeline0/GstVideoConvert:videoconvert2.GstPad:sink: caps = video/x-raw, framerate=(fraction)30000/1001, width=(int)640, height=(int)480, interlace-mode=(string)mixed, pixel-aspect-ratio=(fraction)1/1, format=(string)YUY2  
/GstPipeline:pipeline0/GstVideoScale:videoscale1.GstPad:sink: caps = video/x-raw, format=(string)YUY2, framerate=(fraction)30000/1001, width=(int)720, height=(int)480, interlace-mode=(string)mixed, pixel-aspect-ratio=(fraction)1/1  
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data flow error.  
Additional debug info:  
gstbasesrc.c(2865): gst_base_src_loop (): /GstPipeline:pipeline0  /GstV4l2Src:v4l2src0:  
streaming task paused, reason not-negotiated (-4)  
Execution ended after 0:00:00.159226895  
Setting pipeline to PAUSED ...  
Setting pipeline to READY ...  
Setting pipeline to NULL ...  
Freeing pipeline ...  
Gstreamer版本是

/usr/bin/gst-launch-1.0 --version
gst-launch-1.0 version 1.2.4
GStreamer 1.2.4

感谢您的帮助

您的问题几乎无法阅读。。。你应该用一种更好的方式格式化它。很抱歉,这应该可以从GST_DEBUG=6日志进行调试。你能试试最新的版本吗?1.4或1.5.90+?如果这种情况仍然存在,请在gstreamer的bugzilla中提交一个bug。