summaryrefslogtreecommitdiff
path: root/fftools
diff options
context:
space:
mode:
authorKeyun Tong <ktong@fb.com>2021-06-20 21:42:29 +0200
committerThilo Borgmann <thilo.borgmann@mail.de>2021-07-16 09:50:19 +0200
commitb7266302a40ba48fea7a5644f08623159b3dcac7 (patch)
tree20f3f62082c0ac96e44b5c74163732e12d5f24e3 /fftools
parentb7e350af3e8eaeb4825646a4bcef7fa051bd0a73 (diff)
fftools/ffmpeg: Add new variant source_no_drop to the force_key_frames option
Suggested-By: ffmpeg@fb.com
Diffstat (limited to 'fftools')
-rw-r--r--fftools/ffmpeg.c6
-rw-r--r--fftools/ffmpeg.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index e97d879cb3..1ac2e48600 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1287,6 +1287,7 @@ static void do_video_out(OutputFile *of,
}
}
ost->last_dropped = nb_frames == nb0_frames && next_picture;
+ ost->dropped_keyframe = ost->last_dropped && next_picture && next_picture->key_frame;
/* duplicates frame if needed */
for (i = 0; i < nb_frames; i++) {
@@ -1347,6 +1348,11 @@ static void do_video_out(OutputFile *of,
&& in_picture->key_frame==1
&& !i) {
forced_keyframe = 1;
+ } else if ( ost->forced_keyframes
+ && !strncmp(ost->forced_keyframes, "source_no_drop", 6)
+ && !i) {
+ forced_keyframe = (in_picture->key_frame == 1) || ost->dropped_keyframe;
+ ost->dropped_keyframe = 0;
}
if (forced_keyframe) {
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index e9d30fbd67..3cfb4c4488 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -504,6 +504,7 @@ typedef struct OutputStream {
char *forced_keyframes;
AVExpr *forced_keyframes_pexpr;
double forced_keyframes_expr_const_values[FKF_NB];
+ int dropped_keyframe;
/* audio only */
int *audio_channels_map; /* list of the channels id to pick from the source stream */