我在linux中有4个usb framegrabbers,我想从中捕获视频并在4个屏幕中显示(在一个窗口中混合)。
运行命令给出了framegrabber支持的内容:
gst-launch-1.0 --gst-debug=v4l2src:5 v4l2src device=/dev/video0 ! fakesink 2>&1 | sed -une '/caps of src/ s/[:;] /\n/gp'
结果:
0:00:00.015135255 4333 0x1e01630 DEBUG v4l2src gstv4l2src.c:300:gst_v4l2src_negotiate:<v4l2src0> caps of src
video/x-raw, format=(string)YUY2, framerate=(fraction)30000/1001, width=(int)720, height=(int)480, interlace-mode=(string)interleaved, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt601
video/x-raw, format=(string)I420, framerate=(fraction)30000/1001, width=(int)720, height=(int)480, interlace-mode=(string)interleaved, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt601
video/x-raw, format=(string)YV12, framerate=(fraction)30000/1001, width=(int)720, height=(int)480, interlace-mode=(string)interleaved, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt601
video/x-raw, format=(string)BGR, framerate=(fraction)30000/1001, width=(int)720, height=(int)480, interlace-mode=(string)interleaved, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)1:1:5:4
video/x-raw, format=(string)RGB, framerate=(fraction)30000/1001, width=(int)720, height=(int)480, interlace-mode=(string)interleaved, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)1:1:5:4
当我跑步时:
#!/bin/bash
gst-launch-1.0 -e videomixer name=mix ! videoconvert ! autovideosink \
videotestsrc pattern=13 ! video/x-raw, format=YUY2, framerate=30000/1001, width=720, height=480 ! videobox border-alpha=0 top=-480 left=-720 ! mix. \
videotestsrc pattern=1 ! video/x-raw, format=YUY2, framerate=30000/1001, width=720, height=480 ! videobox border-alpha=0 top=-480 left=0 ! mix. \
videotestsrc pattern=15 ! video/x-raw, format=YUY2, framerate=30000/1001, width=720, height=480 ! videobox border-alpha=0 top=0 left=-720 ! mix. \
videotestsrc pattern=0 ! video/x-raw, format=YUY2, framerate=30000/1001, width=720, height=480 ! videobox border-alpha=0 top=0 left=0 ! mix.
它有效。四个测试窗口出现了。
现在我想显示/ dev / video0但它不起作用。
Reports "Internal data flow error":
#!/bin/bash
gst-launch-1.0 -e videomixer name=mix ! videoconvert ! autovideosink \
v4l2src device=/dev/video0 ! video/x-raw, format=YUY2, framerate=30000/1001, width=720, height=480 ! videobox border-alpha=0 top=-480 left=-720 ! mix. \
v4l2src device=/dev/video1 ! video/x-raw, format=YUY2, framerate=30000/1001, width=720, height=480 ! videobox border-alpha=0 top=-480 left=0 ! mix. \
v4l2src device=/dev/video2 ! video/x-raw, format=YUY2, framerate=30000/1001, width=720, height=480 ! videobox border-alpha=0 top=0 left=-720 ! mix. \
v4l2src device=/dev/video3 ! videoconvert ! video/x-raw, format=YUY2, framerate=30000/1001, width=720, height=480 ! videobox border-alpha=0 top=0 left=0 ! mix.
运行它会出错:
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 flow error.
Additional debug info:
gstbasesrc.c(2948): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming task paused, reason not-negotiated (-4)
EOS on shutdown enabled -- waiting for EOS after Error
Waiting for EOS...
ERROR: from element /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0/GstXvImageSink:autovideosink0-actual-sink-xvimage: Output window was closed
Additional debug info:
xvimagesink.c(555): gst_xv_image_sink_handle_xevents (): /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0/GstXvImageSink:autovideosink0-actual-sink-xvimage
有人可以帮忙。
答案 0 :(得分:0)
我没有足够的观点将其作为评论。
除了我的视频源是MJPEG流之外,我有完全相同的问题。
我设法通过向管道添加视频来达到创建窗口的位置。
这对你来说是等价的:
gst-launch-1.0 -e videomixer name=mix ! videoconvert ! autovideosink \
v4l2src device=/dev/video0 ! videoscale ! video/x-raw, format=YUY2, framerate=30000/1001, width=720, height=480 ! videobox border-alpha=0 top=-480 left=-720 ! mix. \
v4l2src device=/dev/video1 ! videoscale ! video/x-raw, format=YUY2, framerate=30000/1001, width=720, height=480 ! videobox border-alpha=0 top=-480 left=0 ! mix. \
v4l2src device=/dev/video2 ! videoscale ! video/x-raw, format=YUY2, framerate=30000/1001, width=720, height=480 ! videobox border-alpha=0 top=0 left=-720 ! mix. \
v4l2src device=/dev/video3 ! videoscale ! videoconvert ! video/x-raw, format=YUY2, framerate=30000/1001, width=720, height=480 ! videobox border-alpha=0 top=0 left=0 ! mix.
不幸的是,我得到的只是一个空窗口,但至少它是进步。