summaryrefslogtreecommitdiff
path: root/ffmpeg_opt.c
diff options
context:
space:
mode:
authorMichael Bradshaw <mjbshaw@google.com>2016-12-27 22:05:35 -0800
committerMichael Niedermayer <michael@niedermayer.cc>2017-01-14 20:03:56 +0100
commit3ac46a0a62386a52e38c066379ff36b5038dd4d0 (patch)
treee3341e96841a81e8ce6396ba11f563b2cf1f3c05 /ffmpeg_opt.c
parent743052ec5bd6fef7b0f465dbd9ccc4e570ef8a02 (diff)
ffmpeg: Add -time_base option to hint the time base
Signed-off-by: Michael Bradshaw <mjbshaw@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'ffmpeg_opt.c')
-rw-r--r--ffmpeg_opt.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index a4b8d24991..a1c02fc29b 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -1231,7 +1231,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
OutputStream *ost;
AVStream *st = avformat_new_stream(oc, NULL);
int idx = oc->nb_streams - 1, ret = 0;
- const char *bsfs = NULL;
+ const char *bsfs = NULL, *time_base = NULL;
char *next, *codec_tag = NULL;
double qscale = -1;
int i;
@@ -1308,6 +1308,17 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
ost->encoder_opts = filter_codec_opts(o->g->codec_opts, AV_CODEC_ID_NONE, oc, st, NULL);
}
+ MATCH_PER_STREAM_OPT(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.num <= 0 || q.den <= 0) {
+ av_log(NULL, AV_LOG_FATAL, "Invalid time base: %s\n", time_base);
+ exit_program(1);
+ }
+ st->time_base = 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++) {
@@ -3649,6 +3660,9 @@ const OptionDef options[] = {
{ "sdp_file", HAS_ARG | OPT_EXPERT | OPT_OUTPUT, { .func_arg = opt_sdp_file },
"specify a file in which to print sdp information", "file" },
+ { "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" },
+
{ "bsf", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(bitstream_filters) },
"A comma-separated list of bitstream filters", "bitstream_filters" },
{ "absf", HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_old2new },