Skip to content

Increase buffer memory for hevc QSV. - #2862

Merged
sr55 merged 1 commit into
HandBrake:masterfrom
yuichiro-naito:increase_bufsize_for_hevc_qsv
May 26, 2020
Merged

sr55 merged 1 commit into
HandBrake:masterfrom
yuichiro-naito:increase_bufsize_for_hevc_qsv

Conversation

@yuichiro-naito

@yuichiro-naito yuichiro-naito commented May 17, 2020 •

Copy link
Copy Markdown
Contributor

Before Posting:

  • Create an issue describing the change. If an issue already exists, please use this.
  • Discuss the issue with the HandBrake team to ensure that the idea has been accepted. (An open enhancement request does not equal acceptance). This will avoid any time wasted on features that are outside the project scope!

Description of Change:
Increase buffer size for H265. QSV.
It seems that Intel Media SDK requires more buffer memory since 20.1.0, HEVC code has been refactored.

This PR solves following issue.
#2858

Test on:

  • Windows 10+ (via MinGW)
  • macOS 10.13+
  • Ubuntu Linux
  • FreeBSD

Screenshots (If relevant):

Log file output (If relevant):

@bradleysepos

Copy link
Copy Markdown
Contributor

Looks good to me. Needs manual test on applicable hardware on Linux/Windows. Thanks @yuichiro-naito and @maximd33!

@maximd33 maximd33 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally ok and works for Windows OS, Linux should be ok as well

see space/tab issue
and please rename commit to start with qsv: Increase memory buffer for hevc header retrieval

Comment thread libhb/enc_qsv.c Outdated
hb_buffer_realloc(bitstream_buf,bitstream_buf->size*2);
bpp12 = 6;
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use spaces instead of tabulation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for that.
I fixed to use spaces.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good,
please use commit subject as- qsv: ...............

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.
I rebased -i to squash 2 commits and updated the subject that start with qsv:.
And it is force pushed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you
LGTM

@galinart

Copy link
Copy Markdown
Contributor

LGTM

@galinart

Copy link
Copy Markdown
Contributor

@yuichiro-naito in description you mentioned the following?

Description of Change:
Increase buffer size for H264. QSV.

Is H264 typo in this case?
Seems you changes about HEVC and you transcode AVC->HEVC.

Do you have any issues with AVC->AVC transcoding?

Highly appreciated for the help!

@yuichiro-naito

Copy link
Copy Markdown
Contributor Author

Is H264 typo in this case?

Sorry. It is typo.
I fixed to H.265 QSV in the description.

Do you have any issues with AVC->AVC transcoding?

No, I don't.
AVC encoding works fine for me.

     Intel Media SDK has refactored hevc qsv code since 20.1.0.
     It requires more buffer memory than before.
@yuichiro-naito
yuichiro-naito force-pushed the increase_bufsize_for_hevc_qsv branch from c7000da to b138dd9 Compare May 19, 2020 00:57
@galinart

Copy link
Copy Markdown
Contributor

LGTM, thanks for the answers and contribution!

@sr55
sr55 merged commit c5f995f into HandBrake:master May 26, 2020
@bradleysepos

Copy link
Copy Markdown
Contributor

On 1.3.x branch as 7c11f02.

@samsong

samsong commented Apr 3, 2021 •

Copy link
Copy Markdown

Hi Team. I have same issue encoding. Latest Handbrake 1.3.3 on Windows 10 64bit intel nuc 8th gen i5 intel

[20:33:01] CPU: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
[20:33:01]  - Intel microarchitecture Kaby Lake
[20:33:01]  - logical processor count: 8
[20:33:01] Intel Quick Sync Video support: yes
[20:33:01]  - Intel Media SDK hardware: API 1.33 (minimum: 1.3)
[20:33:01]  - H.264 encoder: yes
[20:33:01]     - preferred implementation: hardware (any) via D3D11
[20:33:01]     - capabilities (hardware):  breftype icq+la+i+downs vsinfo opt1 opt2+mbbrc+extbrc+trellis+ib_adapt+nmpslice
[20:33:01]  - H.265 encoder: yes (8bit: yes, 10bit: yes)
[20:33:01]     - preferred implementation: hardware (any) via D3D11
[20:33:01]     - capabilities (hardware):  bpyramid icq vsinfo opt1
[20:33:01] hb_scan: path=G:\WA0016.mp4, title_index=59
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:323: failed opening UDF image G:\WA0016.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(G:\WA0016.mp4\) failed
[20:33:01] 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
[20:33:01] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'G:\WA0016.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2020-06-03T04:11:32.000000Z
    com.android.version: 10
  Duration: 00:00:02.38, start: 0.000000, bitrate: 3970 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt470bg/bt470bg/smpte170m), 1280x720, 3863 kb/s, SAR 1:1 DAR 16:9, 29.40 fps, 29.83 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      rotate          : 90
      creation_time   : 2020-06-03T04:11:32.000000Z
      handler_name    : VideoHandle
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
    Metadata:
      creation_time   : 2020-06-03T04:11:32.000000Z
      handler_name    : SoundHandle
[20:33:01] scan: decoding previews for title 59
[20:33:01] scan: audio 0x1: aac, rate=48000Hz, bitrate=98611 English (AAC LC) (2.0 ch) (98 kbps)
[20:33:01] Auto-Rotating video 270 degrees
[20:33:01] scan: 10 previews, 720x1280, 29.402 fps, autocrop = 0/0/0/0, aspect 1:1.78, PAR 1:1
[20:33:01] scan: supported video decoders: avcodec qsv
[20:33:01] libhb: scan thread found 1 valid title(s)
[20:33:01] Skipping subtitle scan.  No suitable subtitle tracks.
[20:33:01] Starting Task: Encoding Pass
[20:33:01] Skipping vfr filter
[20:33:01] Skipping crop/scale filter
[20:33:01] work: only 1 chapter, disabling chapter markers
[20:33:01] job configuration:
[20:33:01]  * source
[20:33:01]    + G:\WA0016.mp4
[20:33:01]    + title 59, chapter(s) 1 to 1
[20:33:01]    + container: mov,mp4,m4a,3gp,3g2,mj2
[20:33:01]    + data rate: 3970 kbps
[20:33:01]  * destination
[20:33:01]    + C:\user\desktop\new\WA0016.mp4
[20:33:01]    + container: MPEG-4 (libavformat)
[20:33:01]      + align initial A/V stream timestamps
[20:33:01]  * video track
[20:33:01]    + decoder: h264_qsv
[20:33:01]      + bitrate 3863 kbps
[20:33:01]    + filters
[20:33:01]      + 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)
[20:33:01]      + Decomb (mode=39)
[20:33:01]    + Output geometry
[20:33:01]      + storage dimensions: 720 x 1280
[20:33:01]      + pixel aspect ratio: 1 : 1
[20:33:01]      + display dimensions: 720 x 1280
[20:33:01]    + encoder: H.265 (Intel Media SDK)
[20:33:01]      + preset:  balanced
[20:33:01]      + profile: auto
[20:33:01]      + level:   auto
[20:33:01]      + quality: 22.00 (ICQ)
[20:33:01]      + color profile: 5-6-5
[20:33:01]  * audio track 1
[20:33:01]    + decoder: English (AAC LC) (2.0 ch) (98 kbps) (track 1, id 0x1)
[20:33:01]      + bitrate: 98 kbps, samplerate: 48000 Hz
[20:33:01]    + mixdown: Stereo
[20:33:01]    + dither: none
[20:33:01]    + encoder: AAC (libavcodec)
[20:33:01]      + bitrate: 160 kbps, samplerate: 48000 Hz
[20:33:01] sync: expecting 70 video frames
encqsvInit: MFXVideoENCODE_Init failed (-17)
Failure to initialise thread 'Quick Sync Video encoder (Intel Media SDK)'
[20:33:01] comb detect: heavy 0 | light 0 | uncombed 0 | total 0
[20:33:01] decomb: deinterlaced 0 | blended 0 | unfiltered 0 | total 0
[20:33:01] aac-decoder done: 0 frames, 0 decoder errors
[20:33:01] h264_qsv-decoder done: 0 frames, 0 decoder errors
[20:33:01] sync: got 0 frames, 70 expected
[20:33:02] Finished work at: Sat Apr 03 20:33:02 2021
[20:33:02] libhb: work result = 3

# Encode Stopped

@yuichiro-naito
yuichiro-naito deleted the increase_bufsize_for_hevc_qsv branch October 3, 2024 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

7 participants