寻求基于GStreamer的无压缩无损UDP/TCP流媒体解决方案
寻求主机到客户端的无损灰度位图流媒体传输方案
我一直在找合适的编码/负载配置,实现主机到客户端的无损流媒体传输(双方带宽无限制),但始终没找到满意的方案。目前用以下两个GStreamer管线临时替代,但传输后会出现JPEG伪影,达不到需求:
cv::VideoWriter writer_h264( "appsrc ! videoconvert ! " "x264enc pass=quant quantizer=0 tune=zerolatency " "speed-preset=superfast byte-stream=true cabac=false ! " "rtph264pay ! udpsink host=127.0.0.1 port=5000", 0, // fourcc 30, // fps cv::Size(200, 200), false); // isColor // 接收端播放命令: // gst-launch-1.0 -v udpsrc port=5000 ! "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! autovideosink cv::VideoWriter writer_jpeg( "appsrc !" "videoconvert ! video/x-raw,format=YUY2 ! jpegenc ! rtpjpegpay ! udpsink host=127.0.0.1 port=5001", 0, // fourcc 30, // fps cv::Size(200, 200), false); // isColor // 接收端播放命令: // gst-launch-1.0.exe udpsrc port=5001 ! application/x-rtp,media=video,encoding-name=JPEG ! rtpjpegdepay ! jpegdec ! videoconvert ! autovideosink
我们的数据源是简单的CV_8UC1灰度位图,希望能以原始格式传输到客户端(用于显示和分析)。原本觉得PNG编解码器合适,但没有对应的PNG RTP负载器。目前两个管线输出结果一致,说明伪影问题应该是jpegenc/rtpjpegpay导致的,对比图如下:
[流媒体结果对比:左侧为原图,右侧两张为客户端接收后的带伪影结果]
更新:尝试rtpvraw负载后的情况
根据建议,我尝试使用rtpvraw负载元素,管线配置如下:
发送端命令:
GST_DEBUG=3 /d/gstreamer-x/1.0/msvc_x86_64/bin/gst-launch-1.0 -v multifilesrc location="frame%02d.png" loop=true index=10 caps="image/png,framerate=(fraction)30/1" ! pngdec ! videoconvert ! rtpvrawpay ! udpsink host="127.0.0.1" port="5000"
接收端命令:
./gst-launch-1.0 udpsrc port=5000 caps="application/x-rtp,media=video,clock-rate=90000,encoding-name=RAW,sampling=BGR,depth=(string)8,width=(string)200,height=(string)200,colorimetry=SMPTE240M" ! rtpvrawdepay ! videoconvert ! queue ! autovideosink
(客户端caps参数通过查看调试输出获取)
效果有所改善,但输出画面存在可见的抗锯齿,想问下这会不会是autovideosink导致的?
[rtpvraw传输后的结果图:画面存在可见抗锯齿]
内容的提问来源于stack exchange,提问作者Steve Broberg
相关产品推荐
相关产品推荐

