My strategy was to skip frames that are available before the next time_base interval and provide the PTS that works have been in effect as determined by elapsed_time / time_base as each available frame is encoded. As I mentioned it doesn't seem to work for me.
One thing stands out, you're using a milliseconds multiplier, i.e. 33000. Maybe I've interpreted it incorrectly, but I understood the DTS and PTS to be sequence numbers, not actual time based values: so with a time_base of 25, a frame to be shown at 0.5 secs would have a PTS of 12, a frame to be shown at 2 secs has a PTS of 50, etc. Where did you see use of the ms values that you're using? Raymond On May 14, 2014 10:55 PM, "Ken Bass" <[email protected]> wrote: > To put it another way: must there be a one-to-one correspondence between > the frame interval and the PTS? That is, if I initialize the stream for > 30fps, must frame 0 have PTS 0, frame 1 have PTS 33000, frame 2 have PTS > 66000? > > What I would like to do is this: > > I write out the first frame with PTS of 0. I write out the next frame with > PTS of 50000 (50ms). The next with PTS of 90000 (90ms). > > Will libav let me do this? And what happens with playback? > > If need be, I can simply duplicate the last frame if a new one is not > available at the expected interval. But, then, what if a new frame arrives > in between intervals? Can I set its PTS the the actual PTS, or must it be > adjusted up to the next interval? > > Thanks for the response. > > ken > > > On Wed, May 14, 2014 at 4:38 PM, NITIN GOYAL <[email protected]>wrote: > >> >> On Wed, May 14, 2014 at 10:30 AM, Ken Bass <[email protected]> wrote: >> >>> >>> Question: can I simply write out each frame as I receive it, with an >>> appropriate PTS? This would most likely skip expected frames. Also, the >>> captured frame most likely wouldn't be written at the specified fps >>> interval. >>> >>> >> I think I am not clear on your question but as per my understanding, For >> the raw frames, if you will get them in a proper manner of PT, ti will >> create less issues in encoding process. May be you can buffer some frames >> and then send it to encode the frames and thus there wont be any skipped >> frames. >> >> _______________________________________________ >> Libav-user mailing list >> [email protected] >> http://ffmpeg.org/mailman/listinfo/libav-user >> >> > > _______________________________________________ > Libav-user mailing list > [email protected] > http://ffmpeg.org/mailman/listinfo/libav-user > >
_______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
