diff options
author | erankor <eran.kornblau@kaltura.com> | 2017-05-03 11:50:15 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-10 14:00:20 +0200 |
commit | 2b06f2d2e24ccc4098f3ab40efd68e8f3f02b273 (patch) | |
tree | 2257e48c62074ecf19683c90221f03664f6c29be /ffmpeg_opt.c | |
parent | 6ce57fb3c2ef139bbe164d1811422b91e2dedc26 (diff) | |
download | ffmpeg-2b06f2d2e24ccc4098f3ab40efd68e8f3f02b273.tar.gz |
ffmpeg: add enc_time_base option
add a per-stream option for setting the encoder timebase.
the following values are allowed:
0 - for video, use 1/frame_rate, for audio use 1/sample_rate (this is
the default)
-1 - match the input timebase (when possible)
>0 - set the timebase to provided number
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'ffmpeg_opt.c')
-rw-r--r-- | ffmpeg_opt.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index ce85f324cf..4720e12269 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1311,6 +1311,17 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e st->time_base = q; } + MATCH_PER_STREAM_OPT(enc_time_bases, str, time_base, oc, st); + if (time_base) { + AVRational q; + if (av_parse_ratio(&q, time_base, INT_MAX, 0, NULL) < 0 || + q.den <= 0) { + av_log(NULL, AV_LOG_FATAL, "Invalid time base: %s\n", time_base); + exit_program(1); + } + ost->enc_timebase = q; + } + ost->max_frames = INT64_MAX; MATCH_PER_STREAM_OPT(max_frames, i64, ost->max_frames, oc, st); for (i = 0; i<o->nb_max_frames; i++) { @@ -3629,6 +3640,11 @@ const OptionDef options[] = { { "time_base", HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(time_bases) }, "set the desired time base hint for output stream (1:24, 1:48000 or 0.04166, 2.0833e-5)", "ratio" }, + { "enc_time_base", HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(enc_time_bases) }, + "set the desired time base for the encoder (1:24, 1:48000 or 0.04166, 2.0833e-5). " + "two special values are defined - " + "0 = use frame rate (video) or sample rate (audio)," + "-1 = match source time base", "ratio" }, { "bsf", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(bitstream_filters) }, "A comma-separated list of bitstream filters", "bitstream_filters" }, |