[Ffmpeg-devel] simple question: how works the new time_base mechanism for audio streams?

Martin Wache M.Wache
Fri May 20 22:24:09 CEST 2005


Hi all,

there has been a change in the AVPacket.pts handling recently, and I 
don't understand how it is now working. For video everything seem to be 
clear, but what is the time_base for audio streams?
 From ffplay:
is->audio_clock = av_q2d(is->audio_st->time_base)*pkt->pts;

Here it looks like one should handle exactly the same like video 
streams, but in my examples is->audio_st->time_base is always just the 
default {0,1}. So the above peace of code always gives 0.
Using AV_TIME_BASE_Q also doesn't work on my test stream:

Input #0, avi, from 'test':
   Duration: 00:03:43.8, start: 0.000000, bitrate: 1259 kb/s
     Stream #0.0: Video: msmpeg4, yuv420p, 464x256, 20.00 fps
     Stream #0.1: Audio: mp3, 48000 Hz, stereo, 112 kb/s

The audio stream:
PTS: 18443 new 0 num 0 den 1
PTS: 18778 new 0 num 0 den 1
PTS: 19115 new 0 num 0 den 1

The video stream:
PTS: 45 new 2250000 num 50000 den 1000000
PTS: 46 new 2300000 num 50000 den 1000000

The value new should be the correct PTS value in AV_TIME_BASE units, 
calculated with :
av_rescale(pkt.pts, AV_TIME_BASE * (int64_t)time_base.num,time_base.den)

Any hints?
Thank you very much!

Martin





More information about the ffmpeg-devel mailing list