I'm trying to record my screen using gstreamer and encode its output to h264. Screen recording on Xorg with ximagesrc has BGRx as the available color output. However, nvh264enc only supports BGRA as an available color input. As a result, I'm required to additionally "convert" the video from BGRx to BGRA in order for my pipeline to work.
This difference causes a ~30% CPU usage difference on my ASUS GU603HM. To test the impact of this conversion, I'm using videotestsrc instead of capturing the screen. Running gstreamer with
gst-launch-1.0 -v videotestsrc ! video/x-raw,width=2560,height=1440,framerate=120/1,format=BGRx ! videoconvert ! video/x-raw,format=BGRA ! nvh264enc ! rtph264pay ! udpsink host=10.42.0.20 port=8080
results in a CPU usage of around 90%, where as running
gst-launch-1.0 -v videotestsrc ! video/x-raw,width=2560,height=1440,framerate=120/1,format=BGRA ! nvh264enc ! rtph264pay ! udpsink host=10.42.0.20 port=8080
results in a CPU usage of only 60%.
Is there a significant difference between BGRx and BGRA that I'm not understanding? Wouldn't it be enough to treat the two as identical if the alpha channel is unused? How can I bypass this conversion step to reduce compute on a seemingly useless conversion?