Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation on Intel Quick Sync Video is wrong about lookahead default #189

Open
colemar opened this issue Mar 16, 2023 · 2 comments
Open

Comments

@colemar
Copy link

colemar commented Mar 16, 2023

Problem Description

https://handbrake.fr/docs/en/1.6.0/technical/video-qsv.html
This page says lookahead=1 is the default.

I verified that putting lookahead=1 in Advanced Options for H.264 (Intel QSV) makes a difference in the output file size and content.

Activity Log, Crash Log or any other details

HandBrake 1.6.1 (2023012300)
OS: Microsoft Windows NT 10.0.19045.0
CPU: Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
Ram: 16257 MB, 
GPU Information:
  Intel(R) HD Graphics 630 - 26.20.100.7528
  NVIDIA GeForce GTX 1080 Ti - 31.0.15.2802
Screen: 2560x1440
Temp Dir: C:\Users\colem\AppData\Local\Temp\
Install Dir: C:\Program Files\HandBrake\
Data Dir: C:\Users\colem\AppData\Roaming\HandBrake

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

 # Starting Encode ...

[22:40:06] base preset: H.264 NVENC (Modified)
[22:40:06] hb_init: starting libhb thread
[22:40:06] Starting work at: Thu Mar 16 22:40:06 2023
[22:40:06] 1 job(s) to process
[22:40:06] json job:
{
  "Audio": {
    "AudioList": [
      {
        "Bitrate": 160,
        "DRC": 0,
        "Encoder": "av_aac",
        "Gain": 0,
        "Mixdown": 4,
        "NormalizeMixLevel": false,
        "Samplerate": 0,
        "Track": 0,
        "DitherMethod": 0
      }
    ],
    "CopyMask": [
      "copy:aac"
    ]
  },
  "Destination": {
    "ChapterList": [
      {
        "Name": "Chapter 1"
      }
    ],
    "ChapterMarkers": true,
    "AlignAVStart": false,
    "File": "C:\\Users\\colem\\Downloads\\a\\-Movies\\Womens.Prison.Massacre (1983)\\test-1.mp4",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": false
    },
    "Mux": "av_mp4"
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 14,
        "Settings": {
          "crop-bottom": "2",
          "crop-left": "0",
          "crop-right": "0",
          "crop-top": "2",
          "height": "1036",
          "width": "1920"
        }
      },
      {
        "ID": 7,
        "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\\colem\\Downloads\\a\\-Movies\\Womens.Prison.Massacre (1983)\\test.mov"
  },
  "Subtitle": {
    "Search": {
      "Burn": false,
      "Default": false,
      "Enable": false,
      "Forced": false
    },
    "SubtitleList": []
  },
  "Video": {
    "Encoder": "qsv_h264",
    "Level": "auto",
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Options": "lookahead=1:lookahead-depth=40",
    "Preset": "balanced",
    "Profile": "auto",
    "Quality": 36,
    "QSV": {
      "Decode": true
    },
    "HardwareDecode": 0
  }
}
[22:40:06] CPU: Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
[22:40:06]  - Intel microarchitecture Kaby Lake
[22:40:06]  - logical processor count: 8
[22:40:06] Intel Quick Sync Video support: yes, gpu list: 1
[22:40:06] Intel Quick Sync Video integrated adapter with index 1
[22:40:06] Impl mfxhw64 library path: C:\WINDOWS\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_e709cb715c39d0e0\libmfxhw64.dll
[22:40:06]  - Intel Media SDK hardware: API 1.30 (minimum: 1.3)
[22:40:06]  - Decode support:  h264 hevc (8bit: yes, 10bit: yes)
[22:40:06]  - H.264 encoder: yes
[22:40:06]     - preferred implementation: hardware (2) via D3D11
[22:40:06]     - capabilities (hardware):  breftype icq+la+i+downs vsinfo chromalocinfo opt1 opt2+mbbrc+extbrc+trellis+repeatpps+ib_adapt+nmpslice
[22:40:06]  - H.265 encoder: yes (8bit: yes, 10bit: yes)
[22:40:06]     - preferred implementation: hardware (2) via D3D11
[22:40:06]     - capabilities (hardware):  bpyramid icq vsinfo masteringinfo cllinfo opt1
[22:40:06]  - AV1 encoder: no
[22:40:06] hb_scan: path=C:\Users\colem\Downloads\a\-Movies\Womens.Prison.Massacre (1983)\test.mov, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:333: failed opening UDF image C:\Users\colem\Downloads\a\-Movies\Womens.Prison.Massacre (1983)\test.mov
src/libbluray/disc/disc.c:437: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:437: error opening file BDMV\BACKUP\index.bdmv
[22:40:06] bd: not a bd - trying as a stream/file instead
libdvdread: DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav: vm: vm: failed to read VIDEO_TS.IFO
[22:40:06] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\colem\Downloads\a\-Movies\Womens.Prison.Massacre (1983)\test.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf57.79.100
  Duration: 00:00:08.38, start: 0.000000, bitrate: 98946 kb/s
  Stream #0:0[0x1](eng): Video: prores (HQ) (apch / 0x68637061), yuv422p10le(tv, bt470bg/unknown/unknown), 1920x1040, 97414 kb/s, 23.98 fps, 23.98 tbr, 24k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : FFMP
  Stream #0:1[0x2](eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, 2 channels, s16, 1536 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
[22:40:06] scan: decoding previews for title 1
[22:40:06] scan: audio 0x1: pcm_s16le, rate=48000Hz, bitrate=1536000 English (pcm_s16le) (2.0 ch) (1536 kbps)
[22:40:06] scan: 10 previews, 1920x1040, 23.976 fps, autocrop = 2/2/0/0, aspect 16:9, PAR 1:1, color profile: 1-1-5, chroma location: unspecified
[22:40:06] libhb: scan thread found 1 valid title(s)
[22:40:06] qsv: integrated qsv adapter with index 1 has been selected
[22:40:06] Starting Task: Encoding Pass
[22:40:06] work: track 1, dithering not supported by codec
[22:40:06] work: only 1 chapter, disabling chapter markers
[22:40:06] job configuration:
[22:40:06]  * source
[22:40:06]    + C:\Users\colem\Downloads\a\-Movies\Womens.Prison.Massacre (1983)\test.mov
[22:40:06]    + title 1, chapter(s) 1 to 1
[22:40:06]    + container: mov,mp4,m4a,3gp,3g2,mj2
[22:40:06]    + data rate: 98946 kbps
[22:40:06]  * destination
[22:40:06]    + C:\Users\colem\Downloads\a\-Movies\Womens.Prison.Massacre (1983)\test-1.mp4
[22:40:06]    + container: MPEG-4 (libavformat)
[22:40:06]  * video track
[22:40:06]    + decoder: prores 10-bit (yuv422p10le)
[22:40:06]      + bitrate 97414 kbps
[22:40:06]    + filters
[22:40:06]      + Framerate Shaper (mode=1)
[22:40:06]        + frame rate: 23.976 fps -> constant 23.976 fps
[22:40:06]      + Crop and Scale (width=1920:height=1036:crop-top=2:crop-bottom=2:crop-left=0:crop-right=0)
[22:40:06]        + source: 1920 * 1040, crop (2/2/0/0): 1920 * 1036, scale: 1920 * 1036
[22:40:06]      + Format (format=nv12)
[22:40:06]    + Output geometry
[22:40:06]      + storage dimensions: 1920 x 1036
[22:40:06]      + pixel aspect ratio: 1 : 1
[22:40:06]      + display dimensions: 1920 x 1036
[22:40:06]    + encoder: H.264 (Intel Media SDK)
[22:40:06]      + preset:  balanced
[22:40:06]      + options: lookahead=1:lookahead-depth=40
[22:40:06]      + profile: auto
[22:40:06]      + level:   auto
[22:40:06]      + quality: 36.00 (ICQ)
[22:40:06]      + color profile: 1-1-5
[22:40:06]      + chroma location: unspecified
[22:40:06]  * audio track 1
[22:40:06]    + decoder: English (pcm_s16le) (2.0 ch) (1536 kbps) (track 1, id 0x1)
[22:40:06]      + bitrate: 1536 kbps, samplerate: 48000 Hz
[22:40:06]    + mixdown: Stereo
[22:40:06]    + encoder: AAC (libavcodec)
[22:40:06]      + bitrate: 160 kbps, samplerate: 48000 Hz
[22:40:06] sync: expecting 201 video frames
[22:40:06] Unknown Header.BufferId=1347637059
[22:40:06] encqsvInit: using encode-only path
[22:40:06] encqsvInit: H.264/AVC High profile @ level 4.0
[22:40:06] encqsvInit: TargetUsage 4 AsyncDepth 4
[22:40:06] encqsvInit: GopRefDist 4 GopPicSize 24 NumRefFrame 3 IdrInterval 0
[22:40:06] encqsvInit: BFramesMax 3 BRefType pyramid
[22:40:06] encqsvInit: RateControlMethod LA_ICQ ICQQuality 36 LookAheadDepth 40
[22:40:07] sync: first pts video is 0
[22:40:07] sync: "Chapter 1" (1) at frame 1 time 0
[22:40:07] sync: first pts audio 0x1 is 0
[22:40:07] qsv_enc_init: using 'hardware (2) via D3D11' implementation, API: 1.30
[22:40:08] reader: done. 1 scr changes
[22:40:10] work: average encoding speed for job is 0.000000 fps
[22:40:10] vfr: 201 frames output, 0 dropped and 0 duped for CFR/PFR
[22:40:10] vfr: lost time: 0 (0 frames)
[22:40:10] vfr: gained time: 0 (0 frames) (0 not accounted for)
[22:40:10] pcm_s16le-decoder done: 402 frames, 0 decoder errors
[22:40:10] prores-decoder done: 201 frames, 0 decoder errors
[22:40:10] sync: got 201 frames, 201 expected
[22:40:10] sync: framerate min 23.976 fps, max 23.976 fps, avg 23.976 fps
[22:40:10] mux: track 0, 201 frames, 1097709 bytes, 1042.32 kbps, fifo 256
[22:40:10] mux: track 1, 393 frames, 167580 bytes, 159.12 kbps, fifo 512
[22:40:10] Finished work at: Thu Mar 16 22:40:10 2023
[22:40:10] libhb: work result = 0

 # Job Completed!

What Operating System are you running?

Microsoft Windows NT 10.0.19045.0

What version of HandBrake are you running?

HandBrake 1.6.1 (2023012300)

Where did you download HandBrake from?

https://handbrake.fr/rotation.php?file=HandBrake-1.6.1-x86_64-Win_GUI.exe

@JamesPous
Copy link

JamesPous commented Mar 17, 2023

I can confirm your observation and the default encoding setting use slightly different options for encoding.

The big difference is the use of 'mbbrc' setting, which produce bigger output filesize to get a higher quality in action scenes.

I am not a friend of default settings, because I prefer high quality in qsv encoding.

My recommend parameters in advanced video encoding settings: tu=1:la=1:la-depth=60

tu=1 slowest encode and max. quality in intel qsv encode! Great!
la=lookahead activated
la-depth=60 (highest positive value to analyse the video and get the best quality and compression)

Also use high profile level 4.1 for FullHD

Bitrate: min 4.000 kbit/s (standard quality), 6.000 kbit/s (good quality) and 8.000 kbit/s (fantastic details)

@sr55 sr55 transferred this issue from HandBrake/HandBrake Mar 18, 2023
@lostcowboy
Copy link

Looks like they fixed the doc.

lookahead (or la)

Use the LookAhead (LA or LA_ICQ) bitrate control algorithm.
Default: 1 (on)
Caveats: requires hardware support (4th gen. Intel Core processor or equivalent), and driver support for version 1.7 (1.8 for LA_ICQ) of the Media SDK API.
lookahead-depth (or la-depth)

If LookAhead bitrate control is enabled, number of frames that are analyzed before encoding, from 11 to 60.
Default: 40
Note: may be sanitized to a lower value in some cases to avoid hangs.
Caveats: requires hardware support (4th gen. Intel Core processor or equivalent), and driver support for version 1.7 of the Media SDK API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants