2

介绍

我一直在尝试使用 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',

我正在尝试使用另一种捕获方式 - 对来自标准输入的帧进行编码,但实际上我没有成功使用以下管道:

'--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',

问题

使用 GStreamer 捕获 vnc 屏幕并发送到 RTP 端点的正确方法是什么?我的 GStreamer 管道中是否有任何明显的错误?

4

1 回答 1

1

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

'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) 获得的原始图像。

于 2020-05-25T09:32:59.947 回答