rigaya / NVEnc

NVENCによる高速エンコードの性能実験
https://rigaya34589.blog.fc2.com/blog-category-17.html
Other
1.09k stars 114 forks source link

Failing When Using --dhdr10-info copy With Either --avsw or --avhw #604

Closed AYColumbia closed 3 months ago

AYColumbia commented 4 months ago

The encoder started failing when using --dhdr10-info copy recently. After that, I used the HDR tool to extract the HDR metadata info and using it does work, i.e., --dhdr10-info "md.json".

Here's the version I'm using:

NVEncC (x64) 7.57 (r2924) by rigaya, Jun 29 2024 14:09:42 (VC 1929/Win)
  [NVENC API v12.2, CUDA 10.1]

This is a sample of my typical encoding command. I did try encoding with both --avhw and --avsw and the results are below as both failed.

"NVEncC64.exe" --avsw --codec hevc --output-depth 10 --preset quality --vbr 3932 --vbr-quality 19 --qp-init 18
 --qp-min 14 --qp-max 36 --max-bitrate 10000 --crop 0,48,0,48 --vpp-pad 0,48,0,48   --gop-len 69 --lookahead 32
 --ref 4 --aq --vpp-pmd threshold=130.0 --vpp-deband range=4,thre=4,dither=31,rand_each_frame
 --dhdr10-info copy --pic-struct --fullrange
 --master-display "G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(10000000,1)"
 --videoformat ntsc  --colorprim bt2020 --transfer smpte2084 --colormatrix bt2020nc --max-cll "465,136"
 --frames 47877 --chromaloc 2 --colorrange limited  -i "input.mkv" -o "output.hevc"

using --avhw

avcuvid: failed to get header.
failed to initialize file reader(s).
Failed to open input file.

using --avsw

avsw: failed to get header.
failed to initialize file reader(s).
Failed to open input file.

Here's the mediainfo tool's Video info from the source in case it's needed:

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L5.1@Main
HDR format                               : Dolby Vision, Version 1.0, Profile 8.1, dvhe.08.06, BL+RPU, no metadata compression, HDR10 compatible / SMPTE ST 2094 App 4, Version HDR10+ Profile B, HDR10+ Profile B compatible
Codec ID                                 : V_MPEGH/ISO/HEVC
Duration                                 : 33 min 16 s
Bit rate                                 : 7 080 kb/s
Width                                    : 3 840 pixels
Height                                   : 2 160 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0 (Type 2)
Bit depth                                : 10 bits
Bits/(Pixel*Frame)                       : 0.036
Stream size                              : 1.65 GiB (95%)
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                 : PQ
Matrix coefficients                      : BT.2020 non-constant
Mastering display color primaries        : BT.2020
Mastering display luminance              : min: 0.0001 cd/m2, max: 1000 cd/m2
Maximum Content Light Level              : 465 cd/m2
Maximum Frame-Average Light Level        : 136 cd/m2

Please let me know if there is any other info you need to help diagnose this. Thanks a lot.

rigaya commented 4 months ago

The encoder started failing when using --dhdr10-info copy recently

You mean after update of encoder? (older version run fine?)

Unfortunately, I think it might be difficult to solve, as I don't have that kind of files which fails and cannot reproduce the issue. Further more, --dhdr10-info copy does not support Dolby Vision.

AYColumbia commented 4 months ago

The encoder started failing when using --dhdr10-info copy recently

You mean after update of encoder? (older version run fine?)

Unfortunately, I think it might be difficult to solve, as I don't have that kind of files which fails and cannot reproduce the issue. Further more, --dhdr10-info copy does not support Dolby Vision.

Yes, it used to work but am not sure when it broke as I haven't had to encode anything for a while and there have been several updates. I'll try with older versions and get back to you. It may be a few days though.

I can get you a small sample if I can get it to you privately so let me know the best way to do that please. Also, I don't care about DV as I'm only interested in keeping the HDR10/HDR10+ metadata so if your copy process doesn't do DV, I'm fine with that. :) Thank you.

AYColumbia commented 4 months ago

I tried with versions 7.49 and all 7.5x and all fail with the same errors.

rigaya commented 4 months ago

Thank you for the sample file send by e-mail.

I was able to find out what was happening at avcuvid: failed to get header.. I will check further to fix this.

AYColumbia commented 4 months ago

Thank you for the sample file send by e-mail.

I was able to find out what was happening at avcuvid: failed to get header.. I will check further to fix this.

Thanks a lot. Appreciate your efforts.

rigaya commented 3 months ago

Thank you for the sample file, I was able to fix the issue. Fix will be included in the next release.

Although I haven't got time to create a new release now, it is possible to have a test with the test build below. https://nightly.link/rigaya/NVEnc/actions/runs/10162329267/NVEncC_release_r2947_x64.zip

AYColumbia commented 3 months ago

That was fast. :) Thank you. I should have time tonight to test it. Looking forward to the next release. Thanks again

AYColumbia commented 3 months ago

I didn't get a chance to test it yesterday but did today. Worked great! :) I did see the warning at the start of encoding:

avcuvid: Failed to get header from extradata: 0 byte, retry checking first packet.
avcuvid: Got header from first packet: 101 byte.
Max B frames are 0 frames.
NVEncC (x64) 7.57 (r2947) by rigaya, Jul 30 2024 12:38:10 (VC 1929/Win)

Thank you very much. I didn't close the ticket as I figured you or I can after the fix is released.

rigaya commented 3 months ago

Thank you for confirming, I'll close the issue as the fix has been release with NVEnc 7.58.