By default, playback of digital motion video is displayed in the window supplied by the digital video device. This window is created and displayed when the video is cued for output.
The following string commands illustrate playing an entire AVI format file. Because to and from flags are not specified, the file is played from the current position to the end of the file. When a motion video device element is opened, the current position in the media is the first playable area after any header or table of contents information.
open movie.avi type digitalvideo alias myvideo wait play myvideo notify close myvideo
Each frame in a motion video file has a number associated with it. From the perspective of the digital video device, each file is zero-based. That is, the first frame is frame 0, the second frame is frame 1, and so forth. This means the number of the last frame in a file is 1 less than the total number of frames in the file.
The current position always indicates the frame that is about to be displayed rather than the frame that is currently displayed.
When a play position is specified with the from flag, the actual position reached is accurate only to the nearest intracoded frame (I-frame). However, a position specified with the to flag is exact.
If you need to specify an exact position in the video file to play from, you can issue the seek command, which moves the current position in a file to an exact point. The following string commands illustrate moving the current position to frame 20 and then playing to frame 100.
open movie.avi type digitalvideo alias myvideo set myvideo time format frames wait seek myvideo to 20 wait play myvideo to 100 notify close myvideo
The cue command can also be used to seek and cue a particular frame. By specifying the show or noshow flag, you can control whether the video window will be displayed or hidden when the cue operation is performed. This can be useful for displaying video frames as a user moves the position slider, providing visual feedback of the location in the video a user is seeking to.
cue myvideo show to 20 wait
If a to position is not specified, the current frame is displayed and the media position will advance by one (frame).