【发布时间】:2020-02-19 10:03:19
【问题描述】:
我目前在使用 GStreamer 时遇到了一个小问题,这里有更多详细信息:
配置:
- 英特尔 i7-6700
- 英特尔高清显卡 530
- Ubuntu 18.04 LTS
- GStreamer1.0
- VAAPI 插件
我从视频源收到UDP 流,该流以RAW UYVY 格式发送。这是我的命令行来解码它:
gst-launch-1.0 -v udpsrc port="1234" caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)RAW, sampling=(string)YCbCr-4:2:2, depth=(string)8, width=(string)1920, height=(string)1080, colorimetry=(string)BT709-2, payload=(int)96, ssrc=(uint)1188110121, timestamp-offset=(uint)4137478200, seqnum-offset=(uint)7257, a-framerate=(string)25" ! rtpvrawdepay ! decodebin ! queue ! videoconvert ! xvimagesink
我们可以在下面的屏幕截图中看到问题,CPU 负载(右)对于此类任务来说太高了,我们可以看到GPU 负载(左)几乎为零。
为了克服这个问题,我想使用 VAAPI 图形加速,就像我在之前的项目中使用 H264 所做的那样,下面是命令行:
gst-launch-1.0 -v udpsrc port=1234 caps= "application/x-rtp, media\=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, packetization-mode=(string)1, profile-level-id=(string)640028, payload=(int)96, ssrc=(uint)2665415388, timestamp-offset=(uint)3571350145, seqnum-offset=(uint)18095, a-framerate=(string)25" ! rtph264depay ! queue ! vaapih264dec low-latency=1 ! autovideosink
上面的行完美运行,CPU 几乎没有更多负载。所以我调整了这个命令行来使用RAW流,这里是命令:
gst-launch-1.0 -v udpsrc port="1234" caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)RAW, sampling=(string)YCbCr-4:2:2, depth=(string)8, width=(string)1920, height=(string)1080, colorimetry=(string)BT709-2, payload=(int)96, ssrc=(uint)1188110121, timestamp-offset=(uint)4137478200, seqnum-offset=(uint)7257, a-framerate=(string)25" ! rtpvrawdepay ! vaapidecodebin ! videoconvert ! xvimagesink
它与开头的那一行相同,但我将元素 decodebin 更改为 vaapidecodebin,因为我已将 avdec_h264 替换为 vaapih264dec 用于我的 H264 流。不幸的是它不起作用,我最终得到了这个错误:
WARNING: wrong pipeline: unable to connect rtpvrawdepay0 to vaapidecodebin0
我该如何解决这个问题?你有什么线索可以解决这个问题吗?
【问题讨论】:
标签: linux ubuntu video gstreamer vaapi