[FFmpeg-devel] [SPAM] Re: [SPAM] Re: Floating point dts, pts

Jonathan Campbell jonathan at castus.tv
Mon Jan 23 09:28:27 CET 2012


Actually the DTS and PTS depend on the codec. In most cases TS files 
contain MPEG-2, and the MPEG-2 video codec already accurately reflects 
the timestamps by using a base rate of 90KHz (1/90000 rational). It's 
true that 29.97fps does not quite count an integral number of time units 
against 1/90000, but that's a limitation of MPEG program/transport 
streams that everyone has to deal with.

Again, if your code needs floating point, just do the conversion within 
the program:

double timestamp = ((double)av_packet.pts * av_stream->rate.num) / 
av_stream->rate.den;

> Timebases are rationals which is great.
> But pts, dts, duration are not.
>
> Right now for 30fps, the dts will be 0, 33, 67, ... when they can be 0, 100/3, 200/3, .... more accurate.
> The stream time bases can remain the way they are 1/1000 or 1/90000.
> Adjusting the stream time bases to make the dtss integers is not advisable since stream time bases are used in many other calculations like pcr in TS which require accuracy and precision.
>
> Chanchal
>
>> Date: Mon, 23 Jan 2012 18:06:58 +0100
>> From: h.leppkes at gmail.com
>> To: ffmpeg-devel at ffmpeg.org
>> Subject: Re: [FFmpeg-devel] [SPAM] Re: Floating point dts, pts
>>
>> On Mon, Jan 23, 2012 at 6:00 PM, C Chatterjee<cchatterj at hotmail.com>  wrote:
>>> Agree that AVRational will be better and more accurate than int64_t or double.
>>> I proposed floating point for simplicity - may be not.
>>>
>>> So how about int64_t rational?
>>>
>>> Chanchal
>>>
>>>
>> pts/dts are already more accurate then you give them credit for.
>> They are "rationals", based on the related AVStreams time_base, which
>> usually depends on the format in question.
>>
>> The demuxer sets those so that every timestamp in the file can be
>> accurately represented, any more precision is useless.
>> If the demuxer does something wrong there, its a bug. If any format
>> would actually store timestamps in float, that might be another thing
>> - but i'm not aware of any that does.
>>
>> - Hendrik
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>   		 	   		
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



More information about the ffmpeg-devel mailing list