[Ffmpeg-devel] Re: Timestamps Again
Colin Ward
hitman
Sun Nov 6 03:54:56 CET 2005
On 05/11/05, you wrote:
>
[Snip]
>> static double pts;
>>
>> avcodec_decode_video(context, &frame, ...)
>>
>> if ((frame->pts == 0) || (frame->pts == AV_NOPTS_VALUE))
>> {
>> pts += (av_q2d(context->time_base) * 1000);
>> }
>> else
>> {
>> pts = ((frame->pts * av_q2d(context->time_base)) * 1000);
>> }
[Snip]
> you should use AVPacket.pts/dts not AVFrame.pts
Ok, I just tried that but it results in crazy pts times being calculated
(ie. starting with a 7 figure millisecond count). This is with an MPEG
file that I know has a start time of zero and for which the method above
works fine.
Also, the calculations above are using
AVFormatContext.streams[video_stream]->codec->time_base - is this correct?
Or should I be using AVFormatContext.streams[video_stream]->time_base?
These two time_base variables are *different* when playing the MPEG file
mentioned above.
Also, what is the actual difference between AVPacket.pts and AVFrame.pts?
If you are decoding a video that has B/P frames and the frames are out of
order, wouldn't you have to get the pts from AVFrame? Because after
calling avcodec_decode_video() the AVFrame returned would be in
presentation order, whereas the AVPacket wouldn't be, because the file
would contain IIP whereas the presentation order is IPI.
And what is dts?
/-------------------------------------------------------------------\
[Hitman/Code HQ - 6502/z80/68000/604e/80x86/ARM coder - Amiga rulez!]
[VZ-200/VIC-20/MZ-700/c16/c64*10/c128*8/Plus-4/CPC464/CD32/500*2 ]
[600/1000/1200*2/A4000/SNES/N64/Dreamcast/Athlon 1100/AmigaOne ]
[Assembly Language: The most fun you can have with your clothes on! ]
\-------------------------------------------------------------------/
????????
?@
More information about the ffmpeg-devel
mailing list