I'm trying to seek to the certain position in video with help of VideoView.seekTo(positionMs). So during the seek operation, in this case the seeking is done to the closest key frame for a given time duration. For example if the user seeks to 27secs and the closest key frame is at 13th sec then seeking is done to the 13th sec and not to the 27th second.Please suggest me how can i solve this issue.
2 Answers
I think 'seekTo' the backward keyframe and encoding to the accurate position, ignore the useless part is an idea. As BlueSword say, 'seekTo' is not necessary to reach the normal frame. So may a custom video player is needed. You should handle the decoding data by yourself.

- 51
- 5
First of all keyframes
cannot be that much time apart in any video unless you have re-encoded and edited the video. You are true that when we use seekTo()
we go to closest keyframe, but that is not a visible difference most of the time.
Regarding your problem of video lacking keyframes, you can manually reencode the video and add the keyframes. You can use Ffmpeg
or any such tool for encoding. Have a look at this if you need more guidance and help. But most of the time this will not
be a necessity, because the scenario you have described occurs rarely for original videos.
Hope it helps.Cheers.:)