aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-01 03:06:16 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-01 03:49:37 +0100
commit6e96ad8215a6950b4d303e784ca35860ba765478 (patch)
tree955dbd2dec311cc50a58d8be414cd3757c47a0ca /ffmpeg.c
parent9d76cf0b18976487d71e39bbdc1b53755e366535 (diff)
downloadffmpeg-6e96ad8215a6950b4d303e784ca35860ba765478.tar.gz
ffmpeg: make copy_tb tri state so the user can select either timebase or
leave it at auto Inspired-by a change from Anton Khirnov Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index b33506a09a..fb30c8e0c0 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -142,7 +142,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= 0;
+static int copy_tb= -1;
static int opt_shortest = 0;
static char *vstats_filename;
static FILE *vstats_file;
@@ -2193,15 +2193,17 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
codec->time_base = ist->st->time_base;
if(!strcmp(oc->oformat->name, "avi")) {
- if (!copy_tb &&
- av_q2d(icodec->time_base)*icodec->ticks_per_frame > 2*av_q2d(ist->st->time_base) &&
- av_q2d(ist->st->time_base) < 1.0/500){
+ if ( copy_tb<0 && av_q2d(icodec->time_base)*icodec->ticks_per_frame > 2*av_q2d(ist->st->time_base)
+ && av_q2d(ist->st->time_base) < 1.0/500
+ || copy_tb==0){
codec->time_base = icodec->time_base;
codec->time_base.num *= icodec->ticks_per_frame;
codec->time_base.den *= 2;
}
} else if(!(oc->oformat->flags & AVFMT_VARIABLE_FPS)) {
- 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/500){
+ if( copy_tb<0 && av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base)
+ && av_q2d(ist->st->time_base) < 1.0/500
+ || copy_tb==0){
codec->time_base = icodec->time_base;
codec->time_base.num *= icodec->ticks_per_frame;
}
@@ -4666,7 +4668,7 @@ static const OptionDef options[] = {
{ "async", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&audio_sync_method}, "audio sync method", "" },
{ "adrift_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&audio_drift_threshold}, "audio drift threshold", "threshold" },
{ "copyts", OPT_BOOL | OPT_EXPERT, {(void*)&copy_ts}, "copy timestamps" },
- { "copytb", OPT_BOOL | OPT_EXPERT, {(void*)&copy_tb}, "copy input stream time base when stream copying" },
+ { "copytb", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&copy_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" },
{ "xerror", OPT_BOOL, {(void*)&exit_on_error}, "exit on error", "error" },