QSV: advanced query settings and encode log does not match

Archive of historical bug reports.
Please use the GitHub link above to report issues.
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
Post Reply
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

QSV: advanced query settings and encode log does not match

Post by gmb »

In Handbrake when I use this:


gop-ref-dist=8:gop-pic-size=0

I get this according to encoding log:

encqsvInit: GopRefDist 7 GopPicSize 256


or when I use this

gop-ref-dist=8:gop-pic-size=256


I get this

encqsvInit: GopRefDist 8 GopPicSize 257
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: QSV: advanced query settings and encode log does not mat

Post by gmb »

The issue is present on svn5780 and svn5782. I downgraded to svn5764 and the problem is gone.
Deleted User 11865

Re: QSV: advanced query settings and encode log does not mat

Post by Deleted User 11865 »

This is normal behavior. We need to adjust either of GopRefDist or GopPicSize to ensure B-pyramid gets disabled or enabled, since there is no option to control it directly.

When GopPicSize is automatic (0), we adjust GopRefDist (while GopPicSize 0 typically results in a final value of 32 or 256, we can't be sure it won't change in future implementations), otherwise we adjust GopPicSize.

The default is B-pyramid off (for compatibility reasons, some stupid devices crash with B-pyramid), which is why GopRefDist 8 GopPicSize 256 (enables B-pyramid) is not allowed.

If you're OK with B-pyramid being used, you can add b-pyramid=1 to the additional options string.
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: QSV: advanced query settings and encode log does not mat

Post by gmb »

b-pyramid=1 gives me worse results in most videos. I have another option that doesn't match with my encoding. LA depth which should work with 60 according to the Handbrake wiki. I'm limited to ~45 only with svn5785 . I guess it's still the same bug from some weeks ago, the wiki says otherwise though. I know from QSTranscode tests that LA quality can scale up to ~60 depth.

Code: Select all

lookahead=1:gop-ref-dist=5:gop-pic-size=256:target-usage=4:num-ref-frame=0:mbbrc=0:extbrc=0:async-depth=0:b-pyramid=0:lookahead-depth=60

Code: Select all

encqsvInit: TargetUsage 4 AsyncDepth 4
encqsvInit: GopRefDist 5 GopPicSize 256 NumRefFrame 2
encqsvInit: BFrames on BPyramid off
encqsvInit: RateControlMethod LA TargetKbps 5000 LookAheadDepth 43

Code: Select all

lookahead=1:gop-ref-dist=3:gop-pic-size=256:target-usage=4:num-ref-frame=0:mbbrc=0:extbrc=0:async-depth=0:b-pyramid=0:lookahead-depth=60

Code: Select all

encqsvInit: TargetUsage 4 AsyncDepth 4
encqsvInit: GopRefDist 3 GopPicSize 256 NumRefFrame 2
encqsvInit: BFrames on BPyramid off
encqsvInit: RateControlMethod LA TargetKbps 5000 LookAheadDepth 45
Deleted User 11865

Re: QSV: advanced query settings and encode log does not mat

Post by Deleted User 11865 »

I set the limit to (48 - GopRefDist) to avoid a hang. Not a great workaround, but better than a hang.

You can use --disable-qsv-decoding via the CLI, the limit is set to 60 then (there are fewer video memory related issues when using the encode-only path).
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: QSV: advanced query settings and encode log does not mat

Post by gmb »

Is there a bugfix planned?

What memory issues? High memory usage? Only a real problem for very high resolution such as 4k. Although Intel should increase their dynamic memory limits. Since years it stays at 1,6 GB. I have 8GB of system RAM, means ~6GB free of RAM to work with. They should increase it to 3GB.
Deleted User 11865

Re: QSV: advanced query settings and encode log does not mat

Post by Deleted User 11865 »

All I know is anything higher just causes hangs on my test system.

I'd like to fix this, but probably only after the structural changes we want to do are completed.
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: QSV: advanced query settings and encode log does not mat

Post by gmb »

This

lookahead=1:gop-ref-dist=9

gives me this:

encqsvInit: GopRefDist 8


refdist 9 not working with Lookahead?
Deleted User 11865

Re: QSV: advanced query settings and encode log does not mat

Post by Deleted User 11865 »

Correct - it also works around a hang I was having.
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: QSV: advanced query settings and encode log does not mat

Post by gmb »

For what a workaround? Higher LA depth values aren't working, doesn't matter if it hangs or if it is a placebo setting. I always wondered why there is no difference between gop 8 and 9 with Lookahead. Several hours of testing wasted until I noticed it. I have to use svn5671 for gop testing, it's much more reliable.
Deleted User 11865

Re: QSV: advanced query settings and encode log does not mat

Post by Deleted User 11865 »

In my testing, GopRefDist > 8 + Lookahead on caused a hang, regardless of how short the lookahead was (even tried GopRefDist 8 with LookAheadDepth 10).
Deleted User 11865

Re: QSV: advanced query settings and encode log does not mat

Post by Deleted User 11865 »

FWIW, GopRefDist 8 is the QSV "equivalent" of --bframes 7 with x264, which should be plenty enough (--preset veryslow uses 8). Any reason you want to use 9, other than testing?

With --disable-qsv-decoding (which I guess doesn't work with your setup, test build to come shortly), you can use GopRefDist up to 16 and LookAheadDepth up to 60.
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: QSV: advanced query settings and encode log does not mat

Post by gmb »

There is no hang with high gop-ref 9 +Lookahead on my machine. Something must be different with your system. The hang starts with gop-ref 10 and higher. With VBR Gop-ref 11 and higher it causes playback glitches, so it's not interesting hang or not hang. If gop-ref 9 can be better I have to see.
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: QSV: advanced query settings and encode log does not mat

Post by gmb »

The new Handbrake version hangs with LA depth over 45, no automatically downgrade anymore.
Deleted User 11865

Re: QSV: advanced query settings and encode log does not mat

Post by Deleted User 11865 »

Log please?
gmb
Bright Spark User
Posts: 350
Joined: Thu Mar 28, 2013 12:49 pm

Re: QSV: advanced query settings and encode log does not mat

Post by gmb »

Here...

Code: Select all

HandBrake svn5912 (Nightly Build) - 64bit Version
OS: Microsoft Windows NT 6.1.7601 Service Pack 1
CPU: Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz
Ram: 8082 MB, 
GPU Information:
  Intel(R) HD Graphics 4600 - 10.18.10.3355
  NVIDIA GeForce GTX 660 Ti - 9.18.13.3193
Screen: 1920x1080
Temp Dir: C:\Users\Ralf\AppData\Local\Temp\
Install Dir: C:\Program Files\Handbrake
Data Dir: C:\Users\Ralf\AppData\Roaming\HandBrake\HandBrake\0.0.0.5912

-------------------------------------------
[05:38:47] CPU: Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz
[05:38:47]  - Intel microarchitecture Haswell
[05:38:47]  - logical processor count: 4
[05:38:47] OpenCL device #1: Intel(R) Corporation Intel(R) HD Graphics 4600
[05:38:47]  - OpenCL version: 1.2 
[05:38:47]  - driver version: 10.18.10.3355
[05:38:47]  - device type:    GPU
[05:38:47]  - supported:      YES
[05:38:47] OpenCL device #2: NVIDIA Corporation GeForce GTX 660 Ti
[05:38:47]  - OpenCL version: 1.1 CUDA
[05:38:47]  - driver version: 331.93
[05:38:47]  - device type:    GPU
[05:38:47]  - supported:      no
[05:38:47] Intel Quick Sync Video support: yes
[05:38:47]  - Intel Media SDK hardware: API 1.7 (minimum: 1.3)
[05:38:47]  - Intel Media SDK software: API 1.7 (minimum: 1.3)
[05:38:47]  - Preferred implementation: hardware (any)
[05:38:47] hb_scan: path=C:\Quicksync\2_hdprobe.mkv, title_index=0
libbluray/bdnav/index_parse.c:162: indx_parse(): error opening C:\Quicksync\2_hdprobe.mkv/BDMV/index.bdmv
libbluray/bdnav/index_parse.c:162: indx_parse(): error opening C:\Quicksync\2_hdprobe.mkv/BDMV/BACKUP/index.bdmv
libbluray/bluray.c:1725: nav_get_title_list(C:\Quicksync\2_hdprobe.mkv) failed (0000000022153ba0)
[05:38:47] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 4.1.3
libdvdread: Encrypted DVD support unavailable.
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[05:38:47] dvd: not a dvd - trying as a stream/file instead
Input #0, matroska,webm, from 'C:\Quicksync\2_hdprobe.mkv':
  Duration: 00:01:00.47, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: h264 (High), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
[05:38:47] scan: decoding previews for title 1
[05:38:49] scan: 10 previews, 1920x1080, 23.976 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[05:38:49] libhb: scan thread found 1 valid title(s)

Code: Select all

HandBrake svn5912 (Nightly Build) - 64bit Version
OS: Microsoft Windows NT 6.1.7601 Service Pack 1
CPU: Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz
Ram: 8082 MB, 
GPU Information:
  Intel(R) HD Graphics 4600 - 10.18.10.3355
  NVIDIA GeForce GTX 660 Ti - 9.18.13.3193
Screen: 1920x1080
Temp Dir: C:\Users\Ralf\AppData\Local\Temp\
Install Dir: C:\Program Files\Handbrake
Data Dir: C:\Users\Ralf\AppData\Roaming\HandBrake\HandBrake\0.0.0.5912

-------------------------------------------
CLI Query:  -i "C:\Quicksync\2_hdprobe.mkv" -t 1 --angle 1 -c 1 -o "C:\Quicksync\Handbrake Output HSW\2 Hdprobe-1.mp4"  -f mp4  -w 1920 --crop 0:0:0:0 --loose-anamorphic  --modulus 2 -e qsv_h264 -b 5000 --cfr -a none  --audio-fallback ac3 --markers="C:\Users\Ralf\AppData\Local\Temp\2 Hdprobe-1-1-chapters.csv" --qsv-preset=quality -x lookahead=1:lookahead-depth=60 --h264-level="4.1"  --h264-profile=high  --verbose=1

[05:42:00] hb_init: starting libhb thread
HandBrake svn5912 (2013120401) - MinGW x86_64 - http://handbrake.fr
4 CPUs detected
Opening C:\Quicksync\2_hdprobe.mkv...
[05:42:00] CPU: Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz
[05:42:00]  - Intel microarchitecture Haswell
[05:42:00]  - logical processor count: 4
[05:42:00] OpenCL device #1: Intel(R) Corporation Intel(R) HD Graphics 4600
[05:42:00]  - OpenCL version: 1.2 
[05:42:00]  - driver version: 10.18.10.3355
[05:42:00]  - device type:    GPU
[05:42:00]  - supported:      YES
[05:42:00] OpenCL device #2: NVIDIA Corporation GeForce GTX 660 Ti
[05:42:00]  - OpenCL version: 1.1 CUDA
[05:42:00]  - driver version: 331.93
[05:42:00]  - device type:    GPU
[05:42:00]  - supported:      no
[05:42:00] Intel Quick Sync Video support: yes
[05:42:00]  - Intel Media SDK hardware: API 1.7 (minimum: 1.3)
[05:42:00]  - Intel Media SDK software: API 1.7 (minimum: 1.3)
[05:42:00]  - Preferred implementation: hardware (any)
[05:42:00] hb_scan: path=C:\Quicksync\2_hdprobe.mkv, title_index=1
libbluray/bdnav/index_parse.c:162: indx_parse(): error opening C:\Quicksync\2_hdprobe.mkv/BDMV/index.bdmv
libbluray/bdnav/index_parse.c:162: indx_parse(): error opening C:\Quicksync\2_hdprobe.mkv/BDMV/BACKUP/index.bdmv
libbluray/bluray.c:1725: nav_get_title_list(C:\Quicksync\2_hdprobe.mkv) failed (0000000001c0a7f0)
[05:42:00] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 4.1.3
libdvdread: Encrypted DVD support unavailable.
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[05:42:00] dvd: not a dvd - trying as a stream/file instead
Input #0, matroska,webm, from 'C:\Quicksync\2_hdprobe.mkv':
  Duration: 00:01:00.47, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: h264 (High), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
[05:42:00] scan: decoding previews for title 1
Scanning title 1 of 1, preview 1, 10.00 %
Scanning title 1 of 1, preview 3, 30.00 %
Scanning title 1 of 1, preview 4, 40.00 %
Scanning title 1 of 1, preview 6, 60.00 %
Scanning title 1 of 1, preview 8, 80.00 %
Scanning title 1 of 1, preview 10, 100.00 %[05:42:01] scan: 10 previews, 1920x1080, 23.976 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[05:42:01] libhb: scan thread found 1 valid title(s)
+ title 1:
  + stream: C:\Quicksync\2_hdprobe.mkv
  + duration: 00:01:00
  + size: 1920x1080, pixel aspect: 1/1, display aspect: 1.78, 23.976 fps
  + autocrop: 0/0/0/0
  + support opencl: yes
  + support hwd: yes
  + chapters:
    + 1: cells 0->0, 0 blocks, duration 00:01:00
  + audio tracks:
  + subtitle tracks:
Reading chapter markers from file C:\Users\Ralf\AppData\Local\Temp\2 Hdprobe-1-1-chapters.csv
[05:42:02] 1 job(s) to process
[05:42:02] starting job
[05:42:02] do_job: QSV: full path, removing unsupported filter 'Framerate Shaper'
[05:42:02] sync: expecting 1450 video frames
[05:42:02] work: only 1 chapter, disabling chapter markers
[05:42:02] job configuration:
[05:42:02]  * source
[05:42:02]    + C:\Quicksync\2_hdprobe.mkv
[05:42:02]    + title 1, chapter(s) 1 to 1
[05:42:02]    + container: matroska,webm
[05:42:02]  * destination
[05:42:02]    + C:\Quicksync\Handbrake Output HSW\2 Hdprobe-1.mp4
[05:42:02]    + container: MPEG-4 (avformat)
[05:42:02]  * video track
[05:42:02]    + decoder: h264_qsv
[05:42:02]    + loose anamorphic
[05:42:02]      + storage dimensions: 1920 * 1080, mod 2
[05:42:02]      + pixel aspect ratio: 1 / 1
[05:42:02]      + display dimensions: 1920 * 1080
[05:42:02]    + encoder: H.264 (Intel QSV)
[05:42:02]      + QSV preset: quality
[05:42:02]      + options: lookahead=1:lookahead-depth=60
[05:42:02]      + h264 profile: high
[05:42:02]      + h264 level: 4.1
[05:42:02]      + bitrate: 5000 kbps, pass: 0
[05:42:02] reader: first SCR 0 id 0x0 DTS 0
[05:42:02] encqsvInit: using full QSV path
[05:42:02] encqsvInit: TargetUsage 2 AsyncDepth 4
[05:42:02] encqsvInit: GopRefDist 3 GopPicSize 121 NumRefFrame 3
[05:42:02] encqsvInit: BFrames on BPyramid off
[05:42:02] encqsvInit: RateControlMethod LA TargetKbps 5000 LookAheadDepth 48
[05:42:02] encqsvInit: CAVLC off
[05:42:02] encqsvInit: Trellis off
[05:42:02] encqsvInit: H.264 profile High @ level 4.1
[05:42:02] qsv_enc_init: using 'hardware (2)' implementation, API: 1.7


LookAheadDepth 48


I see it is downgraded from 60 to 48, it hangs nevertheless.
Deleted User 11865

Re: QSV: advanced query settings and encode log does not mat

Post by Deleted User 11865 »

I think I know what's going on: GopRefDist is 0, and we sanitize before initializing the encode session (so we don't know the final value yet).

This should no longer happen by default after 5913, but I still need to fix the workaround (ouch) for when GopRefDist 0 is specifically requested via advanced options.
Post Reply