How can I get MATLAB to play a video without delay?
2 views (last 30 days)
Show older comments
I want MATLAB to display and start a video right away. Timing is important for me. The implay() function brings up a GUI that the video can be started in but how do I get the video to start automatically?
Evan
0 Comments
Answers (1)
Matthew Eicholtz
on 22 Feb 2016
Assuming you have the Computer Vision System Toolbox, you can use VideoFileReader and VideoPlayer objects.
doc vision.VideoPlayer
Use the step method to get the next frame from the reader as well as to send the frame to the player.
reader = vision.VideoFileReader('tilted_face.avi');
player = vision.VideoPlayer;
while ~isDone(reader)
frame = step(reader); %get the next frame in the video
step(player,frame); %show the frame
end
release(reader);
release(player);
1 Comment
Walter Roberson
on 22 Feb 2016
Note that it will take time to create the reader and player objects. However, you are not required to output any data to the player until you are ready with your other timing. (I have not used the player myself; it might turn out to be advisable to output a frame of zeros first thing until you are ready to actually display frames.)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!