aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-08-07 00:03:50 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-08-07 00:03:50 +0000
commitd4d226a8d56b44653d316420618beefad86cea3b (patch)
tree0996d73da1e91777be7343933d2fee8c460a31be
parent6ea67bbb60e54ffd1f9dbb4cc7636b83181fba5e (diff)
downloadffmpeg-d4d226a8d56b44653d316420618beefad86cea3b.tar.gz
audio drift threshold
(this switches between resampling style timestamp drift compensation and hard insert silence / drop samples compensation) Originally committed as revision 9969 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--ffmpeg.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 7fc17fe720..0608ae6dea 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -178,6 +178,7 @@ static int video_stream_copy = 0;
static int subtitle_stream_copy = 0;
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 opt_shortest = 0; //
static int video_global_header = 0;
@@ -453,7 +454,7 @@ static void do_audio_out(AVFormatContext *s,
//FIXME resample delay
if(fabs(delta) > 50){
- if(ist->is_start){
+ if(ist->is_start || fabs(delta) > audio_drift_threshold*enc->sample_rate){
if(byte_delta < 0){
byte_delta= FFMAX(byte_delta, -size);
size += byte_delta;
@@ -3607,6 +3608,7 @@ const OptionDef options[] = {
{ "threads", HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
{ "vsync", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_sync_method}, "video sync method", "" },
{ "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", "" },
{ "vglobal", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_global_header}, "video global header storage type", "" },
{ "copyts", OPT_BOOL | OPT_EXPERT, {(void*)&copy_ts}, "copy timestamps" },
{ "shortest", OPT_BOOL | OPT_EXPERT, {(void*)&opt_shortest}, "finish encoding within shortest input" }, //