From 0f27e6b4c2dddd7fc147a8df9d35b0fc7a23bd58 Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Fri, 14 Jan 2011 22:01:49 +0000 Subject: New "copytb" ffmpeg cli option to copy input stream time base when stream copying. This should avoid non monotone timestamps for video streams with vfr. Originally committed as revision 26340 to svn://svn.ffmpeg.org/ffmpeg/trunk --- ffmpeg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ffmpeg.c') diff --git a/ffmpeg.c b/ffmpeg.c index d2a7b6a3c2..2f8cea1a36 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -213,6 +213,7 @@ static int video_sync_method= -1; static int audio_sync_method= 0; static float audio_drift_threshold= 0.1; static int copy_ts= 0; +static int copy_tb; static int opt_shortest = 0; static int video_global_header = 0; static char *vstats_filename; @@ -2143,7 +2144,7 @@ static int transcode(AVFormatContext **output_files, goto fail; memcpy(codec->extradata, icodec->extradata, icodec->extradata_size); codec->extradata_size= icodec->extradata_size; - if(av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/1000){ + if(!copy_tb && av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/1000){ codec->time_base = icodec->time_base; codec->time_base.num *= icodec->ticks_per_frame; av_reduce(&codec->time_base.num, &codec->time_base.den, @@ -4214,6 +4215,7 @@ static const OptionDef options[] = { { "adrift_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&audio_drift_threshold}, "audio drift threshold", "threshold" }, { "vglobal", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_global_header}, "video global header storage type", "" }, { "copyts", OPT_BOOL | OPT_EXPERT, {(void*)©_ts}, "copy timestamps" }, + { "copytb", OPT_BOOL | OPT_EXPERT, {(void*)©_tb}, "copy input stream time base when stream copying" }, { "shortest", OPT_BOOL | OPT_EXPERT, {(void*)&opt_shortest}, "finish encoding within shortest input" }, // { "dts_delta_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&dts_delta_threshold}, "timestamp discontinuity delta threshold", "threshold" }, { "programid", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&opt_programid}, "desired program number", "" }, -- cgit v1.2.3