#Over saturated transcoded HDR videos with hardware decoding on compared with HW decoding off

1 messages · Page 1 of 1 (latest)

shrewd zealot
#

I have enabled acceleration via QSV and up until recently I have had hw decoding disabled. To take advantage of end-to-end transcoding I have now enabled hw decoding and re-encoded a couple of videos.

Observations:

  1. [hw decoding enabled] - Transcoded videos are over saturated compared to hw decoding disabled. I have tried all tone-mapping profiles and none of them reduce the saturation after re-encoding after each profile change.

  2. Changing Tone-mapping NPL has no impact with hw decoding enabled. It only seems to make a change where hw decoding is disabled i.e. where tone-mapping is performed by CPU.

For now I have reverted back to hw decoding disabled as this yields the best results on transcoded videos where tone-mapping is concerned.

Using docker-compose on unraid using openvino for ML container.

Nothing interesting in the logs except that QSV acceleration started and completed.

[Nest] 6 - 10/31/2024, 1:08:57 PM LOG [Microservices:MediaService] Encoding video 98643ce3-7f24-4944-9a2f-09a61d24d50b with QSV acceleration
[Nest] 6 - 10/31/2024, 1:10:17 PM LOG [Microservices:MediaService] Successfully encoded 98643ce3-7f24-4944-9a2f-09a61d24d50b

small spruceBOT
#

:wave: Hey @shrewd zealot,

Thanks for reaching out to us. Please follow the recommended actions below; this will help us be more effective in our support effort and leave more time for building Immich immich.

References

Checklist

  1. :ballot_box_with_check: I have verified I'm on the latest release(note that mobile app releases may take some time).
  2. :ballot_box_with_check: I have read applicable release notes.
  3. :ballot_box_with_check: I have reviewed the FAQs for known issues.
  4. :ballot_box_with_check: I have reviewed Github for known issues.
  5. :ballot_box_with_check: I have tried accessing Immich via local ip (without a custom reverse proxy).
  6. :ballot_box_with_check: I have uploaded the relevant logs, docker compose, and .env files, making sure to use code formatting.
  7. :ballot_box_with_check: I have tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable

(an item can be marked as "complete" by reacting with the appropriate number)

If this ticket can be closed you can use the /close command, and re-open it later if needed.

odd edge
#

Could you set the log level to debug, run transcoding for an affected asset and share the FFmpeg command in the server logs?

#

Also share the ffprobe output for the video

shrewd zealot
#

With NPL set at 450 and hw decoding enabled:

rvices:MediaService] Encoding video 98643ce3-7f24-4
944-9a2f-09a61d24d50b with QSV acceleration
[Nest] 7  - 10/31/2024, 2:15:48 PM   DEBUG [Microse
rvices:MediaRepository] ffmpeg -n 10 /usr/bin/ffmpe
g -hwaccel qsv -hwaccel_output_format qsv -async_de
pth 4 -noautorotate -threads 1 -i /photos/library/a
dmin/2024/10/IMG_8447.MOV -y -c:v hevc_qsv -c:a cop
y -movflags faststart -fps_mode passthrough -map 0:
0 -map 0:1 -bf 7 -refs 5 -g 256 -tag:v hvc1 -v verb
ose -vf hwmap=derive_device=opencl,tonemap_opencl=d
esat=0:format=nv12:matrix=bt709:primaries=bt709:ran
ge=pc:tonemap=hable:transfer=bt709,hwmap=derive_dev
ice=qsv:reverse=1,format=qsv -preset 4 -global_qual
ity:v 28 /photos/encoded-video/56811294-74ec-432e-a
5b6-272ee0b4eb55/98/64/98643ce3-7f24-4944-9a2f-09a6
1d24d50b.mp4```
#

Sorry how do I get the ffprobe output from the video?

#
rvices:MediaService] OpenCL not available for trans
coding, so RKMPP acceleration will use CPU decoding```
#

Is this a problem about Opencl not available?

odd edge
#

You can download the video and run ffprobe -show_streams <video path>

#

This should also work: docker exec immich_server ffprobe -show_streams /photos/library/a dmin/2024/10/IMG_8447.MOV

shrewd zealot
odd edge
#

Can you try running this command and clearing the browser cache after it’s finished?

docker exec immich_server ffmpeg -hwaccel qsv -hwaccel_output_format qsv -async_depth 4 -noautorotate -threads 1 -i /photos/library/admin/2024/10/IMG_8447.MOV -y -c:v hevc_qsv -c:a copy -movflags faststart -fps_mode passthrough -map 0:0 -map 0:1 -bf 7 -refs 5 -g 256 -tag:v hvc1 -v verbose -vf hwmap=derive_device=opencl,tonemap_opencl=desat=0:format=nv12:matrix=bt709:primaries=bt709:range=pc:tonemap=hable:transfer=bt709:peak=1000,hwmap=derive_device=qsv:reverse=1,format=qsv -preset 4 -global_quality:v 28 /photos/encoded-video/56811294-74ec-432e-a5b6-272ee0b4eb55/98/64/98643ce3-7f24-4944-9a2f-09a61d24d50b.mp4
shrewd zealot
#

Yep ran it and video plays back without the over saturation

odd edge
#

Nice! Could you try it with peak=100 and peak=400 as well? There’s a PR that makes some tone-mapping changes and it sets peak=100, so trying to gauge if that would work for your case

#

The jellyfin devs said that they got complaints about some videos not being bright enough with peak=1000, so they set it to peak=100

shrewd zealot
#

yeh the video after running the provided command is slightly dull, but it’s better than the over saturation.
trying peak=100 and peak=400 now

#

Between 100 and 400 I can’t really notice a difference. But definitely better than 1000

odd edge
#

Awesome, so #13785 should help with this

small spruceBOT
odd edge
#

Out of curiosity, could you also try changing hable to bt2390? It’s a newer algorithm and I think that’s what they default to

shrewd zealot
#

sure will try that now

shrewd zealot
#

I probably prefer bt2390 slightly over hable. The noticeable difference was that bt2390 was brighter, but was not overly bright to maintain the quality of the video. I don’t think bt2390 is part of the PR?

odd edge
#

Nope, that would be a separate PR

#

But glad to know you prefer it! I can add it after this one is merged

odd edge
#

Oh, you can also try adding either :tonemap_mode=lum or :tonemap_mode=itp. I think it uses itp by default but I’m not sure

shrewd zealot
#

to the untrained eye, there is no noticeable difference between those two modes.

odd edge
#

Yeah, the difference is subtle. lum is faster so that's what the PR is using

shrewd zealot
#

Thanks for the help. Glad to know this will be improved in a later release. For now I’ll keep hw decoding disabled. Let me know if there is anything else to test. Happy to help 👍