[VAAPI] [AMD] Slightly wrong HDR colors after transcoding with no tonemapping #7752

Open
opened 2026-02-05 13:17:17 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @mik9 on GitHub (Nov 5, 2025).

I have searched the existing issues, both open and closed, to make sure this is not a duplicate report.

  • Yes

The bug

VAAPI hardware: Radeon Vega integrated into 5600g

I tries to setup video transcoding without tonemapping (since most modern devices support HDR) and observed that in transcoded video colors are slightly off. After some investigation I found the cause: out_range=pc parameter in scale_vaapi filter. When I run transcoding without that parameter colors are fine.

Observed result (left to right Original/Transcoded with out_range=pc/Transcoded without out_range=pc). Had to take a photo because SDR screenshot of HDR content on mac looks absolutely wrong. Green leaf on the middle image are slightly brighter than other 2.

Image

The OS that Immich Server is running on

ubuntu-server 24.04

Version of Immich Server

v2.1.0

Version of Immich Mobile App

v2.1.0

Platform with the issue

  • Server
  • Web
  • Mobile

Device make and model

No response

Your docker-compose.yml content

from documentation

Your .env content

from documentation

Reproduction steps

  1. Transcoding settings: Video codec = hevc
  2. Target resolution = original
  3. CRF = 35
  4. Preset = fast
  5. Maximum bitrate = 0
  6. Tone-mapping = disabled
  7. Acceleration API = VAAPI
  8. ======
  9. Take HDR video on iPhone
  10. Upload
  11. Let it transcode
  12. Download transcoded video
  13. Compare colors

Relevant log output


Additional information

ffmpeg args from ps aux
ffmpeg command with issue:

/usr/bin/ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -noautorotate -hwaccel_device /dev/dri/renderD128 -threads 1 -i /data/library/admin/... -y -c:v hevc_vaapi -c:a copy -movflags faststart -fps_mode passthrough -map 0:0 -map_metadata -1 -map 0:1 -g 256 -tag:v hvc1 -v verbose -vf scale_vaapi=2160:-2:mode=hq:out_range=pc:format=nv12 -compression_level 5 -qp:v 35 -global_quality:v 35 -rc_mode 1 /data/encoded-video/...

ffmpeg command without issue:
/usr/bin/ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -noautorotate -hwaccel_device /dev/dri/renderD128 -threads 1 -i /data/library/admin/... -y -c:v hevc_vaapi -c:a copy -movflags faststart -fps_mode passthrough -map 0:0 -map_metadata -1 -map 0:1 -g 256 -tag:v hvc1 -v verbose -vf scale_vaapi=format=nv12 -compression_level 5 -qp:v 35 -global_quality:v 35 -rc_mode 1 /data/encoded-video/...

UPD: out_range=tv also produces correct colors

Originally created by @mik9 on GitHub (Nov 5, 2025). ### I have searched the existing issues, both open and closed, to make sure this is not a duplicate report. - [x] Yes ### The bug VAAPI hardware: Radeon Vega integrated into 5600g I tries to setup video transcoding without tonemapping (since most modern devices support HDR) and observed that in transcoded video colors are slightly off. After some investigation I found the cause: `out_range=pc` parameter in `scale_vaapi` filter. When I run transcoding without that parameter colors are fine. Observed result (left to right Original/Transcoded with `out_range=pc`/Transcoded without `out_range=pc`). Had to take a photo because SDR screenshot of HDR content on mac looks absolutely wrong. Green leaf on the middle image are slightly brighter than other 2. ![Image](https://github.com/user-attachments/assets/fa15006a-4a49-4d05-b677-e68c31ebbb5a) ### The OS that Immich Server is running on ubuntu-server 24.04 ### Version of Immich Server v2.1.0 ### Version of Immich Mobile App v2.1.0 ### Platform with the issue - [x] Server - [ ] Web - [ ] Mobile ### Device make and model _No response_ ### Your docker-compose.yml content ```YAML from documentation ``` ### Your .env content ```Shell from documentation ``` ### Reproduction steps 1. Transcoding settings: Video codec = hevc 2. Target resolution = original 3. CRF = 35 4. Preset = fast 5. Maximum bitrate = 0 6. Tone-mapping = disabled 7. Acceleration API = VAAPI 8. ====== 9. Take HDR video on iPhone 10. Upload 11. Let it transcode 12. Download transcoded video 13. Compare colors ### Relevant log output ```shell ``` ### Additional information ffmpeg args from `ps aux` ffmpeg command with issue: ` /usr/bin/ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -noautorotate -hwaccel_device /dev/dri/renderD128 -threads 1 -i /data/library/admin/... -y -c:v hevc_vaapi -c:a copy -movflags faststart -fps_mode passthrough -map 0:0 -map_metadata -1 -map 0:1 -g 256 -tag:v hvc1 -v verbose -vf scale_vaapi=2160:-2:mode=hq:out_range=pc:format=nv12 -compression_level 5 -qp:v 35 -global_quality:v 35 -rc_mode 1 /data/encoded-video/... ` ffmpeg command without issue: ` /usr/bin/ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -noautorotate -hwaccel_device /dev/dri/renderD128 -threads 1 -i /data/library/admin/... -y -c:v hevc_vaapi -c:a copy -movflags faststart -fps_mode passthrough -map 0:0 -map_metadata -1 -map 0:1 -g 256 -tag:v hvc1 -v verbose -vf scale_vaapi=format=nv12 -compression_level 5 -qp:v 35 -global_quality:v 35 -rc_mode 1 /data/encoded-video/... ` **UPD:** `out_range=tv` also produces correct colors
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#7752