Playing Video From a FileΒΆ

The FileVideoStream class enables loading video from a local file. To generate a list of all video files in a directory, the list_files() function can be used.

video_paths = edgeiq.list_files(base_path="some/video/dir", valid_exts=(".avi", ".mpeg"))

The video stream can be started in the following way, using either a known path to a video file, or a path returned by list_files():

with edgeiq.FileVideoStream("video.mpeg") as video_stream:

Within the following code block, the next frame can be read out using the read() function:

frame = video_stream.read()

Unlike WebcamVideoStream, the frames are queued up when the app read gets behind the video loading. This means there are no dropped frames when using FileVideoStream. The file connection is automatically cleaned up upon exiting the code block.