[FFmpeg-devel] [RFC] Keyframe interval in the libvpx encoder

James Zern jzern
Mon Jun 7 19:04:18 CEST 2010


On Sat, Jun 5, 2010 at 09:22, Martin Storsj? <martin at martin.st> wrote:
> Hi,
>
> Currently, the libvpx encoder sets VPX_KF_FIXED if keyint_min == gop_size.
> According to the libvpx header:
>
> ?* This enumeration determines whether keyframes are placed automatically by
> ?* the encoder or whether this behavior is disabled. Older releases of this
> ?* SDK were implemented such that VPX_KF_FIXED meant keyframes were disabled.
> ?* This name is confusing for this behavior, so the new symbols to be used
> ?* are VPX_KF_AUTO and VPX_KF_DISABLED.
>
> So, if keyint_min happens to be exactly equal to gop_size, it in practice
> means no keyframes are placed at all. That can't be the correct behaviour,
> can it? This would be fixed with the attached patch.
>
> If such behaviour, no keyframes at all, should be exposed through the lavc
> API, I don't think it should be for the case of keyint_min == gop_size at
> least.
>
I agree that wasn't the intended effect and a no keyframe option would
probably be of limited use.
The attached keeps the check, but leaves the mode set to auto. In this
case the libvpx/vp8 interface will force a keyframe at this interval.
-------------- next part --------------
Index: libavcodec/libvpxenc.c
===================================================================
--- libavcodec/libvpxenc.c	(revision 23514)
+++ libavcodec/libvpxenc.c	(working copy)
@@ -241,10 +241,8 @@ static av_cold int vp8_init(AVCodecConte
     enccfg.rc_min_quantizer = ((avctx->qmin * 5 + 1) >> 2) - 1;
     enccfg.rc_max_quantizer = ((avctx->qmax * 5 + 1) >> 2) - 1;
 
+    //_enc_init() will balk if kf_min_dist differs from max w/VPX_KF_AUTO
     if (avctx->keyint_min == avctx->gop_size)
-        enccfg.kf_mode = VPX_KF_FIXED;
-    //_enc_init() will balk if kf_min_dist is set in this case
-    if (enccfg.kf_mode != VPX_KF_AUTO)
         enccfg.kf_min_dist = avctx->keyint_min;
     enccfg.kf_max_dist     = avctx->gop_size;
 



More information about the ffmpeg-devel mailing list