[FFmpeg-devel] [PATCH] libsvtav1: Add workaround for gop_size == 1

James Almer jamrial at gmail.com
Tue Jun 27 02:53:44 EEST 2023


On 6/26/2023 7:32 PM, Vignesh Venkat wrote:
> On Mon, Jun 26, 2023 at 3:17 PM Ronald S. Bultje <rsbultje at gmail.com> wrote:
>>
>> Hi,
>>
>> On Mon, Jun 26, 2023 at 1:47 PM Vignesh Venkatasubramanian <vigneshv-at-google.com at ffmpeg.org> wrote:
>>>
>>> In some versions of libsvtav1, setting intra_period_length to 0
>>> does not produce the intended result (i.e.) all frames produced
>>> are not keyframes.
>>>
>>> Instead handle the gop_size == 1 as a special case by setting
>>> the pic_type to EB_AV1_KEY_PICTURE when encoding each frame so
>>> that all the output frames are keyframes.
>>>
>>> SVT-AV1 Bug: https://gitlab.com/AOMediaCodec/SVT-AV1/-/issues/2076
>>>
>>> Example command: ffmpeg -f lavfi -i testsrc=duration=1:size=64x64:rate=30 -c:v libsvtav1 -g 1 -y test.webm
>>>
>>> Before: Only first frame is keyframe.
>>> After: All frames are keyframes.
>>>
>>> Signed-off-by: Vignesh Venkatasubramanian <vigneshv at google.com>
>>> ---
>>>   libavcodec/libsvtav1.c | 16 +++++++++++++++-
>>>   1 file changed, 15 insertions(+), 1 deletion(-)
>>
>>
>> It feels a bit dirty to add workarounds in ffmpeg library wrappers for bugs in these libraries. Not 100% against it, but it's not particularly great.
>>
> 
> Yeah I agree that it's not ideal. But minor changes like this that are
> commented/documented is okay i believe.

What are the buggy svt-av1 versions? Can this be wrapped in a 
preprocessor check, so that if we bump the minimum required version in 
the future and it's newer, this change can be removed/undone?


More information about the ffmpeg-devel mailing list