How to Override video levels transform AVI to x264/x265

HandBrake for Windows support
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
musicvid
Veteran User
Posts: 3565
Joined: Sat Jun 27, 2009 1:19 am

How to Override video levels transform AVI to x264/x265

Post by musicvid »

Description of problem or question:

I've always appreciated the autoconvert of RGB [0,255] luminance to YUV [16,235] with AVI source. Today, I don't need it.
I'm now producing near-lossless AVI YUV Intermediates to use with long programs.
Believe it or not, UT 4:2:0 AVI is 98% smaller than Uncompressed (4:4:4), and comes in with a .989 SSIM and 36.9 PSNR, way good enough for anything I could compare visually.

Question: My UT 4:2:0 intermediate is already at [16,235] levels. How do I forego the second (redundant) levels transform in Handbrake? I also had some uncompressed RGB that I wanted to keep at [0,255] for some tests of x265 at matching luminance levels, and ran into the same problem. I don't know x265 params much at all, so any help will be valuable.



HandBrake Activity Log ***required*** (see How-to get an activity log)

Code: Select all

HandBrake 1.3.2 (2020050300)
OS: Microsoft Windows NT 10.0.18362.0
CPU: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
Ram: 8078 MB, 
GPU Information:
  Intel(R) UHD Graphics 620 - 24.20.100.6286
Screen: 1920x1080
Temp Dir: C:\Users\Mark\AppData\Local\Temp\
Install Dir: C:\Users\Mark\Downloads\HandBrake-1.3.2-x86_64-Win_GUI
Data Dir: C:\Users\Mark\AppData\Roaming\HandBrake

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


# Starting Encode ...

[03:56:49] base preset: Production Standard (Modified)
[15:56:49] hb_init: starting libhb thread
[15:56:49] Starting work at: Tue Jun 23 15:56:49 2020
[15:56:49] 1 job(s) to process
[15:56:49] json job:
{
  "Audio": {
    "AudioList": [
      {
        "Bitrate": 320,
        "DRC": 0.0,
        "Encoder": "av_aac",
        "Gain": 0.0,
        "Mixdown": 4,
        "NormalizeMixLevel": false,
        "Samplerate": 0,
        "Track": 0,
        "DitherMethod": 0
      }
    ],
    "CopyMask": [
      "copy:aac",
      "copy:ac3",
      "copy:dtshd",
      "copy:dts",
      "copy:eac3",
      "copy:flac",
      "copy:mp3",
      "copy:truehd"
    ],
    "FallbackEncoder": "ac3"
  },
  "Destination": {
    "ChapterList": [
      {
        "Name": "Chapter 1"
      }
    ],
    "ChapterMarkers": true,
    "AlignAVStart": false,
    "File": "C:\\Users\\Mark\\Desktop\\Bandgrad.Avi-8.m4v",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": false
    },
    "Mux": "av_mp4"
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 12,
        "Settings": {
          "crop-bottom": "0",
          "crop-left": "0",
          "crop-right": "0",
          "crop-top": "0",
          "height": "1080",
          "width": "1920"
        }
      },
      {
        "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": "C:\\Users\\Mark\\Desktop\\BandGrad.avi.avi"
  },
  "Subtitle": {
    "Search": {
      "Burn": false,
      "Default": false,
      "Enable": false,
      "Forced": false
    },
    "SubtitleList": []
  },
  "Video": {
    "Encoder": "x265",
    "Level": "auto",
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Options": "",
    "Preset": "fast",
    "Profile": "auto",
    "Quality": 10.0,
    "QSV": {
      "Decode": false,
      "AsyncDepth": 0
    }
  }
}
[15:56:49] CPU: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
[15:56:49]  - Intel microarchitecture Kaby Lake
[15:56:49]  - logical processor count: 8
[15:56:49] Intel Quick Sync Video support: yes
[15:56:49]  - Intel Media SDK hardware: API 1.27 (minimum: 1.3)
[15:56:49]  - H.264 encoder: yes
[15:56:49]     - preferred implementation: hardware (any) via D3D11
[15:56:49]     - capabilities (hardware):  breftype icq+la+i+downs vsinfo opt1 opt2+mbbrc+extbrc+trellis+ib_adapt+nmpslice
[15:56:49]  - H.265 encoder: yes (8bit: yes, 10bit: yes)
[15:56:49]     - preferred implementation: hardware (any) via D3D11
[15:56:49]     - capabilities (hardware):  bpyramid icq vsinfo opt1
[15:56:49] hb_scan: path=C:\Users\Mark\Desktop\BandGrad.avi.avi, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:323: failed opening UDF image C:\Users\Mark\Desktop\BandGrad.avi.avi
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(C:\Users\Mark\Desktop\BandGrad.avi.avi\) failed
[15:56:49] 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
[15:56:49] dvd: not a dvd - trying as a stream/file instead
Input #0, avi, from 'C:\Users\Mark\Desktop\BandGrad.avi.avi':
  Metadata:
    TCOD            : 0
    TCDO            : 50050000
  Duration: 00:00:05.01, start: 0.000000, bitrate: 797320 kb/s
    Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 1920x1080, 802151 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 2 channels, s16, 1536 kb/s
[15:56:49] scan: decoding previews for title 1
[15:56:49] scan: audio 0x1: pcm_s16le, rate=48000Hz, bitrate=1536000 Unknown (pcm_s16le) (2.0 ch) (1536 kbps)
[15:56:49] scan: 10 previews, 1920x1080, 23.976 fps, autocrop = 0/0/368/368, aspect 16:9, PAR 1:1
[15:56:49] libhb: scan thread found 1 valid title(s)
[15:56:49] Starting Task: Encoding Pass
[15:56:49] Skipping crop/scale filter
[15:56:49] work: only 1 chapter, disabling chapter markers
[15:56:49] job configuration:
[15:56:49]  * source
[15:56:49]    + C:\Users\Mark\Desktop\BandGrad.avi.avi
[15:56:49]    + title 1, chapter(s) 1 to 1
[15:56:49]    + container: avi
[15:56:49]    + data rate: 797320 kbps
[15:56:49]  * destination
[15:56:49]    + C:\Users\Mark\Desktop\Bandgrad.Avi-8.m4v
[15:56:49]    + container: MPEG-4 (libavformat)
[15:56:49]  * video track
[15:56:49]    + decoder: rawvideo
[15:56:49]      + bitrate 802151 kbps
[15:56:49]    + filter
[15:56:49]      + Framerate Shaper (mode=1)
[15:56:49]        + frame rate: 23.976 fps -> constant 23.976 fps
[15:56:49]    + Output geometry
[15:56:49]      + storage dimensions: 1920 x 1080
[15:56:49]      + pixel aspect ratio: 1 : 1
[15:56:49]      + display dimensions: 1920 x 1080
[15:56:49]    + encoder: H.265 (libx265)
[15:56:49]      + preset:  fast
[15:56:49]      + profile: auto
[15:56:49]      + level:   auto
[15:56:49]      + quality: 10.00 (RF)
[15:56:49]      + color profile: 1-1-1
[15:56:49]  * audio track 1
[15:56:49]    + decoder: Unknown (pcm_s16le) (2.0 ch) (1536 kbps) (track 1, id 0x1)
[15:56:49]      + bitrate: 1536 kbps, samplerate: 48000 Hz
[15:56:49]    + mixdown: Stereo
[15:56:49]    + dither: none
[15:56:49]    + encoder: AAC (libavcodec)
[15:56:49]      + bitrate: 320 kbps, samplerate: 48000 Hz
[15:56:49] sync: expecting 120 video frames
x265 [info]: HEVC encoder version 3.2.1+1-b5c86a64bbbe
x265 [info]: build info [Windows][GCC 9.2.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 8 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 3 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
x265 [info]: Keyframe min / max / scenecut / bias: 24 / 240 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 15 / 4 / 0
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-10.0 / 0.60
x265 [info]: tools: rd=2 psy-rd=2.00 rskip signhide tmvp fast-intra
x265 [info]: tools: strong-intra-smoothing lslices=6 deblock sao
[15:56:49] sync: first pts video is 0
[15:56:49] sync: "Chapter 1" (1) at frame 1 time 0
[15:56:49] sync: first pts audio 0x1 is 0
[15:56:50] reader: done. 1 scr changes
[15:56:53] work: average encoding speed for job is 0.000000 fps
[15:56:53] vfr: 120 frames output, 0 dropped and 0 duped for CFR/PFR
[15:56:53] vfr: lost time: 0 (0 frames)
[15:56:53] vfr: gained time: 0 (0 frames) (0 not accounted for)
[15:56:53] pcm_s16le-decoder done: 241 frames, 0 decoder errors
[15:56:53] rawvideo-decoder done: 120 frames, 0 decoder errors
[15:56:53] sync: got 120 frames, 120 expected
[15:56:53] sync: framerate min 23.976 fps, max 23.976 fps, avg 23.976 fps
x265 [info]: frame I:      1, Avg QP:5.60  kb/s: 11539.76
x265 [info]: frame P:     24, Avg QP:14.85  kb/s: 64.39
x265 [info]: frame B:     95, Avg QP:17.49  kb/s: 51.35
x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%
x265 [info]: consecutive B-frames: 4.0% 0.0% 0.0% 4.0% 92.0%
encoded 120 frames in 3.60s (33.33 fps), 149.69 kb/s, Avg QP:16.87
[15:56:53] mux: track 0, 120 frames, 94131 bytes, 149.22 kbps, fifo 128
[15:56:53] mux: track 1, 235 frames, 1427 bytes, 2.26 kbps, fifo 256
[15:56:53] Finished work at: Tue Jun 23 15:56:53 2020
[15:56:53] libhb: work result = 0

# Encode Completed ...



User avatar
BradleyS
Moderator
Posts: 1843
Joined: Thu Aug 09, 2007 12:16 pm

Re: How to Override video levels transform AVI to x264/x265

Post by BradleyS »

Make sure your source video has its range info defined, and use HandBrake 1.3.3 (prior versions had a couple bugs leading to possible double range conversion).

mduell
Veteran User
Posts: 7105
Joined: Sat Apr 21, 2007 8:54 pm

Re: How to Override video levels transform AVI to x264/x265

Post by mduell »

HB won't perform the range transformation when it's not necessary (other than some bugs in the past).

HB will not preserve RGB.

musicvid
Veteran User
Posts: 3565
Joined: Sat Jun 27, 2009 1:19 am

Re: How to Override video levels transform AVI to x264/x265

Post by musicvid »

BradleyS wrote:
Wed Jun 24, 2020 10:07 pm
Make sure your source video has its range info defined, and use HandBrake 1.3.3 (prior versions had a couple bugs leading to possible double range conversion).
Metadata is pretty spare in AVI, Handbrake is not reading "Color space : YUV ". What flag text would work in HB?
General
Complete name : C:\Users\Mark\Desktop\Bandind\Banding.avi
Format : AVI
Format/Info : Audio Video Interleave
File size : 50.9 MiB
Duration : 5 s 5 ms
Overall bit rate : 85.2 Mb/s
TCOD : 0
TCDO : 50050000

Video
ID : 0
Format : YUV
Codec ID : ULH0
Codec ID/Info : Ut Video Lossless Codec
Codec ID/Hint : Ut Video
Duration : 5 s 5 ms
Bit rate : 83.5 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Compression mode : Lossless
Bits/(Pixel*Frame) : 1.679
Stream size : 49.8 MiB (98%)

Audio
ID : 1
Format : PCM
Format settings : Little / Signed
Codec ID : 1
Duration : 5 s 5 ms
Bit rate mode : Constant
Bit rate : 1 536 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Bit depth : 16 bits
Stream size : 938 KiB (2%)
Alignment : Aligned on interleaves
Interleave, duration : 238 ms (5.71 video frames)
Interleave, preload duration : 250 ms

Post Reply