Hi again. > >> No; you just need to wait for the correct time before calling > >> av_write_frame(). So, you need to add something like a usleep() or > >> similar... The correct time for sending a frame can be computed > >> based on the DTS of the frame. An easy way to compute this time could > >> be: > >> <time when the first frame has been sent> + av_rescale_q(pkt.dts, > st->time_base, AV_TIME_BASE_Q); > > > > By this formula you mean (just to understand the approach): > > > > 1) Store the time of the first frame > > > More precisely, store "the system time (gettimeofday()) when you send > > the first frame" > > > 2) Calculate the time of the next frame via first frame time + result > > of av_rescale_q >
I tried to implement this formula, but it didn't work. When I used av_rescale_q(pkt.dts, st->time_base, AV_TIME_BASE_Q) to calculate the time to wait, I got a very high value - 66667, which when basically a minute and 6 seconds. When I checked the variables, the dts was 6000, time_base was {num=1, den=90000}, and AV_TIME_BASE_Q was {num=1, den=1000000}. The next dts was already twice then the previous one, about 12,000. This probably means I have some parameters incorrectly set, but which exactly? Thanks for your help. _______________________________________________ libav-user mailing list libav-user@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/libav-user