Thanks so much to both of you - that clarified everything. My conversions are all sorted now!
I don't suppose anyone has tracked down why the frame_number is inconsistent across av_seek_frame calls? -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Jose Mortensen Sent: 04 March 2009 00:47 To: Libav* user questions and discussions Subject: Re: [libav-user] How do I convert dts/pts values into seconds? Mpeg2 uses 90000KHz as a base frequency. 1500 = 90000/60 . pts / 90000 = pts in seconds -- Jose On Tue, Mar 3, 2009 at 1:27 PM, Smart, Gary <[email protected]> wrote: > This one is bugging me. I have scanned the archives and see many people > confused by this one but none of the proposed explanations seem clarify > things at all! > > > > I have dumped the first few frames of an mpeg2 file and get: > > F1 - dts 16501 > > F2 - dts 18001 > > F3 - dts 19501 > > F4 - dts 21001 > > Etc. > > The codec context time_base for the stream has num=1, den=60 (60fps). > > > > I want to convert the dts values into 'double seconds' but if I try > using the timebase converters (presumably incorrectly) I get crazy > numbers. > > Clearly the frames are separated by 1500 - but how does this relate to > the 60fps (time_base)? > > > > Also - while we are at it - has anyone noticed that if you av_seek_frame > to a timestamp and read off a few frames - the frame_number field of the > codecContext might report frames 1..n. If I repeat the seek and read > off the same frames, the codecContext reports frame numbers n+1..n+N > (i.e. they continue from the last frame decoded). Surely they should > read the same each time I decode the same frames? This is really > annoying for me since I need to use the frame_number's for referencing > the image! > > > > Any help would be welcome? > > Gary Smart > > > > > > _______________________________________________ > libav-user mailing list > [email protected] > https://lists.mplayerhq.hu/mailman/listinfo/libav-user > _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
