2013-12-14 88 views
1

我想通过UDP通过ximagesrc流式传输桌面。缩放screencapture失败时,我用gstreamer通过UDP流式传输

,没有任何缩放(宽度,高度,帧率)为完整的桌面工作,与下面的程序:

gst-launch-0.10 ximagesrc ! ffmpegcolorspace ! x264enc tune=zerolatency bitrate=500 speed-preset=superfast ! queue ! rtph264pay name=pay0 pt=96 ! udpsink host=192.168.0.103 port=5000 auto-multicast=true 

然而,当我想指定widht,高度失败。

gst-launch-0.10 ximagesrc ! video/x-raw,width=320,height=240,framerate=20/1 ! ffmpegcolorspace ...etc 

错误: 警告:管道错误:无法连接到ximagesrc0 ffmpegcsp0

我该如何解决这个问题?

回答

2

你需要你的帽子之前添加videoscale元素:

$ gst-launch-0.10 ximagesrc ! videoscale ! video/x-raw,width=320,height=240,framerate=20/1 ! 

UPD
而且,这个问题可能是您的上限。您可以使用-v标志来获取详细输出并检查ximagesrc的真实情况。
例如

gst-launch-0.10 -v ximagesrc \ 
    ! ffmpegcolorspace \ 
    ! x264enc tune=zerolatency bitrate=500 speed-preset=superfast \ 
    ! queue ! rtph264pay name=pay0 pt=96 \ 
    ! udpsink host=192.168.0.103 port=5000 auto-multicast=true 

... 
/GstPipeline:pipeline0/GstXImageSrc:ximagesrc0.GstPad:src: caps = video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)1366, height=(int)768, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)1/1 
... 

在这里我可以看到它提供video/x-raw-rgb(不video/x-raw)。

所以缩放视频我需要一个管道是这样的:

gst-launch-0.10 -v ximagesrc \ 
    ! ffmpegcolorspace \ 
    ! videoscale ! video/x-raw-rgb,width=320,height=240 \ 
    ! x264enc tune=zerolatency bitrate=500 speed-preset=superfast \ 
    ! queue ! rtph264pay name=pay0 pt=96 \ 
    ! udpsink host=192.168.0.103 port=5000 auto-multicast=true 
+0

这并不解决问题。同样的错误。 – user2279550

+0

请参阅更新回答 –

+0

ffmpegcolorspace后格式为video/x-raw-yuv,因此videoscale应采用相同的格式。我将编辑您的文本,以便它准确无误。非常感谢您向我展示如何解决这些问题。这工作。谢谢。 – user2279550

相关问题