Skip to content

Color accuracy when using vaapi #33

@schauveau

Description

@schauveau

What follows is not really a bug report because I already found the solution. Hopefully, the following information could be helpful to other users.

I noticed that the colors are not accurate when using vaapi (i965 driver). Simply speaking the shadows are darker while the highlights are brighter. On my system, this is especially noticeable because all my terminals and editors are using a dark background that becomes completely black in the recording.

I eventually figured out that vaapi is probably assuming an MPEG color range (16-235) instead of the full range (0-255) when doing the RGB to YUV conversion.

A possible solution is to add the -t option to do the conversion from RGB to YUV in software but this is not ideal since that can significantly increase the cpu usage.

So a better solution that works with h264_vaapi and hevc_vaapi is to pass the codec option color_range=2. Unfortunately that does not seem to work for the other vaapi codecs.

wf-recorder -c h264_vaapi -d /dev/dri/renderD128 -p color_range=2

The attached image shows from left to right, a reference image, a vaapi screencast with bad colors, and the same screencast with the option color_range=2.

color-range

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions