aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-07-25 20:48:55 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-07-25 20:48:55 +0200
commit981f6fc988dc33e81566fdaf4087da3cfa3ddb04 (patch)
tree9a295fda5466559729ac034943ba3ead5871e636
parent158eb8599a2811ad8eed9939878982f172b79a89 (diff)
downloadffmpeg-981f6fc988dc33e81566fdaf4087da3cfa3ddb04.tar.gz
ffmpeg: better timebase guessing for stream copy
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--ffmpeg.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index fb72a3a5d1..5a1ab0f64d 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2237,13 +2237,23 @@ static int transcode(AVFormatContext **output_files,
goto fail;
memcpy(codec->extradata, icodec->extradata, icodec->extradata_size);
codec->extradata_size= icodec->extradata_size;
- 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){
- codec->time_base = icodec->time_base;
- codec->time_base.num *= icodec->ticks_per_frame;
- av_reduce(&codec->time_base.num, &codec->time_base.den,
- codec->time_base.num, codec->time_base.den, INT_MAX);
- }else
- codec->time_base = ist->st->time_base;
+
+ codec->time_base = ist->st->time_base;
+ if(!strcmp(os->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){
+ codec->time_base = icodec->time_base;
+ codec->time_base.num *= icodec->ticks_per_frame;
+ codec->time_base.den *= 2;
+ }
+ } else if(!(os->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){
+ codec->time_base = icodec->time_base;
+ codec->time_base.num *= icodec->ticks_per_frame;
+ }
+ }
+ av_reduce(&codec->time_base.num, &codec->time_base.den,
+ codec->time_base.num, codec->time_base.den, INT_MAX);
+
switch(codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
if(audio_volume != 256) {