diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-07-25 20:48:55 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-07-25 20:48:55 +0200 |
commit | 981f6fc988dc33e81566fdaf4087da3cfa3ddb04 (patch) | |
tree | 9a295fda5466559729ac034943ba3ead5871e636 | |
parent | 158eb8599a2811ad8eed9939878982f172b79a89 (diff) | |
download | ffmpeg-981f6fc988dc33e81566fdaf4087da3cfa3ddb04.tar.gz |
ffmpeg: better timebase guessing for stream copy
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | ffmpeg.c | 24 |
1 files changed, 17 insertions, 7 deletions
@@ -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) { |