When you seek you then need to decode until you get a picture, if this is for playback or display. When you decode the picture you should get a PTS. If you are not try turning on the AVFMT_FLAG_GENPTS flag. I understand this flag correctly it will always generate a PTS even if the stream doesn't have one.

I ended up creating my own little decode loop for seeking since i am trying to display images as i seek. it basically has a little tight decode loop that is not spread across threads.

Scott Andrew

On Jul 16, 2009, at 10:04 AM, Will Ross wrote:


On Jul 16, 2009, at 11:45 AM, Art Clarke wrote:
If you're not using libavformat to demux, then for many codecs libavcodec relies on you to set timestamps on objects. If you don't set them, it
defaults to NO_PTS_VALUE which happens to be the number you see.

So, either set and manage timestamps yourself, or use libavformat to demux (you'll still need to worry about the time-bases of different timestamps --
they are not directly comparable across different streams).

See the ffmpeg.c source code for some of the stuff it does to track
timestamps.

- Art
If I understand correctly, I am using libavformat to read the streams, as I'm using the functions listed in avformat to read the video files in (av_open_input_file(), av_find_stream()). I'm not trying to do different streams, just one at a time, so that should simplify things. My opening code is really close to that used in Martin Böhme's tutorial, with some syntactic sugar for Objective-C. My current code to seek to frames only works (well, it kinda/not really works for all frames, but the P-frames show only the changes, as they're supposed to) for keyframes. the duration of a packet was found by decoding one packet and pulling duration out, and when I want to go to frame n, I seek to n * packet.duration. The problem I have is I have no way of knowing in code where I am.
-Will Ross
_______________________________________________
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

Reply via email to