I am currently having problems seeking to keyframe with good accuracy
(videos are h264). To calculate target time I currently use:
int seek_target = target_frame *
((float)pFormatCtx->streams[videoStreamIndex]->time_base.den /
pFormatCtx->streams[videoStreamIndex]->time_base.num) / (float)
pFormatCtx->streams[videoStreamIndex]->codec->time_base.den /
pFormatCtx->streams[videoStreamIndex]->codec->time_base.num) *

I would note that target_frame is being set to only be a keyframe. The
problem I have is that using this I frequently end up seeking to a keyframe
that is behind or ahead by 1. When working on a specific video I am able to
add an offset to the target_frame and get precise results for that specific
case but I need a solution that works on all the videos. What adjustments
would I need to make to get better accuracy.

Libav-user mailing list

Reply via email to