Opened 4 years ago

Closed 4 years ago

#8400 closed enhancement (fixed)

Add tiles encoding support for HEVC QSV

Reported by: Linjie.Fu Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: QSV HEVC Tiles
Cc: linjie.fu@intel.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

There is a requirement for adding tiles encoding support for HEVC.

Since this feature is supported for ICL+ (gen11), I would prefer to create a ticket and provide more detailed information/logs for the evaluation of developers/maintainers who could not get access to this platform currently.

Attachments (2)

qsv.h265 (40.7 KB ) - added by Linjie.Fu 4 years ago.
#8400.png (251.8 KB ) - added by Linjie.Fu 4 years ago.
screenshot to show the Tiles in the output.

Download all attachments as: .zip

Change History (5)

comment:1 by Linjie.Fu, 4 years ago

Log after the patch is applied:

option:
-tile_rows 2 -tile_cols 2

Output:
[hevc_qsv @ 0x11f9700] NumTileColumns: 2; NumTileRows: 2

ffmpeg -v verbose -hwaccel qsv -init_hw_device qsv=hw -filter_hw_device hw -f rawvideo -s:v 1920x1080 -i ./1080p_blue_sky.yuv -vf format=nv12,hwupload=extra_hw_frames=64 -c:v hevc_qsv -tile_rows 2 -tile_cols 2 -vframes 10 -y ./qsv.h265
ffmpeg version N-95879-gdcfc671 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
  configuration: --enable-vaapi --prefix=/opt/X11R7/iHD/ffmpeg_mainline --enable-nonfree --enable-shared --enable-libmfx --enable-gpl --enable-libx264 --enable-libx265 --disable-optimizations --enable-debug=3 --disable-stripping --enable-libvorbis --enable-libvpx --samples=fate-suite
  libavutil      56. 36.100 / 56. 36.100
  libavcodec     58. 62.100 / 58. 62.100
  libavformat    58. 35.100 / 58. 35.100
  libavdevice    58.  9.101 / 58.  9.101
  libavfilter     7. 67.100 /  7. 67.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
[AVHWDeviceContext @ 0x1164980] Trying to use DRM render node for device 0.
[AVHWDeviceContext @ 0x1164980] libva: VA-API version 1.6.0
[AVHWDeviceContext @ 0x1164980] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x1164980] libva: Trying to open /opt/X11R7/iHD/vpg_driver/lib/dri//iHD_drv_video.so
[AVHWDeviceContext @ 0x1164980] libva: Found init function __vaDriverInit_1_6
[AVHWDeviceContext @ 0x1164980] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x1164980] Initialised VAAPI connection: version 1.6
[AVHWDeviceContext @ 0x1164980] VAAPI driver: Intel iHD driver - 1.0.0.
[AVHWDeviceContext @ 0x1164980] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x1164400] Initialize MFX session: API version is 1.30, implementation version is 1.30
[rawvideo @ 0x11deb40] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from './1080p_blue_sky.yuv':
  Duration: 00:00:08.68, start: 0.000000, bitrate: 622080 kb/s
    Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 1920x1080, 622080 kb/s, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> hevc (hevc_qsv))
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 0x11feb40] w:1920 h:1080 pixfmt:yuv420p tb:1/25 fr:25/1 sar:0/1 sws_param:flags=2
[auto_scaler_0 @ 0x1202000] w:iw h:ih flags:'bicubic' interl:0
[Parsed_format_0 @ 0x11641c0] auto-inserting filter 'auto_scaler_0' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_format_0'
[auto_scaler_0 @ 0x1202000] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:1920 h:1080 fmt:nv12 sar:0/1 flags:0x4
[AVHWDeviceContext @ 0x1202980] VAAPI driver: Intel iHD driver - 1.0.0.
[AVHWDeviceContext @ 0x1202980] Driver not found in known nonstandard list, using standard behaviour.
VPP PIPELINE: 
RESIZE 
VPP PIPELINE: 
RESIZE 
VPP PIPELINE: 
RESIZE 
VPP PIPELINE: 
RESIZE 
[hevc_qsv @ 0x11f9700] Using the variable bitrate (VBR) ratecontrol method
[AVHWDeviceContext @ 0x127e140] VAAPI driver: Intel iHD driver - 1.0.0.
[AVHWDeviceContext @ 0x127e140] Driver not found in known nonstandard list, using standard behaviour.
[hevc_qsv @ 0x11f9700] profile: simple; level: 40
[hevc_qsv @ 0x11f9700] GopPicSize: 248; GopRefDist: 9; GopOptFlag: closed ; IdrInterval: 1
[hevc_qsv @ 0x11f9700] TargetUsage: 4; RateControlMethod: VBR
[hevc_qsv @ 0x11f9700] BufferSizeInKB: 250; InitialDelayInKB: 125; TargetKbps: 1000; MaxKbps: 1000; BRCParamMultiplier: 1
[hevc_qsv @ 0x11f9700] NumSlice: 4; NumRefFrame: 5
[hevc_qsv @ 0x11f9700] RateDistortionOpt: unknown
[hevc_qsv @ 0x11f9700] NumTileColumns: 2; NumTileRows: 2
[hevc_qsv @ 0x11f9700] RecoveryPointSEI: unknown IntRefType: 0; IntRefCycleSize: 0; IntRefQPDelta: 0
[hevc_qsv @ 0x11f9700] MaxFrameSize: 0; MaxSliceSize: 0; 
[hevc_qsv @ 0x11f9700] BitrateLimit: unknown; MBBRC: unknown; ExtBRC: OFF
[hevc_qsv @ 0x11f9700] Trellis: auto
[hevc_qsv @ 0x11f9700] VDENC: OFF
[hevc_qsv @ 0x11f9700] RepeatPPS: OFF; NumMbPerSlice: 0; LookAheadDS: unknown
[hevc_qsv @ 0x11f9700] AdaptiveI: unknown; AdaptiveB: unknown; BRefType: pyramid
[hevc_qsv @ 0x11f9700] MinQPI: 0; MaxQPI: 0; MinQPP: 0; MaxQPP: 0; MinQPB: 0; MaxQPB: 0
[hevc_qsv @ 0x11f9700] GPB: ON
[hevc_qsv @ 0x11f9700] FrameRateExtD: 1; FrameRateExtN: 25 
Output #0, hevc, to './qsv.h265':
  Metadata:
    encoder         : Lavf58.35.100
    Stream #0:0: Video: hevc (hevc_qsv), 1 reference frame, qsv, 1920x1080, q=2-31, 1000 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.62.100 hevc_qsv
    Side data:
      cpb: bitrate max/min/avg: 0/0/1000000 buffer size: 0 vbv_delay: N/A
No more output streams to write to, finishing.
frame=   10 fps=0.0 q=-0.0 Lsize=      41kB time=00:00:00.24 bitrate=1388.2kbits/s speed=0.662x    
video:41kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Input file #0 (./1080p_blue_sky.yuv):
  Input stream #0:0 (video): 10 packets read (31104000 bytes); 10 frames decoded; 
  Total: 10 packets (31104000 bytes) demuxed
Output file #0 (./qsv.h265):
  Output stream #0:0 (video): 10 frames encoded; 10 packets muxed (41645 bytes); 
  Total: 10 packets (41645 bytes) muxed
[AVIOContext @ 0x11fa400] Statistics: 0 seeks, 1 writeouts
(null)CRITICAL - UnloadCPLib:131: Invalid m_referenceCount
[AVIOContext @ 0x11e7c80] Statistics: 31104000 bytes read, 0 seeks

by Linjie.Fu, 4 years ago

Attachment: qsv.h265 added

by Linjie.Fu, 4 years ago

Attachment: #8400.png added

screenshot to show the Tiles in the output.

comment:2 by Linjie.Fu, 4 years ago

Patch:
https://patchwork.ffmpeg.org/patch/16416/

Checks in intel-media-ci(including fate/compatible/smoke test):
https://github.com/intel-media-ci/ffmpeg/pull/131

Had one issue in MSDK if default slice (1) was used:
https://github.com/Intel-Media-SDK/MediaSDK/issues/1772

Filed a PR to fix this in MSDK:
https://github.com/Intel-Media-SDK/MediaSDK/pull/1773

Apply this patch in MSDK or set slices large than 1 in cmdline (-slices 2) to verify this feature.

comment:3 by Linjie.Fu, 4 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.