I have a couple of questions about seeking to a particular frame, mainly
using av_seek_frame.
The first question is theoretically is it possible to seek to any random
frame for all codecs? Are there some codecs that rely on sequential
changes from frame to frame to decode frames properly, so you need to
seek in exactly the order they are written?
My second question is about the structure of AVPacket. When you do:
av_read_frame(_formatCtx, &packet),
does it return packet.pos where it was at the beginning of the stream or
at the end after having read it from the stream? What's confusing to me
is that I create a map of packet positions using av_read_frame, and then
use
av_seek_frame(_formatCtx, -1, _framePositions[frameIndex],
AVSEEK_FLAG_BYTE);
but when I read the frame immediately after seeking, it gives me a frame
at a more advanced position. My code assumes that .pos is at the
beginning, but I haven't tried at the end yet.
My problem is that I can't get seeking to work properly at all. I have
two problems with it:
1. I have problems actually seeking and then reading from the proper
frame positions, as above.
2. Even when seeking and reading sync up, the images end up looking
pretty mangled after syncing, except when seeking to key frames.
The only way I've ever been able to get things to sync up and look
correct is to read the entire stream sequentially without ever seeking.
Thanks.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user