NVENC h265 ads extra lines of vert resolution

Discuss encoding for devices and presets.
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
Marcin
Posts: 2
Joined: Fri Jul 10, 2020 4:34 pm

NVENC h265 ads extra lines of vert resolution

Post by Marcin »

Description of problem or question:
When converting using H265 NVENC output file has wrong (extra lines added) vertical resolution for 720p it is 736 and big black bar is showing under, for 1080p is 1088 (and bar is not visible).
I'm using PotPlayer currently v. 200216 (1.7.21239) with madVR 0.92.17 as my main/preferred player.
This extra dimensions will NOT show everywhere: Windows will report them in file properties and it will show in PotPlayer.
But if opened in HandBrake itself for example it will show up as 720. Nowhere in the log 736 is mentioned.
When opened in VLC it will show video resolution as 1280x720 but buffer dimensions 1280x736. Tried googling what buffer dimensions is, but still unsure: something with alignment of the video.
MediaInfo will show resolution as 720p, but in advanced mode will show value Stored_Height of 736, which according to https://forum.doom9.org/showthread.php? ... ost1854323 is the actual video resolution. That supposed to be auto-corrected, so possibly PotPlayer is not doing best job here, but still, I would like this lines gone if possible.

The problem does not exist for software h265, so it is not format problem, nor in NVENC h264.

Tested on various source files, formats and various settings (especially anamorphic options) no luck finding any setting that will affect outcome.
Problem persist for few months already, so few versions of HandBrake and driver versions.

HandBrake version
1.3.3 (2020061300)


Operating system and version
Windows 10 Pro 1909


HandBrake Activity Log

Code: Select all

HandBrake 1.3.3 (2020061300)
OS: Microsoft Windows NT 10.0.18363.0
CPU: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Ram: 16311 MB, 
GPU Information:
  NVIDIA GeForce RTX 2080 Ti - 27.21.14.5167
Screen: 1920x1080
Temp Dir: C:\Users\brigh\AppData\Local\Temp\
Install Dir: C:\Program Files\HandBrake
Data Dir: C:\Users\brigh\AppData\Roaming\HandBrake

-------------------------------------------


# Starting Encode ...

[06:06:30] base preset: 720p x265 NVENC 2000 slow AAC
[18:06:30] hb_init: starting libhb thread
[18:06:30] Starting work at: Fri Jul 10 18:06:30 2020
[18:06:30] 1 job(s) to process
[18:06:30] json job:
{
  "Audio": {
    "AudioList": [
      {
        "DRC": 0.0,
        "Encoder": "copy:aac",
        "Gain": 0.0,
        "Mixdown": -1,
        "NormalizeMixLevel": false,
        "Samplerate": 0,
        "Track": 0,
        "DitherMethod": 0
      }
    ],
    "CopyMask": [
      "copy:aac",
      "copy:flac",
      "copy:mp3"
    ],
    "FallbackEncoder": "av_aac"
  },
  "Destination": {
    "ChapterList": [
      {
        "Name": "Chapter 1"
      }
    ],
    "ChapterMarkers": true,
    "AlignAVStart": true,
    "File": "E:\\20200710_180056-1 x265.mp4",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": true
    },
    "Mux": "av_mp4"
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 4,
        "Settings": {
          "mode": "7"
        }
      },
      {
        "ID": 3,
        "Settings": {
          "block-height": "16",
          "block-thresh": "40",
          "block-width": "16",
          "filter-mode": "2",
          "mode": "3",
          "motion-thresh": "1",
          "spatial-metric": "2",
          "spatial-thresh": "1"
        }
      },
      {
        "ID": 12,
        "Settings": {
          "crop-bottom": "0",
          "crop-left": "0",
          "crop-right": "0",
          "crop-top": "0",
          "height": "720",
          "width": "1280"
        }
      },
      {
        "ID": 6,
        "Settings": {
          "mode": "1"
        }
      }
    ]
  },
  "PAR": {
    "Num": 1,
    "Den": 1
  },
  "Metadata": {},
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 1
    },
    "Title": 1,
    "Path": "E:\\20200710_180056.mp4"
  },
  "Subtitle": {
    "Search": {
      "Burn": true,
      "Default": false,
      "Enable": true,
      "Forced": true
    },
    "SubtitleList": []
  },
  "Video": {
    "Encoder": "nvenc_h265",
    "Level": "auto",
    "Bitrate": 2000,
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Options": "",
    "Preset": "slow",
    "Profile": "auto",
    "QSV": {
      "Decode": false,
      "AsyncDepth": 0
    }
  }
}
[18:06:30] CPU: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
[18:06:30]  - Intel microarchitecture Kaby Lake
[18:06:30]  - logical processor count: 12
[18:06:30] Intel Quick Sync Video support: no
[18:06:30] hb_scan: path=E:\20200710_180056.mp4, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:323: failed opening UDF image E:\20200710_180056.mp4
src/libbluray/disc/disc.c:424: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:424: error opening file BDMV\BACKUP\index.bdmv
src/libbluray/bluray.c:2585: nav_get_title_list(E:\20200710_180056.mp4\) failed
[18:06:30] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[18:06:30] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'E:\20200710_180056.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2020-07-10T16:01:01.000000Z
    location        : +50.0268+021.9985/
    location-eng    : +50.0268+021.9985/
    com.android.version: 9
  Duration: 00:00:03.10, start: 0.000000, bitrate: 12617 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 12358 kb/s, SAR 1:1 DAR 16:9, 30.02 fps, 30 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2020-07-10T16:01:01.000000Z
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 255 kb/s (default)
    Metadata:
      creation_time   : 2020-07-10T16:01:01.000000Z
      handler_name    : SoundHandle
[18:06:30] scan: decoding previews for title 1
[18:06:30] scan: audio 0x1: aac, rate=48000Hz, bitrate=255846 English (AAC LC) (2.0 ch) (255 kbps)
[18:06:31] scan: 10 previews, 1280x720, 30.024 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[18:06:31] scan: supported video decoders: avcodec qsv
[18:06:31] libhb: scan thread found 1 valid title(s)
[18:06:31] Skipping subtitle scan.  No suitable subtitle tracks.
[18:06:31] Starting Task: Encoding Pass
[18:06:31] Skipping crop/scale filter
[18:06:31] work: only 1 chapter, disabling chapter markers
[18:06:31] job configuration:
[18:06:31]  * source
[18:06:31]    + E:\20200710_180056.mp4
[18:06:31]    + title 1, chapter(s) 1 to 1
[18:06:31]    + container: mov,mp4,m4a,3gp,3g2,mj2
[18:06:31]    + data rate: 12617 kbps
[18:06:31]  * destination
[18:06:31]    + E:\20200710_180056-1 x265.mp4
[18:06:31]    + container: MPEG-4 (libavformat)
[18:06:31]      + optimized for HTTP streaming (fast start)
[18:06:31]      + align initial A/V stream timestamps
[18:06:31]  * video track
[18:06:31]    + decoder: h264
[18:06:31]      + bitrate 12358 kbps
[18:06:31]    + filters
[18:06:31]      + Comb Detect (mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:block-thresh=40:block-width=16:block-height=16)
[18:06:31]      + Decomb (mode=39)
[18:06:31]      + Framerate Shaper (mode=1)
[18:06:31]        + frame rate: 30.024 fps -> constant 30.024 fps
[18:06:31]    + Output geometry
[18:06:31]      + storage dimensions: 1280 x 720
[18:06:31]      + pixel aspect ratio: 1 : 1
[18:06:31]      + display dimensions: 1280 x 720
[18:06:31]    + encoder: H.265 (NVEnc)
[18:06:31]      + preset:  slow
[18:06:31]      + profile: auto
[18:06:31]      + level:   auto
[18:06:31]      + bitrate: 2000 kbps, pass: 0
[18:06:31]      + color profile: 1-1-1
[18:06:31]  * audio track 1
[18:06:31]    + decoder: English (AAC LC) (2.0 ch) (255 kbps) (track 1, id 0x1)
[18:06:31]      + bitrate: 255 kbps, samplerate: 48000 Hz
[18:06:31]    + AAC Passthru
[18:06:31] sync: expecting 93 video frames
[18:06:31] encavcodecInit: H.265 (Nvidia NVENC)
[18:06:31] encavcodec: truncating framerate 9000000 / 299759
[18:06:31] encavcodec: encoding at rc=cbr_hq Bitrate 2000
[18:06:31] encavcodec: encoding with stored aspect 1/1
[18:06:31] sync: first pts video is 0
[18:06:31] sync: "Chapter 1" (1) at frame 1 time 0
[18:06:31] sync: first pts audio 0x1 is 0
[18:06:31] reader: done. 1 scr changes
[18:06:31] work: average encoding speed for job is 0.000000 fps
[18:06:31] comb detect: heavy 0 | light 0 | uncombed 93 | total 93
[18:06:31] decomb: deinterlaced 0 | blended 0 | unfiltered 93 | total 93
[18:06:31] vfr: 93 frames output, 0 dropped and 0 duped for CFR/PFR
[18:06:31] vfr: lost time: 0 (0 frames)
[18:06:31] vfr: gained time: 0 (0 frames) (0 not accounted for)
[18:06:31] aac-decoder done: 144 frames, 0 decoder errors
[18:06:31] h264-decoder done: 93 frames, 0 decoder errors
[18:06:32] sync: got 93 frames, 93 expected
[18:06:32] sync: framerate min 30.024 fps, max 30.024 fps, avg 30.024 fps
[18:06:32] mux: track 0, 93 frames, 844795 bytes, 2181.87 kbps, fifo 128
[18:06:32] mux: track 1, 144 frames, 98305 bytes, 253.89 kbps, fifo 256
[18:06:32] Finished work at: Fri Jul 10 18:06:32 2020
[18:06:32] libhb: work result = 0

# Encode Completed ...
Deleted User 11865

Re: NVENC h265 ads extra lines of vert resolution

Post by Deleted User 11865 »

Video dimensions ("buffer size" here) always need to be aligned to the block size (16x16 for H.264, 16x16, 32x32 or 64x64 for HEVC depending on settings), but those extra pixels aren't displayed by the player (the visible area is specified in the bitstream metadata). It's a PotPlayer bug.
Marcin
Posts: 2
Joined: Fri Jul 10, 2020 4:34 pm

Re: NVENC h265 ads extra lines of vert resolution

Post by Marcin »

Thanks for the reply.
720 can be divided by 16, but not by 32 or 64, as i have written I tried changing anamorphic settings, but no luck there (or am I looking in the wrong place?). 16x16 HEVC is doable as evidenced by software encoder keeping right resolution. Is 32 a hardware/driver requirement for NVENC h265 that cannot be changed/forced?

I'll send bug report to PotPlayer, but I Imagine it might not be only player that might have this issue and if solving problem is not possible for NVENC, I probably will have to go software h265 route, which will take much, much longer.
I really do like results of NVENC, and for 1080p they work great, just 720p gives me problems, ughh..
Deleted User 11865

Re: NVENC h265 ads extra lines of vert resolution

Post by Deleted User 11865 »

I'm not familiar enough with NVENC to determine which settings would give you a 16x16 CTU (not even sure it is possible).
Post Reply