[FFmpeg-devel] [PATCH] fix stream copy

Maksym Veremeyenko verem
Thu Jan 14 10:00:13 CET 2010


Baptiste Coudurier ???????(??):
[...]
> If codec does not contain a timebase, there is no "correct" time base.
> The only time base that is correct is the stream time base.
Why just do not leave codec->time_base equal to zero instead of 
defaulting it to stream->time_base and later guessing to frame_rate?...

Not setted codec->time_base will indicate that /there is no "correct" 
time base/ and it should avoid some misbehavior later...

> codec time_base will be overriden by decoder later if the information is 
> in the codec bitstream. Some codecs do not store the information though.
i looked into libavcodec and found only mpeg decoding (i could be wrong) 
initialize codec->time_base in decoder init stage, dv decoder update 
time_base during decoding frame...

> Although the specific stts count == 1 should be correct, this will only 
> handle one limited case.
yeah, but i think it set proper codec->time_base value then later 
functions....

[...]
>>> Did you check the code stopping the copy instead ?
>> I not sure i clear understand *code stopping the copy*, could you 
>> clarify?
>>
> 
> The code that handles -t in ffmpeg.c
most interesting parts of ffmpeg.c:
[...]
1868            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){
1869                codec->time_base = icodec->time_base;
1870                codec->time_base.num *= icodec->ticks_per_frame;
1871            }else
1872                codec->time_base = ist->st->time_base;
[...]
2212            if(ost->st->codec->codec_type == CODEC_TYPE_VIDEO)
2213                opts = ost->sync_opts * 
av_q2d(ost->st->codec->time_base);
2214            else
2215                opts = ost->st->pts.val * av_q2d(ost->st->time_base);
[...]
2244        /* finish if recording time exhausted */
2245        if (opts_min >= (recording_time / 1000000.0))
2246            break;

it calc opts in init 1/600 or 1/2997 in my cases...

i am currently trying dig this code....

-- 
________________________________________
Maksym Veremeyenko




More information about the ffmpeg-devel mailing list