1 @TEMPLATE encoder_tmpl.c 2 Forcing A Keyframe 3 ================== 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION 5 This is an example demonstrating how to control placement of keyframes 6 on a frame-by-frame basis. 7 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION 8 9 10 Configuration 11 ------------- 12 Keyframes can be forced by setting the VPX_EFLAG_FORCE_KF bit of the 13 flags passed to `vpx_codec_control()`. In this example, we force a 14 keyframe every 8 frames. 15 16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PER_FRAME_CFG 17 if(!(frame_cnt & 7)) 18 flags |= VPX_EFLAG_FORCE_KF; 19 else 20 flags &= ~VPX_EFLAG_FORCE_KF; 21 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PER_FRAME_CFG 22 23 24 Observing The Effects 25 --------------------- 26 The output of the encoder examples shows a 'K' rather than a dot '.' 27 when the encoder generates a keyframe. Note that every 8 frames a 'K' 28 is output. 29