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

Vignesh Venkat vigneshv at google.com
Wed Jun 28 19:48:35 EEST 2023


On Tue, Jun 27, 2023 at 12:07 PM Ronald S. Bultje <rsbultje at gmail.com> wrote:
>
> Hi Vignesh,
>
> On Tue, Jun 27, 2023 at 1:55 PM Vignesh Venkat <
> vigneshv-at-google.com at ffmpeg.org> wrote:
>
> > > >>> In some versions of libsvtav1, setting intra_period_length to 0
> >
> [..]
>
> > > >>> 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.
> >
> [..]
>
> > From what i tested, it seems to be there on the tip of tree SVT-AV1 as
> > well. So we can't guard it with macros until the issue is fixed.
> >
>
> Isn't this the expected behaviour, btw?
>
> See https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/Docs/Parameters.md
>
> "Keyint --keyint [-2-(2^31)-1] -2 GOP size (frames), use s suffix for
> seconds (SvtAv1EncApp only) [-2: ~5 seconds, -1: "infinite" only for CRF,
> 0: == -1] "
>
> note the final parts: 0=-1, and -1 means "infinite" keyint (i.e. never
> insert a new KF). Since FFmpeg's wrapper sets keyint to "gopsize value
> minus 1", "-g 1" seems to become equivalent to "--keyint 0" on the SVT-AV1
> commandline, unless there's some discrepancy between API and CLI interface.
>

Yes, it might be working as documented in the SVT-AV1 API. But the
point is that we would need a way to force all key frames (as i think
that is what a user would mean when they set "-g 1" in ffmpeg?).

> (I admit that if I set it to 1, I don't actually get keyframes, but rather
> intraonly frames for all except the first frame. --keyint 2 correctly uses
> key - inter pairs. But your "before" statement above appeared to suggest
> that the first keyframe is followed by inter frames, not intraonly frames.
> If you meant "intraonly after key" instead of "inter after key", you should
> probably note that more explicitly. This may also help upstream reproduce
> in #2076 so they can fix it going forward.)

yeah i wasn't really paying attention to whether the subsequent frames
were intra-only or inter frames. i was just looking at whether or not
they were keyframes. :)

i will update the upstream bug to clarify this part. but in the
meantime, i think this patch is reasonable to replicate the behavior
of other AV1 encoders with -g 1.

>
> Ronald
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



-- 
Vignesh


More information about the ffmpeg-devel mailing list