[FFmpeg-devel] Reading the NTP time from RTCP timestamps

Luca Abeni lucabe72
Tue Jul 1 14:17:58 CEST 2008

Hi Michael,

Michael Niedermayer wrote:
>> I got confused by the fact that
>> av_rescale_q(s->last_rtcp_ntp_time - s->first_rtcp_ntp_time, (AVRational){1, 2^32}, s->st->time_base);
>> did not work as I naively expected, and I worked around this in the
>> wrong way...
> AVRationals are 32/32bit ...

Yes... When I stopped trying random things and I had a look at the code,
I realised it ;-)

>> I am currently using
>> av_rescale_q(s->last_rtcp_ntp_time - s->first_rtcp_ntp_time, (AVRational){1, 1}, s->st->time_base) >> 32;
>> but I hope to find a better way (basically, I have to convert
>> from timebase 1/2^32 to s->st->time_base)
> av_rescale(ntp, time_base.den, (uint64_t)time_base.num<<32)

Yes; this looks better. During the weekend I tried to find a cleaner
solution, but I failed.

I updated my RTSP demuxer patch, and I am testing it... If nothing goes
wrong and noone complains, I'll commit it tomorrow.


More information about the ffmpeg-devel mailing list