Announcement

Collapse
No announcement yet.

Frame-By-Frame Video Clip Viewer?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Frame-By-Frame Video Clip Viewer?

    Hi there!

    I was wondering if anyone here might know of some coding examples of viewing a video-file on a frame-by-frame basis if so desired? Most of the examples play videos in a start & stop fashion, but don't provide the ability to statically display an arbitary, specified frame (ie; display frame, say... #1337 on screen).

    TIA!
    Scott Martindale
    [email protected]

  • #2
    MCI offers a number of commands for handling videos.

    Read the API docs to see all the MCI command strings available, such as:

    step
    seek
    Chris Boss
    Computer Workshop
    Developer of "EZGUI"
    http://cwsof.com
    http://twitter.com/EZGUIProGuy

    Comment


    • #3
      Why does the "Zapruder Film" come to mind here? (I think I spelled it right).
      There are no atheists in a fox hole or the morning of a math test.
      If my flag offends you, I'll help you pack.

      Comment


      • #4
        Why does "pron" come to mind here? (I think I spelled it right).

        Seriously, what Scott is asking for is more complex than you might think. Modern "compressed" video streams don't store most frames in their entirety. The first frame of a video is called an I-frame, and it's a complete picture. The second frame is stored as the changes that must be made in frame 1 to produce frame 2. Only the pixels that change are actually stored. Frame 3 is based on frame 2, and so on. I-frames are inserted periodically (depending on the content of the video) to keep things from degrading too badly over long periods of time.

        The video players that I'm familiar with can only "freeze" an I-frame. To freeze any arbitrary frame number, a program would be required to find the most recent I-frame and then play the video forward until the desired frame was re-created.

        -- Eric
        "Not my circus, not my monkeys."

        Comment


        • #5
          a program called Video Redo will do what you ask on some types of video files

          it will allow you to edit a single frame out and recreate the I-frames for you

          Ralph

          Comment


          • #6
            Actually video editing software allows you to define the number of key frames.

            Eric is right that not every frame is a full picture, but is just enough to modify the previous image to the new image.

            When you save a video, you can define a key frame rate, which means a key frame every so many frames. For example, if you defined a video to use a key frame every 15 frames, then you could step through the video every 15 frames and have a full picture.

            Now if you don't mind a huge video file, you can define a key frame every single frame which would allow you to step through the video one frame at a time, forward and backwards.
            Chris Boss
            Computer Workshop
            Developer of "EZGUI"
            http://cwsof.com
            http://twitter.com/EZGUIProGuy

            Comment


            • #7
              Originally posted by Chris Boss View Post
              Eric is right that not every frame is a full picture, but is just enough to modify the previous image to the new image.

              When you save a video, you can define a key frame rate, which means a key frame every so many frames. For example, if you defined a video to use a key frame every 15 frames, then you could step through the video every 15 frames and have a full picture.
              Not really/only. It depends also on the Codec used.
              For example, at one extreme, with MJPEG (often used on digital photocam), every frame is independent.
              With more advanced codec like MPEG4 (like the popular DivX), keyframes can be used in more articulated ways.
              It's possible to specify a max keyframe interval (like, at least one ever 5 seconds / 150 frames), to be sure to keep the stream "seek friendly".
              But it's also possible to specify a threshold based on the changed blocks numbers, so that a keyframe will be automatically created when the scene change too much, to maximize the efficency.
              In a typical DivX stream, so, you'll find that keyframes have a very variable distribution, depending on the video content, bitrate, etc.

              Bye!
              Last edited by Marco Pontello; 2 Jul 2008, 08:55 PM.
              -- The universe tends toward maximum irony. Don't push it.

              File Extension Seeker - Metasearch engine for file extensions / file types
              Online TrID file identifier | TrIDLib - Identify thousands of file formats

              Comment


              • #8
                http://www.powerbasic.com/support/pb...ad.php?t=24699

                RValois.
                http://www.rvalois.com.br/downloads/free/

                Comment


                • #9
                  I haven't worked with the latest codecs much.

                  My experience is with the codes that came with Windows 95 such as Microsoft video for Windows, the Intel codecs, etc.

                  I used Autodesk Animator Studio for Windows and it could set the keyframe rate.

                  Codecs do make a difference as Marco said.
                  Chris Boss
                  Computer Workshop
                  Developer of "EZGUI"
                  http://cwsof.com
                  http://twitter.com/EZGUIProGuy

                  Comment


                  • #10
                    Thanks for the suggestions. FWIW, I did know that any non-raw (uncompressed) video file doesn't actually contain the full information for each frame, but rather denotes a keyframe followed by the delta(s) for the "tween" frames; meaning, (assuming it isn't a keyframe) the current-frame being viewed was generated by the accumulation of deltas built-up, and generationally derived from the originating keyframe.

                    So, basically:

                    1) Read & catalog the keyframes.

                    2) Get the data from the nearest keyframe preceeding the given frame.

                    3) Off-screen, sequentially "build-up" the deltas until the specified frame is reached.

                    4) Display the frame.

                    ** This assumes that the file utilizes multiple keys. There are some (older/extinct) file formats which only provide/define the first full-frame, and rely on the software to sort figure out what to display based soley on a long sequence of deltas; which isn't a good approach, since if any one delta is corrupted, the rest of the video data is as well.

                    Anyway, I guess I was hoping that MS may have had some API/libarary which had this already made up in a "wrapper"...

                    Thanks again!
                    Scott Martindale
                    [email protected]

                    Comment


                    • #11
                      Check the link posted. For avi files the example does what you ask.

                      Regards,
                      RValois.
                      http://www.rvalois.com.br/downloads/free/

                      Comment

                      Working...
                      X