I'm working on implementing accurate seeking using ffmpeg and libav (using the C libraries, not the command line ffmpeg
tool).
From what I understand, the only way to get accurate seeking is to seek to the nearest (earlier) keyframe, and then decode packets until the desired timestamp is reached. I've got that working using av_seek_frame
and the AVSEEK_FLAG_BACKWARD
flag.
Now, I know that there's no way around this, due to how video is encoded with I, P and B frames.
But what I'm looking for is a way to tell ffmpeg to skip the memory allocation and the data copy – via a flag to avcodec_receive_frame
, maybe, or another function entirely. Is there a way to indicate "I don't care about the actual frame data, I just need the decoder to process this packet"?
My overarching goal is to make seeking as fast as possible, so any other suggestions along those lines would be welcome too.