gstreamer并排2个easycap设备的视频流

时间:2015-08-29 20:24:43

标签: raspberry-pi video-streaming gstreamer

我正试图从我的树莓派2中同时从2个easycap设备流式传输视频。

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

从EasyCap 1流式传输的命令:

indexPath

从EasyCap 2流式传输的命令:

/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

两个进程都运行良好,我可以看到它们顶部:

/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

我可以在端口5000上连接并查看来自EasyCap 1的流,以及从端口5001上的EasyCap 2流。

我还可以将两个easycaps与“videotestsrc”结合使用。像easycap1这样的

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

或者像easycap2这样的

/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.

但是,如果我尝试将两个easycaps组合成一个流,则会失败。这是我使用的命令:

/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.

这是输出

/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.

Gstreamer版本

/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 ...  

感谢任何帮助

0 个答案:

没有答案