[Libav-user] Question regarding ffmpeg's use of Intel's HEVC encoder

George Crenshaw curiously_georgely at yahoo.com
Thu Nov 17 19:41:37 EET 2022


I have a question about how ffmpeg is interacting with Intel's
hevc_qsv encoder.

I inherited a task from a coworker ("coworker #1") to write a C
program to use Intel's HEVC encoder to create a video from a series of
large .tif images. The .tif files are of resolution 7000x6000. For a
quick test, I modified one of Intel's sample programs in order to
process images of that size, but their encoder raises an error when
you try to initialize it with image dimensions larger than 8192x4320
(i.e., it's rejecting the images based on the image height).

Coworker #2 then discovered that ffmpeg can apparently use Intel's
encoder to process the full-size images. I looked at some of ffmpeg's
code to see how it sets up its call to MFXVideoENCODE_Init (file
libavcodec/qsvenc.c, function ff_qsv_enc_init(...)), but nothing
screams, for example, "this setting tells the encoder to process
images that exceed the HEVC standard's resolution."

Coworker #2 sent me a log from processing a second set of images at
resolution 6576x4384 (smaller, but the height is still > 4320) with
the "-report" flag enabled. Again, I didn't see anything in the log
output that hinted at settings for how large images are processed.
I'll paste the result of dump_video_param below.

Anyway, my question is, is there a trick to configuring Intel's
encoder to process large images, without rejecting the resolution as
invalid, even if the image dimensions exceed the HEVC spec? Coworker
#1 asked on Intel's forums, but they were no help. Is ffmpeg doing
something behind the scenes, for example, to process the large image
in smaller frames and then reassemble them?

Final bit of info. My code test was done on Linux, which is our target
platform, but coworker #2's ffmpeg test was done on Windows. If it
turns out to be a platform issue (eg. the Windows driver doesn't have
the same limitations as the Linux one), then it is what it is, we'd
just like to know so don't spend more time investigating it. However,
coworker #2 said he *has* processed the full-size images with ffmpeg
on Linux, so I don't think it's a platform issue.

Thanks in advance,

dump_video_param output below:

Command line:
"ffmpeg.exe" -i "C:\\path\\to\\testing\\src-images\\%03d.tif" -c:v hevc_qsv -load_plugin 2 -global_quality 40 -preset slow -low_power 0 -y -pix_fmt p010le -hide_banner -report "C:\\path\\to\\testing\\output.mp4"
[ ... ]
[file @ 0000027c5b82ed80] Setting default whitelist 'file,crypto,data'
[auto_scale_0 @ 0000027c60c92f00] w:6576 h:4384 fmt:gray16le sar:0/1 -> w:6576 h:4384 fmt:p010le sar:0/1 flags:0x0
[AVIOContext @ 0000027c7cc70e40] Statistics: 57658639 bytes read, 0 seeks
[hevc_qsv @ 0000027c5b82d840] Encoder: input is system memory surface
[hevc_qsv @ 0000027c5b82d840] Use Intel(R) Media SDK to create MFX session, the required implementation version is 1.1
[hevc_qsv @ 0000027c5b82d840] Initialized an internal MFX session using hardware accelerated implementation
[hevc_qsv @ 0000027c5b82d840] Using the intelligent constant quality (ICQ) ratecontrol method
[hevc_qsv @ 0000027c5b82d840] profile: hevc main10; level: 317
[hevc_qsv @ 0000027c5b82d840] GopPicSize: 65535; GopRefDist: 4; GopOptFlag: strict; IdrInterval: 1
[hevc_qsv @ 0000027c5b82d840] TargetUsage: 4; RateControlMethod: ICQ
[hevc_qsv @ 0000027c5b82d840] ICQQuality: 40
[hevc_qsv @ 0000027c5b82d840] NumSlice: 1; NumRefFrame: 3
[hevc_qsv @ 0000027c5b82d840] RateDistortionOpt: unknown
[hevc_qsv @ 0000027c5b82d840] RecoveryPointSEI: unknown
[hevc_qsv @ 0000027c5b82d840] VDENC: OFF
[hevc_qsv @ 0000027c5b82d840] NalHrdConformance: OFF; VuiNalHrdParameters: OFF
[hevc_qsv @ 0000027c5b82d840] FrameRateExtD: 1; FrameRateExtN: 25
[hevc_qsv @ 0000027c5b82d840] IntRefType: 0; IntRefCycleSize: 0; IntRefQPDelta: 0
[hevc_qsv @ 0000027c5b82d840] MaxFrameSize: 0; MaxSliceSize: 0
[hevc_qsv @ 0000027c5b82d840] BitrateLimit: unknown; MBBRC: unknown; ExtBRC: OFF
[hevc_qsv @ 0000027c5b82d840] Trellis: auto
[hevc_qsv @ 0000027c5b82d840] RepeatPPS: OFF; NumMbPerSlice: 0; LookAheadDS: unknown
[hevc_qsv @ 0000027c5b82d840] AdaptiveI: unknown; AdaptiveB: unknown; BRefType:pyramid
[hevc_qsv @ 0000027c5b82d840] MinQPI: 12; MaxQPI: 63; MinQPP: 12; MaxQPP: 63; MinQPB: 12; MaxQPB: 63
[hevc_qsv @ 0000027c5b82d840] DisableDeblockingIdc: 0
[hevc_qsv @ 0000027c5b82d840] PRefType: default
[hevc_qsv @ 0000027c5b82d840] GPB: ON
[hevc_qsv @ 0000027c5b82d840] TransformSkip: ON
[hevc_qsv @ 0000027c5b82d840] IntRefCycleDist: 0
[hevc_qsv @ 0000027c5b82d840] LowDelayBRC: OFF
[hevc_qsv @ 0000027c5b82d840] MaxFrameSizeI: 0; MaxFrameSizeP: 0
[hevc_qsv @ 0000027c5b82d840] ScenarioInfo: 0

More information about the Libav-user mailing list