mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-26 16:51:29 +00:00
ffmpeg: fix forced key frames.
Now that the option was moved in the per-stream context, the parsing is done before the time_base for the stream is decided. This patch does the parsing in AV_TIME_BASE units and rescales the timestamps later when the correct time base is known. Signed-off-by: Nicolas George <nicolas.george@normalesup.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
714517b26a
commit
2c1c0c5024
12
ffmpeg.c
12
ffmpeg.c
@ -2220,6 +2220,10 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
|
|||||||
av_log(os, AV_LOG_WARNING, "Frame rate very high for a muxer not effciciently supporting it.\n"
|
av_log(os, AV_LOG_WARNING, "Frame rate very high for a muxer not effciciently supporting it.\n"
|
||||||
"Please consider specifiying a lower framerate, a different muxer or -vsync 2\n");
|
"Please consider specifiying a lower framerate, a different muxer or -vsync 2\n");
|
||||||
}
|
}
|
||||||
|
for (j = 0; j < ost->forced_kf_count; j++)
|
||||||
|
ost->forced_kf_pts[j] = av_rescale_q(ost->forced_kf_pts[j],
|
||||||
|
AV_TIME_BASE_Q,
|
||||||
|
codec->time_base);
|
||||||
|
|
||||||
#if CONFIG_AVFILTER
|
#if CONFIG_AVFILTER
|
||||||
if (configure_video_filters(ist, ost)) {
|
if (configure_video_filters(ist, ost)) {
|
||||||
@ -3171,11 +3175,10 @@ static int opt_input_file(OptionsContext *o, const char *opt, const char *filena
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_forced_key_frames(char *kf, OutputStream *ost, AVCodecContext *avctx)
|
static void parse_forced_key_frames(char *kf, OutputStream *ost)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
int n = 1, i;
|
int n = 1, i;
|
||||||
int64_t t;
|
|
||||||
|
|
||||||
for (p = kf; *p; p++)
|
for (p = kf; *p; p++)
|
||||||
if (*p == ',')
|
if (*p == ',')
|
||||||
@ -3188,8 +3191,7 @@ static void parse_forced_key_frames(char *kf, OutputStream *ost, AVCodecContext
|
|||||||
}
|
}
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
p = i ? strchr(p, ',') + 1 : kf;
|
p = i ? strchr(p, ',') + 1 : kf;
|
||||||
t = parse_time_or_die("force_key_frames", p, 1);
|
ost->forced_kf_pts[i] = parse_time_or_die("force_key_frames", p, 1);
|
||||||
ost->forced_kf_pts[i] = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3382,7 +3384,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
|
|||||||
|
|
||||||
MATCH_PER_STREAM_OPT(forced_key_frames, str, forced_key_frames, oc, st);
|
MATCH_PER_STREAM_OPT(forced_key_frames, str, forced_key_frames, oc, st);
|
||||||
if (forced_key_frames)
|
if (forced_key_frames)
|
||||||
parse_forced_key_frames(forced_key_frames, ost, video_enc);
|
parse_forced_key_frames(forced_key_frames, ost);
|
||||||
|
|
||||||
MATCH_PER_STREAM_OPT(force_fps, i, force_fps, oc, st);
|
MATCH_PER_STREAM_OPT(force_fps, i, force_fps, oc, st);
|
||||||
ost->force_fps = force_fps;
|
ost->force_fps = force_fps;
|
||||||
|
Loading…
Reference in New Issue
Block a user