0 Replies Latest reply on Mar 18, 2008 12:22 PM by DaVinci Coder

    Acheiving frame by frame in videos.

    DaVinci Coder
      Hi all, I'm trying to achieve true frame by frame but have run into some problems.

      To do this I have been changing the VideoDisplay and VideoPlayer classes. This is an AIR app set to 99 fps, and I'm getting an actual framerate of around 88. I have encoded videos into flv's using Flash CS3 Video Encoder being sure to set keyframes to every frame and have varied the framerate from 10 to 30 and the video data rate too.

      When going frame by frame I have the video in a paused state. On click of a button the video will seek to the next keyframe (which should be the next actual frame). As an example, using this method I can only actually get an average of 19 frames in a second for a video encoded at 24 fps when the data rate is 2K kbs (data rates higher or lower will only allow me to get as low as 10 frames in a second). The video metadata confirms that the video is 24fps.

      I also tried a play/pause method where I perform a check every time the enterFrame event is dispatched by the videoPlayer (I get more frequent updates from this than setting the playheadUpdateInterval value really low) and pause if the playhead has advanced. My event handler gets called about 88 times a second, consistent with the framerate. With a 24fps video, we would expect the playheadTime of the video (which is == ns.time of the NetStream object) increase by intervals of 1000/24 = 41.667 milliseconds. But when I play the video and store all the playheadTime values in an array, I see it sometimes goes up by 14 ms, or 52ms to name a couple (and still get about 19 frames in a second).
      Interestingly, the playheadTimes are not always consistent. On one run I saw the playheadTime go from 9.9s, to 9.978, 10.109, to 10.135. Another time the playheadTime went from 9.9s to 10.057, 10.109, 10.135. So we gained a frame at 10.057 but the one at 9.978 was not "found". After a few more runs I saw that the playhead also reached 9.952s, and 10.031s. So consider: 9.900, 9.952, 9.978, 10.031, 10.057, 10.109, 10.135. This range has playhead increments of 52ms, 26ms, 53ms, 26ms, 52ms, 26ms.
      So the playhead increments are not consistent. That's fine. But the playheadTime times themselves do not always exist, or the Video.as class is not reading the .flv file consistently, or the NetStream class is not updating the time property correctly, or.....? Unfortunately Video.as is an intrinsic Flash class and I don't have access to it, nor do I have access to NetStream.

      Does anyone have any suggestions? Or see something I missed? Any help on this would be greatly appreciated as I've kind of burned out on getting this to work. Thanks.