Hi On Mon, 2010-05-10 at 17:51 +0300, Igor R wrote: > Hello, > > In my project I write a video-stream to *.avi file (ASP MPEG-4), > frame-by-frame, using av_write_frame(). > Since every frame has a timestamp in milliseconds, I setup time_base as > follows: > time_base.den = 1000; > time_base.num = 1; > > Then I use frames' "normilized" time-stamps as their pts. The > "normalization" merely shifts the timestamps from the interval > [first..last] to [0..last-first]. > > The application runs under WinXP SP3. Now, when I check the AVI file > properies, I see "framerate: 1000", while the actual framerate is 10 > fps, and I guess this's because of the incorrect time_base settings. > > So what would be the correct time_base and pts calculations? > > Thanks.
If you know that your video has a constant framerate of 10 then you should set time_base to 1/10 when opening the muxer and then use av_rescale_q(pts, time_base_1kHz, st->time_base). That rescales your 1 kHz PTS:es to whichever time base the muxer chose for that stream (it might not always end up being what you requested). Also, make sure your PTS:es are actually in the 1 kHz time base by checking that the values are 100 ms apart. Also note that AVI supports variable framerate, which means figuring out the actual framerate of such a file requires a bit of detective work (see r_frame_rate) which Windows probably doesn't do. When you set time_base to 1/1000 the muxer will output such files. Finally, when muxing VFR video with such a low time base in AVI you will get a lot of overhead (something like 64 kbps, maybe more), which is another reason for choosing a larger time base. Hopefully this helps. /Tomas
signature.asc
Description: This is a digitally signed message part
_______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
