From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 220754767B for ; Tue, 19 Sep 2023 19:21:55 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1469A68C93F; Tue, 19 Sep 2023 22:21:07 +0300 (EEST) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9319E68C911 for ; Tue, 19 Sep 2023 22:21:03 +0300 (EEST) Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 406BD10 for ; Tue, 19 Sep 2023 21:21:03 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id qgFWwWEVMIG1 for ; Tue, 19 Sep 2023 21:20:58 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id 5F1425138 for ; Tue, 19 Sep 2023 21:20:42 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 528D93A0212 for ; Tue, 19 Sep 2023 21:20:42 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 19 Sep 2023 21:10:34 +0200 Message-Id: <20230919191044.18873-8-anton@khirnov.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230919191044.18873-1-anton@khirnov.net> References: <20230919191044.18873-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 07/27] fftools/ffmpeg_enc: unbreak -force_key_frames source_no_drop X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Unlike the 'source' mode, which preserves source keyframe-marking as-is, the 'source_no_drop' mode attempts to keep track of keyframes dropped by framerate conversion and mark the next output frame as key in such cases. However, * c75be061487 broke this functionality entirely, and made it equivalent to 'source' * even before it would only work when the frame immediately following the dropped keyframe is preserved and not dropped as well Also, drop a redundant check for 'frame' in setting dropped_keyframe, as it is redundant with the check on the above line. --- fftools/ffmpeg_enc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index df79eaff59..1db67d1497 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -1066,7 +1066,7 @@ finish: } ost->last_dropped = *nb_frames == *nb_frames_prev && frame; - ost->kf.dropped_keyframe = ost->last_dropped && frame && (frame->flags & AV_FRAME_FLAG_KEY); + ost->kf.dropped_keyframe |= ost->last_dropped && (frame->flags & AV_FRAME_FLAG_KEY); } static enum AVPictureType forced_kf_apply(void *logctx, KeyframeForceCtx *kf, @@ -1109,8 +1109,9 @@ static enum AVPictureType forced_kf_apply(void *logctx, KeyframeForceCtx *kf, (in_picture->flags & AV_FRAME_FLAG_KEY) && !dup_idx) { goto force_keyframe; } else if (kf->type == KF_FORCE_SOURCE_NO_DROP && !dup_idx) { + int dropped_keyframe = kf->dropped_keyframe; kf->dropped_keyframe = 0; - if ((in_picture->flags & AV_FRAME_FLAG_KEY) || kf->dropped_keyframe) + if ((in_picture->flags & AV_FRAME_FLAG_KEY) || dropped_keyframe) goto force_keyframe; } -- 2.40.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".