1

I am currently experiencing a small problem with GStreamer, here are more details:

Configuration:

  • Intel i7-6700
  • Intel HD Graphics 530
  • Ubuntu 18.04 LTS
  • GStreamer1.0
  • VAAPI plugin

I receive a UDP stream from a video source, this stream is sent in RAW UYVY format. Here is my command line to decode it:

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

Problem as we can see on the screenshot below, the CPU load (right) is far too high for this kind of task and we can see the GPU load (left) which is almost zero.

CPU & GPU charge

To overcome this problem, I want to use the VAAPI graphics acceleration as I did in a previous project with H264 of which here is the command line below:

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

The line above works perfectly and the CPU has almost no more loads. So I adapt this command line to use it with a RAW stream, here is the command:

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

It is the same line as the one at the beginning but I changed the element decodebin by vaapidecodebin as I had replaced avdec_h264 by vaapih264dec for my H264 stream. Unfortunately it doesn't work and I end up with this error:

WARNING: wrong pipeline: unable to connect rtpvrawdepay0 to vaapidecodebin0

How I can solve this problem? Do you have any leads to solve this problem?

ValentinDP
  • 323
  • 5
  • 14

1 Answers1

2

What exactly are you trying to accelerate here? The CPU load is probably either due to the videoconvert as this is run in software to convert UYVY into a format your renderer supports (Hopefully that's another YUV format and not RGB) or it is the data transfer of the uncompressed data from CPU memory to GPU memory.

Note that transferring uncompressed image data is a much higher data rate than compressed H.264 video.

If you think the videoconvert is the expensive part you may want to try to use OpenGL for convert and displaying: .. ! glupload ! glcolorconvert ! glimagesink.

Maybe vaapipostproc can help you with color conversion if you don't want to go the OpenGL route.

Florian Zwoch
  • 6,764
  • 2
  • 12
  • 21
  • Hi, thanks for your response. I tried the command line by replacing videoconvert by OpenGL that improves the result a little but a core of the CPU remains loaded at around 40% while the 3 others are around 6-7%. I would like all cores have approximately the same charge so that it is homogeneous. – ValentinDP Feb 19 '20 at 11:17
  • Okay no worries, and the vaapidecodebin setting doesn't work in this kind of situation? – ValentinDP Feb 19 '20 at 12:42
  • You are dealing with raw image data - what is VAAPI supposed to "decode" here? – Florian Zwoch Feb 19 '20 at 12:55
  • I found another solution to harmonize my CPU using the taskset command. Now I have three cores that are loaded at almost the same level. – ValentinDP Feb 19 '20 at 13:24