Using seek() and PlayHeadTime() with FLVPlayback component of video files in Flash can be quite inaccurate. We had the same problem when we were building a prototype for our project, which involved switching and syncing of videos using specific timing. PlayHeadTime gave a decimal value, but whenever we would do a seek() using the PlayHeadTime value on a video, the timing would be off by 0.5-1 second.
Apparently, the accuracy of the seek() function is dependent on the keyFrameInterval of the video and the FPS meaning Precision = keyFrameInterval / FPS.
So for example, if you have a keyFrameInterval = 30 (1st frame will be a keyframe, 30th frame will be a keyframe, 60th frame … etc.) and FPS is set on 15, you’ll only be able to seek in 2-seconds intervals of time (precision = 30 / 15).
To make the seeking more accurate, set the key frame distance when exporting your video with Adobe Premiere. This option can be found in the “video” tab, “Advanced Settings”, check “Set Key Frame Distance” and set the key frame distance lower. Export it and now your seek() accuracy would be more precise!
Related Posts
July 10, 2011
[How] Google Maps Short URLs
How to get Google Maps Short URLs (July 2011) after Google removed the option from the experimental Google Labs
June 18, 2012
Diablo 3 Item Hotlinking Bug
April 22, 2020
[Fix] Google Play – App 0 Supported Devices
September 7, 2013
3DS Max Adventures! Volkswagen Jetta WIP
Work in progress Volkswagen Jetta car 3D model
2 Comments
Add comment Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Wowww..
Does this mean if I set it to 1 (A key frame every frame), I will get a 100% accuracy ??
If your video is for example on 30 fps and you set the key frame distance to 1 key, you’ll get a precision of 1/30 second-intervals of time between each frame. It’s technically not 100% accurate, but the interval is so small that you probably wouldn’t notice any difference when seeking through the video 🙂