rigaya / QSVEnc

QSVによる高速エンコードの性能実験
http://rigaya34589.blog135.fc2.com/blog-category-10.html
Other
328 stars 31 forks source link

Issue with --dolby-vision-rpu copy behavior in QSVEncC 7.73 #222

Open quamt opened 1 week ago

quamt commented 1 week ago

Description: I’ve encountered issues using the --dolby-vision-rpu copy feature in QSVEncC version 7.73 when attempting to copy Dolby Vision RPU metadata. The behaviour does not seem to align with the documentation.

Expected Behavior: When using --dolby-vision-rpu copyon a Dolby Vision Profile 7 input file:

The output should automatically convert to Dolby Vision Profile 8, as described in version 7.71 using libdovi. MediaInfo should reflect Dolby Vision Profile 8 information without additional options.

Observed Behavior: Without specifying --dolby-vision-profile:

The output only includes HDR10 info, not Dolby Vision. MediaInfo shows:

Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L6@High
HDR format                               : SMPTE ST 2086, HDR10 compatible

Adding --dolby-vision-profile 8.1:

Dolby Vision Profile 8.1 metadata is correctly included.

MediaInfo reflects:

Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L6@High
HDR format                               : Dolby Vision, Version 1.0, Profile 8.1, dvhe.08.06, BL+RPU, no metadata compression, HDR10 compatible / SMPTE ST 2086, Version HDR10, HDR10 compatible

Specifying an invalid profile (e.g., 7):

The output shows:

Dynamic HDR10  copy
dovi profile   (null)
dovi rpu       copy

MediaInfo reflects:

Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L6@High
HDR format                               : Dolby Vision, Version 1.0, Profile 8.1, dvhe.08.06, BL+RPU, no metadata compression, HDR10 compatible / SMPTE ST 2086, Version HDR10, HDR10 compatible

CQP Mode with --dolby-vision-profile 8.1:

Errors with:

Please use Bitrate Mode - CBR/Bitrate Mode - VBR/Bitrate Mode - AVBR/VCM (Video Conference Mode)/Quality VBR bitrate mode for dolby vision output.

However, specifying Profile 7 works without error (even though Profile 7 shouldn’t be valid here).

System Details: QSVEnc Version: QSVEncC (x64) 7.73 (r3500) by rigaya, Nov 12 2024 OS: Windows 11 x64 (22631) [UTF-8] CPU Info: 13th Gen Intel Core i5-13600 [4.89GHz] (6P+8E,14C/20T) GPU Info: Intel Arc A770 Graphics (512EU) 300-2400MHz (32.0.101.6130) Media SDK: QuickSyncVideo (hardware encoder) FF, 1st GPU(d), API v2.13

Steps to Reproduce: Use a Dolby Vision Profile 7 input file.

Run QSVEnc with the following commands:

--avhw
--codec hevc
--profile main10
--cqp 34:34:36
--vbv-bufsize 12000
--i-adapt
--b-adapt
--scenario-info archive
--open-gop
--ref 8
--bframes 16
--output-depth 10
--pic-struct
--hevc-gpb
--vpp-deband
--audio-copy
--chapter-copy
--colorrange auto
--colormatrix auto
--colorprim auto
--transfer auto
--chromaloc auto
--max-cll copy
--master-display copy
--audio-copy
--sub-copy
--atc-sei auto
--dhdr10-info copy
--dolby-vision-rpu copy

Check the output file with MediaInfo. Add --dolby-vision-profile 8.1 and observe changes.

Test with invalid profiles (e.g., --dolby-vision-profile 7) and note the behaviour.

Attempt CQP mode with Profile 8.1 and observe the error.

Request for Guidance: Is the observed behavior a bug or an intentional change in version 7.73?

If intentional, what is the correct way to copy Dolby Vision RPU while preserving Dolby Vision Profile 8 metadata?

Can support for CQP mode with Dolby Vision Profile 8.1 be clarified or implemented?

Thank you so much for your help.

rigaya commented 1 week ago

Actually, the behaviour you have got without --dolby-vision-profile is as expected.

It is strongly recommended to use both --dolby-vision-rpu and --dolby-vision-profile with proper value for full dolby vision handling.

The --dolby-vision-rpu option and --dolby-vision-profile is a seperate option and the effect and target (where the data is inserted) of these is different, and using only one does not complete the dolby vision handling.

Overall, both --dolby-vision-rpu and --dolby-vision-profile are recommended to get full dolby vision output.


However, there seems to be some bugs and place for improvement as you have reported, I'll look forward to fix or improve them.

However, specifying Profile 7 works without error (even though Profile 7 shouldn’t be valid here).

Thank you for reporting this, --dolby-vision-profile 7 should not work, seems to be wrong error handling. I'll have a fix there.

Can support for CQP mode with Dolby Vision Profile 8.1 be clarified or implemented?

I think I'll remove limitation for this.

quamt commented 1 week ago

@rigaya Thank you for the clarification and for explaining the functionality of --dolby-vision-rpu and --dolby-vision-profile.

Thank you also for looking into it for improvement, including the incorrect handling of --dolby-vision-profile 7 and the CQP mode limitation. I appreciate your dedication to refining the tool.

QSVEncC options list info: Would it be possible to include a note in the QSVEncC options list or documentation indicating that it’s strongly recommended to use both --dolby-vision-rpuand --dolby-vision-profile together for complete Dolby Vision handling? This would help avoid confusion for users trying to achieve proper Dolby Vision output without knowing how these options interact.

Thank you once again for your efforts in considering improvements to QSVEncC! Your commitment to enhancing the tool is highly valued by the community.😊

quamt commented 1 week ago

@rigaya

Additional Question: If I crop the original video and use --dolby-vision-rpu copy, is there anything specific I need to know? Does QSVEnc handle cropping and ensure the RPU metadata remains appropriately aligned with the cropped video, or do I need to make adjustments to maintain Dolby Vision integrity manually?

rigaya commented 1 week ago

Would it be possible to include a note in the QSVEncC options list or documentation indicating that it’s strongly recommended to use both --dolby-vision-rpu and --dolby-vision-profile together for complete Dolby Vision handling?

I think we already have it on the docs on each paramters that the other option is recommended to be used.

Does QSVEnc handle cropping and ensure the RPU metadata remains appropriately aligned with the cropped video, or do I need to make adjustments to maintain Dolby Vision integrity manually?

--dolby-vision-rpu copy is basically no more than copying other than the profile conversion. Therefore, adjustments for cropping will be needed manually. (extract → edit → import by --dolby-vision-rpu)

quamt commented 1 week ago

@rigaya Thank you for the information provided.

rigaya commented 1 week ago

I'm quite unsure what adjustments are needed when cropping is done.

If what is needed is --crop in dovi_tool, it might be possible to add option to pass "active area offset" value to libdovi used internally in QSVEnc. (libdovi provides C API dovi_rpu_set_active_area_offsets)

quamt commented 1 week ago

I'm quite unsure what adjustments are needed when cropping is done.

If what is needed is --crop in dovi_tool, it might be possible to add option to pass "active area offset" value to libdovi used internally in QSVEnc. (libdovi provides C API dovi_rpu_set_active_area_offsets)

I found this on the dovi tool github https://github.com/quietvoid/dovi_tool/issues/281

And here on doom 9 https://forum.doom9.org/showpost.php?p=1951422&postcount=33

rigaya commented 3 days ago

QSVEnc 7.74 will remove limitation of rate control mode, and add option to set active area offsets to 0 for cropping.

quamt commented 3 days ago

QSVEnc 7.74 will remove limitation of rate control mode, and add option to set active area offsets to 0 for cropping.

Thank you very much 😊 I will report back.

quamt commented 20 hours ago

@rigaya I tested it with latest version 7.75 and works fine, the issue are gone and CQP works.

I want to ask: What are the limitations of --dolby-vision-profile ? For example when the input is profile 5 it wont convert to any other profile? Test file https://kodi.wiki/view/Samples Dolby Vision Mystery Box (Profile 5)

Mediainfo original input file: HDR format : Dolby Vision, Version 1.0, Profile 5, dvhe.05.09, BL+RPU, no metadata compression

cmd shows:

Dynamic HDR10  copy
dovi profile   8.1
dovi rpu       copy

Mediinfo output file: HDR format : Dolby Vision, Version 1.0, Profile 5, dvhe.05.09, BL+RPU, no metadata compression

Why I'm asking is because on the dovi page its mentioned that it converts profile 5 to 8.1. I wanted to clarify.