[FFmpeg-devel] [PATCH 2/2] ffmpeg: Don't clear input pict_type if force_key_frames is source

Will Kelleher wkelleher at gogoair.com
Fri Dec 11 16:47:29 CET 2015


The current behavior doesn't forward non-IDR I-frames to the encoder.

Signed-off-by: Will Kelleher <wkelleher at gogoair.com>
---
 ffmpeg.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index a866f72..61739a4 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1141,7 +1141,6 @@ static void do_video_out(AVFormatContext *s,
             mux_enc->field_order = AV_FIELD_PROGRESSIVE;
 
         in_picture->quality = enc->global_quality;
-        in_picture->pict_type = 0;
 
         pts_time = in_picture->pts != AV_NOPTS_VALUE ?
             in_picture->pts * av_q2d(enc->time_base) : NAN;
@@ -1173,13 +1172,15 @@ static void do_video_out(AVFormatContext *s,
             ost->forced_keyframes_expr_const_values[FKF_N] += 1;
         } else if (   ost->forced_keyframes
                    && !strncmp(ost->forced_keyframes, "source", 6)
-                   && in_picture->key_frame==1) {
+                   && in_picture->pict_type==AV_PICTURE_TYPE_I) {
             forced_keyframe = 1;
         }
 
         if (forced_keyframe) {
             in_picture->pict_type = AV_PICTURE_TYPE_I;
             av_log(NULL, AV_LOG_DEBUG, "Forced keyframe at time %f\n", pts_time);
+        } else {
+            in_picture->pict_type = 0;
         }
 
         update_benchmark(NULL);
-- 
2.6.2



More information about the ffmpeg-devel mailing list