gstreamer 绿屏 Ubuntu 20.04

问题描述 投票:0回答:1

我尝试使用此管道为一些 .png 图片创建视频流。

发件人: auto rtsp_pipeline = "appsrc!video/x-raw,format=BGR,width=1920,height=1080,framerate=10/1!videoscale!videoconvert!x264enc tune=zerolatency bitrate=80000 speed-preset=superfast!rtph264pay!udpsink主机=127.0.0.1 端口= 5010";

output_stream = cv::VideoWriter(rtsp_pipeline, cv::CAP_GSTREAMER, 0, frame_rate, cv::Size(1920, 1080), true);

timer_ = this->create_wall_timer(100ms, std::bind(&PipelineSimulator::timer_callback, this));

这个timer_callback: img_ = cv::imread(this->filenames[current_index]); output_stream.write(img_);

接收者: gst-launch-1.0 udpsrc 端口=5010!应用程序/x-rtp,编码名称=H264,有效载荷=96! rtph264depay ! h264解析!解码箱!视频转换!自动视频接收器

这是结果: enter image description here

不知道问题出在哪里

我试图改变颜色格式。但我认为这是一个问题缓冲区

streaming buffer pipeline gstreamer ubuntu-20.04
1个回答
0
投票

您的接收器可能正在等待尚未收到的帧内帧。您可以添加 x264enc 的属性

key-int-max
以负担得起的设置时间,例如 30 帧 3 秒 @10fps:

pipeline = "appsrc ! video/x-raw,format=BGR,width= 1920, height= 1080,framerate=10/1 ! queue ! videoscale ! videoconvert ! x264enc tune=zerolatency bitrate=80000 speed-preset=superfast insert-vui=1 key-int-max=30 ! h264parse ! rtph264pay ! udpsink host=127.0.0.1 port=5010";

在接收方,您还可以添加 rtpjitterbuffer 并根据您的情况调整其延迟属性:

gst-launch-1.0 udpsrc port=5010 ! queue ! application/x-rtp,encoding-name=H264 ! rtpjitterbuffer latency=500 ! rtph264depay ! h264parse ! decodebin ! videoconvert ! autovideosink sync=0
© www.soinside.com 2019 - 2024. All rights reserved.