{"id":3169,"date":"2012-02-04T23:31:05","date_gmt":"2012-02-05T04:31:05","guid":{"rendered":"http:\/\/elwinlee.com\/blog\/?p=3169"},"modified":"2014-11-06T17:17:12","modified_gmt":"2014-11-06T22:17:12","slug":"how-to-fix-flash-seek-playheadtime-accuracy","status":"publish","type":"post","link":"https:\/\/www.elwinlee.com\/blog\/how-to-fix-flash-seek-playheadtime-accuracy\/","title":{"rendered":"[How] Flash: Seek() &#038; PlayHeadTime() Accuracy"},"content":{"rendered":"<p><img decoding=\"async\" src=\"http:\/\/i.imgur.com\/N8bCq.png\" alt=\"\" width=\"250\" \/><\/p>\n<p>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.<\/p>\n<p>Apparently, the accuracy of the seek() function is dependent on the keyFrameInterval of the video and the FPS meaning Precision = keyFrameInterval \/ FPS. <\/p>\n<p>So for example, if you have a keyFrameInterval = 30 (1st frame will be a keyframe, 30th frame will be a keyframe, 60th frame &#8230; etc.) and FPS is set on 15, you&#8217;ll only be able to seek in 2-seconds intervals of time (precision = 30 \/ 15).<\/p>\n<p>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 &#8220;video&#8221; tab, &#8220;Advanced Settings&#8221;, check &#8220;Set Key Frame Distance&#8221; and set the key frame distance lower. Export it and now your seek() accuracy would be more precise!<\/p>\n<p><a href=\"http:\/\/elwinlee.com\/blog\/wp-content\/uploads\/2012\/02\/key_frame_distance.jpg\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\"><img decoding=\"async\" src=\"http:\/\/elwinlee.com\/blog\/wp-content\/uploads\/2012\/02\/key_frame_distance.jpg\" alt=\"\" title=\"\" width=\"412\" height=\"319\" class=\"aligncenter size-full wp-image-3177\" srcset=\"https:\/\/www.elwinlee.com\/blog\/wp-content\/uploads\/2012\/02\/key_frame_distance.jpg 412w, https:\/\/www.elwinlee.com\/blog\/wp-content\/uploads\/2012\/02\/key_frame_distance-300x232.jpg 300w\" sizes=\"(max-width: 412px) 100vw, 412px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fixing the inaccuracy of seek() function using key frame distance<\/p>\n","protected":false},"author":1,"featured_media":3177,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[429,1079,255],"tags":[1957,1958,433,1959,434,1960,537,584,621,724,833,919,1951,1952,1953,1954,1955,1956],"class_list":["post-3169","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-design","category-how-to-fix-stuff","category-technology","tag-key-frame-distance","tag-accuracy","tag-flash","tag-precision","tag-adobe","tag-component","tag-fps","tag-as3","tag-video","tag-actionscript","tag-premiere","tag-key","tag-flvplayback","tag-playheadtime","tag-seek","tag-key-frame","tag-frame","tag-distance"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/www.elwinlee.com\/blog\/wp-content\/uploads\/2012\/02\/key_frame_distance.jpg","jetpack_shortlink":"https:\/\/wp.me\/p1mtRf-P7","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/posts\/3169","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/comments?post=3169"}],"version-history":[{"count":2,"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/posts\/3169\/revisions"}],"predecessor-version":[{"id":4110,"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/posts\/3169\/revisions\/4110"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/media\/3177"}],"wp:attachment":[{"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/media?parent=3169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/categories?post=3169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/tags?post=3169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}