同时保存不同分辨率的gstreamer流

时间:2017-03-23 12:30:26

标签: gstreamer odroid

我在odroid xu4上安装了C920 logitec usb网络摄像头,安装了linux ubuntu。我希望以h264格式录制最高质量的视频。

每秒30帧,视频大小为1920x1080。同时发送流h264格式,但质量较低。

我可以以相同的质量进行录制和流式传输,但质量不同。现在有人如何修复管道,以便我可以以较低的质量流式传输? 工作(同样的决议):


gst-launch-1.0 v4l2src device=/dev/video0 ! tee name=t \
! queue  ! video/x-h264,framerate=30/1,width=1920,height=1080 ! h264parse ! mp4mux ! filesink location=/media/webcam.mp4 -v -e t. \
! queue ! h264parse ! rtph264pay ! udpsink host=113.141.0.1 port=4321

不工作:(发送尺寸800x600):

gst-launch-1.0 v4l2src device=/dev/video0 ! tee name=t \
! queue  ! video/x-h264,framerate=30/1,width=1920,height=1080 ! h264parse ! mp4mux ! filesink location=/media/webcam.mp4 -v -e t. \
! queue ! video/x-h264,framerate=30/1,width=800,height=600 ! h264parse ! rtph264pay ! udpsink host=113.141.0.1 port=4321

这是我在尝试不同分辨率时遇到的错误:



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)
/GstPipeline:pipeline0/GstMP4Mux:mp4mux0.GstPad:src: caps = video/quicktime, variant=(string)iso
EOS on shutdown enabled -- waiting for EOS after Error
Waiting for EOS...
/GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink: caps = video/quicktime, variant=(string)iso
ERROR: from element /GstPipeline:pipeline0/GstH264Parse:h264parse1: No valid frames found before end of stream
Additional debug info:
gstbaseparse.c(1153): gst_base_parse_sink_event_default (): /GstPipeline:pipeline0/GstH264Parse:h264parse1
ERROR: from element /GstPipeline:pipeline0/GstH264Parse:h264parse0: No valid frames found before end of stream
Additional debug info:
gstbaseparse.c(1153): gst_base_parse_sink_event_default (): /GstPipeline:pipeline0/GstH264Parse:h264parse0

1 个答案:

答案 0 :(得分:0)

我找到了一个可能的解决方案,但它是一个非常繁重的操作(CPU智能),因为我们首先需要从网络摄像头解码H264视频,更改分辨率并再次编码。

根据帧速率,视频,编码速度和比特率,此操作最多可占用odroid-xu4上的多个核心。与根本不改变分辨率相比,网络摄像头上的H264设置的最高分辨率和帧率最高可达20%(<1920}。


gst-launch-1.0 v4l2src device=/dev/video0 ! tee name=t ! queue  ! video/x-h264,framerate=30/1,width=1920,height=1080 ! h264parse ! mp4mux ! filesink location=/root/temp/webcam.mp4 -v -e t. ! queue ! decodebin ! videoscale ! videorate ! video/x-raw,framerate=30/1,width=800,height=600 ! x264enc bitrate=500 speed-preset=superfast tune=zerolatency ! h264parse ! rtph264pay ! udpsink host=132.132.10.11 port=1234 -v

请注意,如果x264enc没有设置'tune = zerolatency',那么管道将会遇到“重新分配延迟...”消息。

是否有人知道类似命令但CPU使用率较低?