VideoReaderAsync

An asynchronous video reader using ffmpeg as the back-end decoder
7 Downloads
Updated 7 Dec 2024

View License

This is a video reader class that reads audio/video files and loads them into memory as an RGB array. It was written to overcome problems due to slow, blocking loading with MATLAB's built in video-reading utilities.
It provides a variety of useful functionality, such as callbacks for reacting to data loading events, and an optional GUI progress bar.
Note that using this class requires that ffmpeg (open source video encoding/decoding software) is installed and available on the system path. If you open a terminal, type "ffmpeg" and get an error, then VideoReaderAsync will not work. See https://ffmpeg.org/download.html to get ffmpeg. ffprobe is also required, but is typically bundled with ffmpeg.
Example usage:
f = 'path/to/video/file.avi';
vr = VideoReaderAsync(f, 'FramesReceivedCallback', @(src, evt)disp(evt));
while ~vr.Loaded
% Video will continue to load in the background while we do other things
% The callback will be called every time another chunk of frames finish loading.
pause(1);
end
% Display the first frame of video
imshow(vr.VideoData(:, :, :, 1));

Cite As

Brian Kardon (2025). VideoReaderAsync (https://nl.mathworks.com/matlabcentral/fileexchange/177014-videoreaderasync), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2022b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.2

Improved example code

1.0.1

Added example usage to description.

1.0.0