VidCoder icon indicating copy to clipboard operation
VidCoder copied to clipboard

H.265 10-bit (NVEnc) does not properly use the set Avg. Bitrate.

Open Milincho opened this issue 1 year ago • 12 comments
trafficstars

Problem Description

H.265 10-bit (NVEnc) does not properly use the set Avg. Bitrate.

With the same 8000kbps Avg. Bitrate setting it produces a file with 2600kbps: image

while H.265 (NVEnc) works properly:

image

What version of VidCoder are you running?

10.9 Beta VelopackInstaller

Encode Log

No response

Milincho avatar Jun 06 '24 18:06 Milincho

Can you post an encode log? I want to see if the right bitrate is getting passed to the HandBrake core library.

RandomEngy avatar Jun 07 '24 05:06 RandomEngy

With H.265 10-bit (NVEnc): image

This is the result: image

and this is the log: VC [17:52:18] VidCoder 10.9 Beta VC [17:52:18] Starting job 1/1 VC [17:52:18] Source path: W:\Gdrive\Video\Frame Interpolation Tests\Planet Earth III S01E01 2160p MEMC test.mkv VC [17:52:18] Destination path: E:\Video\Planet Earth III S01E01 2160p MEMC test.mkv VC [17:52:18] Title: 1 VC [17:52:18] Range: All VC [17:52:18] Preset: Bombadil AI Remasters VC [17:52:18] Picker: Custom VC [17:52:18] Worker ready: Pipe 'VidCoderWorker.d28ae19e-74df-4c6c-ba8a-e93df8903536' is open VC [17:52:18] Connecting to process 32432 on pipe VidCoderWorker.d28ae19e-74df-4c6c-ba8a-e93df8903536 HB :52:18] hb_init: starting libhb thread [17:52:18] CPU: AMD Ryzen 9 3900X 12-Core Processor [17:52:18] - logical processor count: 24 [17:52:18] Intel Quick Sync Video support: no [17:52:18] hb_scan: path=W:\Gdrive\Video\Frame Interpolation Tests\Planet Earth III S01E01 2160p MEMC test.mkv, title_index=1 HB [17:52:18] scan: decoding previews for title 1 HB [17:52:24] using container PAR 1:1 [17:52:24] scan: 10 previews, 3840x2160, 25.000 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1, color profile: 9-18-9, chroma location: topleft [17:52:24] libhb: scan thread found 1 valid title(s) HB [17:52:24] Starting work at: Fri Jun 07 17:52:24 2024 [17:52:24] 1 job(s) to process [17:52:24] json job: { "Audio": { "AudioList": [], "CopyMask": [ "copy:aac", "copy:ac3", "copy:eac3", "copy:truehd", "copy:dts", "copy:dtshd", "copy:mp2", "copy:mp3", "copy:flac", "copy:opus" ] }, "Destination": { "ChapterList": [], "ChapterMarkers": false, "AlignAVStart": false, "File": "E:\Video\Planet Earth III S01E01 2160p MEMC test.part.mkv", "Options": { "IpodAtom": false, "Optimize": true }, "Mux": "av_mkv" }, "Filters": { "FilterList": [ { "ID": 20, "Settings": { "crop-bottom": "0", "crop-left": "0", "crop-right": "0", "crop-top": "0", "height": "1080", "width": "1920" } } ] }, "PAR": { "Num": 1, "Den": 1 }, "Metadata": {}, "SequenceID": 0, "Source": { "Angle": 1, "Range": { "Type": "chapter", "Start": 1, "End": 1 }, "Title": 1, "Path": "W:\Gdrive\Video\Frame Interpolation Tests\Planet Earth III S01E01 2160p MEMC test.mkv", "HWDecode": 0 }, "Subtitle": { "Search": { "Burn": false, "Default": false, "Enable": false, "Forced": false }, "SubtitleList": [] }, "Video": { "Encoder": "nvenc_h265_10bit", "Level": "auto", "Bitrate": 8000, "MultiPass": false, "Turbo": false, "ColorMatrixCode": 0, "Options": "", "Preset": "slowest", "Profile": "auto", "Tune": "fastdecode", "QSV": { "Decode": false }, "HardwareDecode": 4 } } [17:52:24] Starting Task: Encoding Pass [17:52:24] job configuration: [17:52:24] * source [17:52:24] + W:\Gdrive\Video\Frame Interpolation Tests\Planet Earth III S01E01 2160p MEMC test.mkv [17:52:24] + title 1, chapter(s) 1 to 1 [17:52:24] + container: matroska,webm [17:52:24] + data rate: 19010 kbps [17:52:24] * destination [17:52:24] + E:\Video\Planet Earth III S01E01 2160p MEMC test.part.mkv [17:52:24] + container: Matroska (libavformat) [17:52:24] * video track [17:52:24] + decoder: hevc 10-bit (yuv420p10le) [17:52:24] + filters [17:52:24] + Crop and Scale (width=1920:height=1080:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0) [17:52:24] + source: 3840 * 2160, crop (0/0/0/0): 3840 * 2160, scale: 1920 * 1080 [17:52:24] + Format (format=p010le) [17:52:24] + Output geometry [17:52:24] + storage dimensions: 1920 x 1080 [17:52:24] + pixel aspect ratio: 1 : 1 [17:52:24] + display dimensions: 1920 x 1080 [17:52:24] + encoder: H.265 10-bit (NVEnc) [17:52:24] + preset: slowest [17:52:24] + profile: auto [17:52:24] + level: auto [17:52:24] + bitrate: 8000 kbps, pass: 0 [17:52:24] + color profile: 9-18-9 [17:52:24] + color range: tv [17:52:24] + chroma location: topleft HB [17:52:24] sync: expecting 777 video frames [17:52:24] encavcodecInit: H.265 (Nvidia NVENC) [17:52:24] encavcodec: encoding at rc=vbr, Bitrate 8000 [17:52:24] encavcodec: encoding with stored aspect 1/1 HB [17:52:24] sync: first pts video is 0 [17:52:24] sync: Chapter 1 at frame 1 time 0 HB [17:52:31] reader: done. 1 scr changes HB [17:52:31] work: average encoding speed for job is 117.422989 fps HB [17:52:31] hevc-decoder done: 770 frames, 0 decoder errors [17:52:31] sync: got 770 frames, 777 expected [17:52:31] sync: framerate min 4.167 fps, max 25.000 fps, avg 24.839 fps HB [17:52:32] mux: track 0, 770 frames, 17396802 bytes, 4483.71 kbps, fifo 1024 [17:52:32] Finished work at: Fri Jun 07 17:52:32 2024 [17:52:32] libhb: work result = 0 VC [17:52:32] Job completed (Elapsed Time: 13s)

Same exact settings but no 10 bit, with H.265 (NVEnc): image

And this is the log: VC [17:54:46] VidCoder 10.9 Beta VC [17:54:46] Starting job 1/1 VC [17:54:46] Source path: W:\Gdrive\Video\Frame Interpolation Tests\Planet Earth III S01E01 2160p MEMC test.mkv VC [17:54:46] Destination path: E:\Video\Planet Earth III S01E01 2160p MEMC test.mkv VC [17:54:46] Title: 1 VC [17:54:46] Range: All VC [17:54:46] Preset: Bombadil AI Remasters VC [17:54:46] Picker: Custom VC [17:54:47] Worker ready: Pipe 'VidCoderWorker.a7137bbf-d73c-42f9-9630-ab438be782e7' is open VC [17:54:47] Connecting to process 7652 on pipe VidCoderWorker.a7137bbf-d73c-42f9-9630-ab438be782e7 HB 7:54:47] hb_init: starting libhb thread [17:54:47] CPU: AMD Ryzen 9 3900X 12-Core Processor [17:54:47] - logical processor count: 24 [17:54:47] Intel Quick Sync Video support: no [17:54:47] hb_scan: path=W:\Gdrive\Video\Frame Interpolation Tests\Planet Earth III S01E01 2160p MEMC test.mkv, title_index=1 HB [17:54:47] scan: decoding previews for title 1 HB [17:54:52] using container PAR 1:1 [17:54:52] scan: 10 previews, 3840x2160, 25.000 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1, color profile: 9-18-9, chroma location: topleft [17:54:52] libhb: scan thread found 1 valid title(s) HB [17:54:53] Starting work at: Fri Jun 07 17:54:53 2024 [17:54:53] 1 job(s) to process [17:54:53] json job: { "Audio": { "AudioList": [], "CopyMask": [ "copy:aac", "copy:ac3", "copy:eac3", "copy:truehd", "copy:dts", "copy:dtshd", "copy:mp2", "copy:mp3", "copy:flac", "copy:opus" ] }, "Destination": { "ChapterList": [], "ChapterMarkers": false, "AlignAVStart": false, "File": "E:\Video\Planet Earth III S01E01 2160p MEMC test.part.mkv", "Options": { "IpodAtom": false, "Optimize": true }, "Mux": "av_mkv" }, "Filters": { "FilterList": [ { "ID": 20, "Settings": { "crop-bottom": "0", "crop-left": "0", "crop-right": "0", "crop-top": "0", "height": "1080", "width": "1920" } } ] }, "PAR": { "Num": 1, "Den": 1 }, "Metadata": {}, "SequenceID": 0, "Source": { "Angle": 1, "Range": { "Type": "chapter", "Start": 1, "End": 1 }, "Title": 1, "Path": "W:\Gdrive\Video\Frame Interpolation Tests\Planet Earth III S01E01 2160p MEMC test.mkv", "HWDecode": 0 }, "Subtitle": { "Search": { "Burn": false, "Default": false, "Enable": false, "Forced": false }, "SubtitleList": [] }, "Video": { "Encoder": "nvenc_h265", "Level": "auto", "Bitrate": 8000, "MultiPass": false, "Turbo": false, "ColorMatrixCode": 0, "Options": "", "Preset": "slowest", "Profile": "auto", "Tune": "fastdecode", "QSV": { "Decode": false }, "HardwareDecode": 4 } } [17:54:53] Starting Task: Encoding Pass [17:54:53] job configuration: [17:54:53] * source [17:54:53] + W:\Gdrive\Video\Frame Interpolation Tests\Planet Earth III S01E01 2160p MEMC test.mkv [17:54:53] + title 1, chapter(s) 1 to 1 [17:54:53] + container: matroska,webm [17:54:53] + data rate: 19010 kbps [17:54:53] * destination [17:54:53] + E:\Video\Planet Earth III S01E01 2160p MEMC test.part.mkv [17:54:53] + container: Matroska (libavformat) [17:54:53] * video track [17:54:53] + decoder: hevc 10-bit (yuv420p10le) [17:54:53] + filters [17:54:53] + Crop and Scale (width=1920:height=1080:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0) [17:54:53] + source: 3840 * 2160, crop (0/0/0/0): 3840 * 2160, scale: 1920 * 1080 [17:54:53] + Format (format=yuv420p) [17:54:53] + Output geometry [17:54:53] + storage dimensions: 1920 x 1080 [17:54:53] + pixel aspect ratio: 1 : 1 [17:54:53] + display dimensions: 1920 x 1080 [17:54:53] + encoder: H.265 (NVEnc) [17:54:53] + preset: slowest [17:54:53] + profile: auto [17:54:53] + level: auto [17:54:53] + bitrate: 8000 kbps, pass: 0 [17:54:53] + color profile: 9-18-9 [17:54:53] + color range: tv [17:54:53] + chroma location: topleft HB [17:54:53] sync: expecting 777 video frames [17:54:53] encavcodecInit: H.265 (Nvidia NVENC) [17:54:53] encavcodec: encoding at rc=vbr, Bitrate 8000 [17:54:53] encavcodec: encoding with stored aspect 1/1 HB [17:54:53] sync: first pts video is 0 [17:54:53] sync: Chapter 1 at frame 1 time 0 HB [17:54:59] reader: done. 1 scr changes HB [17:54:59] work: average encoding speed for job is 132.764435 fps HB [17:55:00] hevc-decoder done: 770 frames, 0 decoder errors [17:55:00] sync: got 770 frames, 777 expected [17:55:00] sync: framerate min 4.167 fps, max 25.000 fps, avg 24.839 fps HB [17:55:00] mux: track 0, 770 frames, 28134825 bytes, 7251.24 kbps, fifo 512 [17:55:00] Finished work at: Fri Jun 07 17:55:00 2024 [17:55:00] libhb: work result = 0 VC [17:55:00] Job completed (Elapsed Time: 13s)

Milincho avatar Jun 07 '24 16:06 Milincho

It looks like the VidCoder UI is passing the bitrate correctly into the HandBrake core. If you can reproduce with HandBrake, they can help.

Equivalent versions: VidCoder Stable ↔ HandBrake Stable VidCoder Beta ↔ HandBrake Nightly

RandomEngy avatar Jun 10 '24 05:06 RandomEngy

I don't use Handbrake, I use VidCoder. If VidCoder uses Handbrake... shouldn't be you telling them about the issue?

Milincho avatar Jun 10 '24 16:06 Milincho

HandBrake doesn't have this issue. I'm switching to HandBrake from now on. Thanks anyway.

Milincho avatar Jun 11 '24 16:06 Milincho

I ask to reproduce with HandBrake as it can help narrow down the issue. When it works on HandBrake, sometimes the difference is caused by other encoding parameters being different, and sometimes there's a bug in VidCoder I can fix. If you like, we can continue to diagnose the issue by supplying a video sample or encoding log on HandBrake, or if you're happy just not using VidCoder, that's fine too.

RandomEngy avatar Jun 12 '24 21:06 RandomEngy

The "they can help." you wrote sounded to me like "Not my problem. Check with HandBrake guys"... while I never used HandBrake to start with, and in the end is not even a HandBrake issue...

Have you tested the issue yourself? Is there anything preventing you from doing so?

Milincho avatar Jun 12 '24 22:06 Milincho

Yeah I did. I ended up with the same file size for both H.265 NVEnc 10-bit and H.265 NVEnc. So I can't reproduce the issue to narrow it down. A video sample would help me, if you can supply it. What tool are you using to check video bitrate directly, MediaInfo?

RandomEngy avatar Jun 13 '24 02:06 RandomEngy

It happens with any file, with the exact same preset, just changing 8 bits to 10 bits, and this doesn't happen in HandBrake: image Here's this test file: https://drive.google.com/file/d/1m-haEIT0TrsAnIYljRtRKSToQ347mtgU/view?usp=sharing

Media Info, Windows Properties info and the file size itself set them apart.

Tried in 2 different machines.

Milincho avatar Jun 13 '24 03:06 Milincho

Thanks. It's really odd, I try with that same file and it produces nearly identical file sizes, and I tried to get the encoding settings exactly the same. Can you try with the encoding presets I came up with?

https://drive.google.com/open?id=1z-RZAuKBDlw42tuSYewDvd3NzubWvV1L&usp=drive_fs https://drive.google.com/open?id=1zDfvuLeyJmB-vqS_gYIgIwkObAvx4drY&usp=drive_fs

With these presets on the sample file you gave me, I don't get exactly the 8000 kbps that I specified, but the resulting bitrate is similar for both output files.

If you can't repro with my preset, can you export the encoding preset you're using?

RandomEngy avatar Jun 15 '24 03:06 RandomEngy

I am having this exact issue. The bitrate falls back to a previous setting. For example, I used a preset today that had a bitrate of 2700. I then changed it to 10,000, but every encode since then comes out as 2,777 or 2,785. It simply will not accept any changes. I had not used Handbrake in years, so I downloaded it, set an avg bitrate of 10,000 and got an output file with a bitrate of 2,785, the same number that Vidcoder has been outputting.

lkeels avatar Jun 19 '24 18:06 lkeels

It's likely an issue in the HandBrake core that VidCoder uses. If you report the issue to them, they can fix and I can pick up the update in VidCoder.

RandomEngy avatar Jun 24 '24 02:06 RandomEngy

It seems it was an issue of Nvidia themselves, which they fixed in the new 560.70 drivers:

[NVENC] Quality and bitrate settings are ignored at 10-bit encoding [4697900]

Milincho avatar Jul 16 '24 15:07 Milincho