[FFmpeg-devel] [PATCH] fix stream copy

Baptiste Coudurier baptiste.coudurier
Thu Jan 14 08:55:25 CET 2010

On 1/13/10 11:31 PM, Maksym Veremeyenko wrote:
> Baptiste Coudurier ???????(??):
>> On 01/13/2010 07:09 AM, Maksym Veremeyenko wrote:
>>> Hi,
>>> During cutting some MOV files i found strange behavior with number of
>>> frames copied to new file. The problems come from wrong codec->timebase
>>> value that is guessed from stream->time_base. For MOV stream->time_base
>>> is setted from time_scale that could be 25, 60, 6000, 2997 values - as
>>> result stream->time_base will have a values 1/25, 1/600, 1/2997 (i have
>>> such sample). That cause codec->timebase been set to that values later:
>> This value is a time base like its name indicate, not a frame rate.
>> However, the fps value is right if you notice as is the tbr
>> (r_frame_rate).
> My patch is looks like a hack but that was attempt to save correct
> values of codec->timebase.

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.

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.

Although the specific stts count == 1 should be correct, this will only 
handle one limited case.


>> 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

Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org

More information about the ffmpeg-devel mailing list