Opened 2 years ago

Last modified 2 years ago

#10898 new defect

gop_size (GopPicSize) defaults to 65535 in hevc_qsv encoding - regression / change of default behavior

Reported by: fedy Owned by:
Priority: normal Component: ffmpeg
Version: 6.0 Keywords:
Cc: fedy Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by fedy)

Summary of the bug:
Seems like the default behavior of the QuickSync hevc_qsv encoder (or maybe ffmpeg as a whole) regarding gop_size have changed. On ffmpeg 6.0.1, if not specified, it defaults to 65535 which results in unseekable encodes (single I frame / IDR frame). My previous test encodes (TAG:encoder=Lavc59.57.100 hevc_qsv) show it used to be 248 for a 25fps video which is much more reasonable.

How to reproduce:

% ffmpeg -hide_banner -loglevel verbose -hwaccel qsv -hwaccel_output_format qsv -c:v h264_qsv -i input.mp4 -map 0 -map -0:d:m:handler_name:TimeCodeHandler -c copy -copy_unknown -c:v hevc_qsv -global_quality 18 -preset slow -vf scale_qsv=format=p010le -write_tmcd auto output.mp4

ffmpeg version 6.0.1
built on ... (Fedora 38 / RPM Fusion)

Other notes:
This behavior isn't completely new - found a reddit thread mentioning the behavior change about a year ago:
https://www.reddit.com/r/ffmpeg/comments/zjwm4r/trouble_with_ffmpeg_using_quicksync_encoded_files/

Looking at the output from:

ffmpeg -h encoder=hevc_qsv

I notice several options of type <int> where the declared range is -1 to 65535. Looks kind of weird: maybe these are 32bit signed values everywhere, just combining a 16-bit unsigned value range (0-65535) and a -1 "default/auto" and everything is fine, but if at any place they are interpreted as 16bit then -1 and 65535 overlap (they are represented as same 16bit bit pattern). Couldn't this be the reason behind the weird 65535 default?

Probably unrelated:
I also can't seem to make the following options work:

-extbrc 1 -adaptive_i 1 -adaptive_b 1

... they show up as:

[hevc_qsv @ 0x55edcbee4340] BitrateLimit: unknown; MBBRC: unknown; ExtBRC: OFF
[hevc_qsv @ 0x55edcbee4340] Trellis: auto
[hevc_qsv @ 0x55edcbee4340] RepeatPPS: OFF; NumMbPerSlice: 0; LookAheadDS: unknown
[hevc_qsv @ 0x55edcbee4340] AdaptiveI: unknown; AdaptiveB: unknown; BRefType:pyramid

... in ffmpeg output

My test platform is: Intel Pentium Silver J5005 (Gemini Lake)

Change History (1)

comment:1 by fedy, 2 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.