Color space conversion CPU utilization

Sebastian Dröge sebastian at centricular.com
Fri Mar 25 08:05:56 UTC 2016


On Do, 2016-03-24 at 21:05 -0400, Alex wrote:
> Hi,
> 
> I'm running into a problem, where a simple color space conversion seems 
> to be consuming a non-trivial amount of CPU. Consider the following 
> pipeline (ran on 1080p source):
> 
> gst-launch-1.0 -e rtspsrc 
> location=rtsp://user:pwd@10.10.10.54/video.h264 ! decodebin ! x264enc 
> threads=6 speed-preset=1 ! video/x-h264, profile=baseline ! splitmuxsink 
> max-size-time=15000000000 location=file-%03d.mp4
> 
> 
> This pipeline runs at 66% CPU. Now, when I change it to
> 
> gst-launch-1.0 -e rtspsrc 
> location=rtsp://user:pwd@10.10.10.54/video.h264 ! decodebin ! 
> videoconvert ! "video/x-raw, format=BGRA" ! videoconvert ! "video/x-raw, 
> format=I420" ! x264enc threads=6 speed-preset=1 ! video/x-h264, 
> profile=baseline ! splitmuxsink max-size-time=15000000000 
> location=file-%03d.mp4
> 
> the CPU utilization nearly doubles (to slightly over 120%).
> 
> Is there a way to optimize it? My current (non-gstreamer) code is using 
> ffmpeg's swscale to convert color space, and the effect of that 
> conversion on overall performance is quite negligible.

Why do you want to convert to BGRA just to convert back to I420? What
is the actual pipeline you want to get running?

Colorspace conversion in the CPU, and especially for high
resolutions/framerates, is a quite expensive task. Depending on which
formats you convert from and to. Once you know the actual formats
you'll have to convert between, we could add fast-paths for them (if
not existing yet) or optimize the conversion. If ffmpeg can do the same
conversion faster, we should be able to find a way to optimize ours
too.

But in any case, it would be good to know between which formats you
really need to convert in your real pipeline :) And that also includes
the format that comes out of decodebin for your media.

-- 
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160325/cff326bf/attachment.sig>


More information about the gstreamer-devel mailing list