forked from FFmpeg/FFmpeg
fftools/ffmpeg: Add new variant source_no_drop to the force_key_frames option
Suggested-By: ffmpeg@fb.com
This commit is contained in:
parent
b7e350af3e
commit
b7266302a4
3 changed files with 14 additions and 0 deletions
|
@ -1011,6 +1011,7 @@ Deprecated see -bsf
|
||||||
@item -force_key_frames[:@var{stream_specifier}] @var{time}[,@var{time}...] (@emph{output,per-stream})
|
@item -force_key_frames[:@var{stream_specifier}] @var{time}[,@var{time}...] (@emph{output,per-stream})
|
||||||
@item -force_key_frames[:@var{stream_specifier}] expr:@var{expr} (@emph{output,per-stream})
|
@item -force_key_frames[:@var{stream_specifier}] expr:@var{expr} (@emph{output,per-stream})
|
||||||
@item -force_key_frames[:@var{stream_specifier}] source (@emph{output,per-stream})
|
@item -force_key_frames[:@var{stream_specifier}] source (@emph{output,per-stream})
|
||||||
|
@item -force_key_frames[:@var{stream_specifier}] source_no_drop (@emph{output,per-stream})
|
||||||
|
|
||||||
@var{force_key_frames} can take arguments of the following form:
|
@var{force_key_frames} can take arguments of the following form:
|
||||||
|
|
||||||
|
@ -1072,6 +1073,12 @@ starting from second 13:
|
||||||
If the argument is @code{source}, ffmpeg will force a key frame if
|
If the argument is @code{source}, ffmpeg will force a key frame if
|
||||||
the current frame being encoded is marked as a key frame in its source.
|
the current frame being encoded is marked as a key frame in its source.
|
||||||
|
|
||||||
|
@item source_no_drop
|
||||||
|
If the argument is @code{source_no_drop}, ffmpeg will force a key frame if
|
||||||
|
the current frame being encoded is marked as a key frame in its source.
|
||||||
|
In cases where this particular source frame has to be dropped,
|
||||||
|
enforce the next available frame to become a key frame instead.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
Note that forcing too many keyframes is very harmful for the lookahead
|
Note that forcing too many keyframes is very harmful for the lookahead
|
||||||
|
|
|
@ -1287,6 +1287,7 @@ static void do_video_out(OutputFile *of,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ost->last_dropped = nb_frames == nb0_frames && next_picture;
|
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 */
|
/* duplicates frame if needed */
|
||||||
for (i = 0; i < nb_frames; i++) {
|
for (i = 0; i < nb_frames; i++) {
|
||||||
|
@ -1347,6 +1348,11 @@ static void do_video_out(OutputFile *of,
|
||||||
&& in_picture->key_frame==1
|
&& in_picture->key_frame==1
|
||||||
&& !i) {
|
&& !i) {
|
||||||
forced_keyframe = 1;
|
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) {
|
if (forced_keyframe) {
|
||||||
|
|
|
@ -504,6 +504,7 @@ typedef struct OutputStream {
|
||||||
char *forced_keyframes;
|
char *forced_keyframes;
|
||||||
AVExpr *forced_keyframes_pexpr;
|
AVExpr *forced_keyframes_pexpr;
|
||||||
double forced_keyframes_expr_const_values[FKF_NB];
|
double forced_keyframes_expr_const_values[FKF_NB];
|
||||||
|
int dropped_keyframe;
|
||||||
|
|
||||||
/* audio only */
|
/* audio only */
|
||||||
int *audio_channels_map; /* list of the channels id to pick from the source stream */
|
int *audio_channels_map; /* list of the channels id to pick from the source stream */
|
||||||
|
|
Loading…
Add table
Reference in a new issue