Seeking in Flash Video

December 8th, 2006 . by polyGeek

Have you ever noticed that when you use the playhead control to scrub through a video that when you release it the video plays smoothly from the frame you see however the playhead will jump, sometimes a lot, just a little bit forward.

I first noticed this when working on my videoGenerator code and it was driving me nuts. Finally, I went to youTube.com and a few other Flash video sites and tested their video. You know what? I got the same result.

That lead me to believe that maybe it wasn’t my code but something to do with Flash video. Turns out I was right.

First, a quicky on how Flash video, and many other video formats, are encoded. If you could look at the individual frames of a video stream you would notice that most of them are incomplete pictures. For sure the very first frame will be complete but the next few frames after that will only be the parts of the picture that have changed from the first. After a hand full of frames you get another complete picture and then the process starts over again. These complete frames are called key frames. The more key frames you have the larger your filesize will be. However, if you don’t have enough the video quality begins to suffer. Especially when the video content is changing a great deal during every frame, like an action scene. (You can read all about how to best choose your key frame values here.) I’m going to get on with how this affects scrubbing the video.

Very simply, when you are scrubbing over Flash video - moving the playhead around - the Flash player can only show you the key frames. It can’t show you the incomplete frames in between. Here’s a good example of how that looks. The video below is simply a white bar that moves across the video window. You can use the scrubber to move back and forth through the video and see the jumpiness. I included multiple versions with different key frame values so that you could see the effect.

Note: these videos were all encoded at 15 frames per second. A key frame interval of 15 ends up being 1 keyframe/second and a key frame interval of 5 ends up being 3 keyframes/second.

Also, to see the effect that I’m talking about here you have to move the playhead very slowly. If you move it quickly the jumpiness is a result of the Playing trying to catch up with you and has nothing to do with key frame placement.

The file sizes for these videos are as follows:

interval of 1 = 1,350 KB

interval of 5 = 351 KB

interval of 10 = 224 KB

interval of 15 = 181 KB

interval of 90 = 109 KB

interval of auto = 124 KB

You can see that having a very small interval blows up the file size but at a certain point having a very large interval does little to save file size.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Digg
  • Facebook

One Response to “Seeking in Flash Video”

  1. comment number 1 by: sike

    Thanks for your explanation.

Leave a Reply

Name

Mail (never published)

Website

- Why ask? This confirms you are a human user!

   




© Copyright 2008 polyGeek.com / Dan Florio, All Rights Reserved Except Where Explicitly Stated
Web Developement Blogs - Blog Catalog Blog Directory
M2 Websites