Encoding 使用GStreamer的VNC屏幕直播 简介

Encoding 使用GStreamer的VNC屏幕直播 简介,encoding,gstreamer,rtp,vnc,rfb-protocol,Encoding,Gstreamer,Rtp,Vnc,Rfb Protocol,我一直在尝试使用GStreamer捕获vnc屏幕,然后将其发送到rtp端点。我已经使用了一个rfbsrc插件,但它工作不稳定,并且有第一帧丢失和冻结。 也许我的GStreamer管道中存在一个问题: '--gst-debug=2', '-vvv', 'rtpbin', 'name=rtpbin', 'rtp-profile=avpf', 'latency=100', 'rfbsrc', `host=${rfbConfig.host}`, `port=${rfbConfig.port}`, '!'

我一直在尝试使用GStreamer捕获vnc屏幕,然后将其发送到rtp端点。我已经使用了一个rfbsrc插件,但它工作不稳定,并且有第一帧丢失和冻结。 也许我的GStreamer管道中存在一个问题:

'--gst-debug=2',
'-vvv',
'rtpbin', 'name=rtpbin', 'rtp-profile=avpf', 'latency=100',
'rfbsrc', `host=${rfbConfig.host}`, `port=${rfbConfig.port}`,
'!', 'videoconvert',
'!', 'x264enc', 'tune=zerolatency', 'speed-preset=1', 'dct8x8=true', 'quantizer=23', 'pass=qual',
'!', 'video/x-h264, profile=baseline',
'!', 'rtph264pay', 'ssrc=111110', 'pt=96',
'!', 'queue2',
'!', 'rtprtxqueue', 'max-size-time=2000', 'max-size-packets=0',
'!', 'rtpbin.send_rtp_sink_0',
'rtpbin.send_rtp_src_0',
'!', 'udpsink', 'bind-address=127.0.0.1', 'host=127.0.0.1', 'bind-port=5004', `port=${videoRtpPort}`,
'rtpbin.send_rtcp_src_0',
'!', 'udpsink', 'bind-address=127.0.0.1', 'host=127.0.0.1', `port=${videoRtcpPort}`, 'sync=false', 'async=false', 'udpsrc', 'port=5005',
'!', 'rtpbin.recv_rtcp_sink_0',
我正在尝试使用另一种捕获方式——对stdin中的帧进行编码,但实际上我在以下管道中没有成功:

'--gst-debug=2',
'-vvv',
'rtpbin', 'name=rtpbin', 'rtp-profile=avpf', 'latency=100',
'fdsrc',
'!', 'videoparse', 'width=1280', 'height=720', 'framerate=15/1',
'!', 'queue',
'!', 'x264enc', 'tune=zerolatency', 'speed-preset=1', 'dct8x8=true', 'quantizer=23', 
'pass=qual',
'!', 'video/x-h264, profile=baseline',
'!', 'rtph264pay', 'ssrc=111110', 'pt=96',
'!', 'queue2',
'!', 'rtprtxqueue', 'max-size-time=2000', 'max-size-packets=0',
'!', 'rtpbin.send_rtp_sink_0',
'rtpbin.send_rtp_src_0',
'!', 'udpsink', 'bind-address=127.0.0.1', 'host=127.0.0.1', 'bind-port=5004', 
`port=${videoRtpPort}`,
'rtpbin.send_rtcp_src_0',
'!', 'udpsink', 'bind-address=127.0.0.1', 'host=127.0.0.1', `port=${videoRtcpPort}`, 
'sync=false', 'async=false', 'udpsrc', 'port=5005',
'!', 'rtpbin.recv_rtcp_sink_0',
'gst-launch-1.0',
'-vvv',
'rtpbin', 'name=rtpbin', 'rtp-profile=avpf',
'fdsrc', 'timeout=1000000',
'!', 'queue', 'max-size-bytes=0', 'max-size-buffers=0', 'max-size-time=0', 'min-threshold-buffers=1',
'!', 'image/x-portable-pixmap,width=1280,height=720,framerate=30/1',
'!', 'pnmdec',
'!', 'videoconvert',
'!', 'x264enc', 'tune=zerolatency', 'speed-preset=1', 'dct8x8=true', 'quantizer=23', 'pass=qual',
'!', 'video/x-h264, profile=baseline',
'!', 'rtph264pay', 'ssrc=111110', 'pt=96',
'!', 'rtprtxqueue', 'max-size-time=2000', 'max-size-packets=0',
'!', 'rtpbin.send_rtp_sink_0',
'rtpbin.send_rtp_src_0',
'!', 'udpsink', 'bind-address=127.0.0.1', 'host=127.0.0.1', 'bind-port=5004', `port=${videoRtpPort}`,
'rtpbin.send_rtcp_src_0',
'!', 'udpsink', 'bind-address=127.0.0.1', 'host=127.0.0.1', `port=${videoRtcpPort}`, 'sync=false', 'async=false', 'udpsrc', 'port=5005',
'!', 'rtpbin.recv_rtcp_sink_0',
问题
使用GStreamer捕获vnc屏幕并发送到RTP端点的正确方法是什么?我的GStreamer管道中是否存在任何明显的错误?

最后,我使用以下管道解决了问题:

'--gst-debug=2',
'-vvv',
'rtpbin', 'name=rtpbin', 'rtp-profile=avpf', 'latency=100',
'fdsrc',
'!', 'videoparse', 'width=1280', 'height=720', 'framerate=15/1',
'!', 'queue',
'!', 'x264enc', 'tune=zerolatency', 'speed-preset=1', 'dct8x8=true', 'quantizer=23', 
'pass=qual',
'!', 'video/x-h264, profile=baseline',
'!', 'rtph264pay', 'ssrc=111110', 'pt=96',
'!', 'queue2',
'!', 'rtprtxqueue', 'max-size-time=2000', 'max-size-packets=0',
'!', 'rtpbin.send_rtp_sink_0',
'rtpbin.send_rtp_src_0',
'!', 'udpsink', 'bind-address=127.0.0.1', 'host=127.0.0.1', 'bind-port=5004', 
`port=${videoRtpPort}`,
'rtpbin.send_rtcp_src_0',
'!', 'udpsink', 'bind-address=127.0.0.1', 'host=127.0.0.1', `port=${videoRtcpPort}`, 
'sync=false', 'async=false', 'udpsrc', 'port=5005',
'!', 'rtpbin.recv_rtcp_sink_0',
'gst-launch-1.0',
'-vvv',
'rtpbin', 'name=rtpbin', 'rtp-profile=avpf',
'fdsrc', 'timeout=1000000',
'!', 'queue', 'max-size-bytes=0', 'max-size-buffers=0', 'max-size-time=0', 'min-threshold-buffers=1',
'!', 'image/x-portable-pixmap,width=1280,height=720,framerate=30/1',
'!', 'pnmdec',
'!', 'videoconvert',
'!', 'x264enc', 'tune=zerolatency', 'speed-preset=1', 'dct8x8=true', 'quantizer=23', 'pass=qual',
'!', 'video/x-h264, profile=baseline',
'!', 'rtph264pay', 'ssrc=111110', 'pt=96',
'!', 'rtprtxqueue', 'max-size-time=2000', 'max-size-packets=0',
'!', 'rtpbin.send_rtp_sink_0',
'rtpbin.send_rtp_src_0',
'!', 'udpsink', 'bind-address=127.0.0.1', 'host=127.0.0.1', 'bind-port=5004', `port=${videoRtpPort}`,
'rtpbin.send_rtcp_src_0',
'!', 'udpsink', 'bind-address=127.0.0.1', 'host=127.0.0.1', `port=${videoRtcpPort}`, 'sync=false', 'async=false', 'udpsrc', 'port=5005',
'!', 'rtpbin.recv_rtcp_sink_0',
我使用pnmdec对从rfb(vnc)获得的原始图像进行解码