How to play video at specific timestamp?

Have a video that I want to play in a figure but at a specific time, like start 10 seconds into the video for example.

Answers (1)

matlabuser12 - consider using VideoReader to read the data from file starting at a specific index. For example,
% create the object
vidObj = VideoReader('myVideo.mp4');
% determine the number of frames per second
framesPerSecond = get(vidObj,'FrameRate');
% determine the number of frames
numFrames = get(vidObj,'NumberOfFrames');
% read all data from the 11th second
video = read(vidObj,[framesPerSecond*10 + 1 numFrames]);
video will be an array of video frames which you should then be able to play. Try implementing this and see what happens!

4 Comments

What function is the "play video" function? ive been using mplay, but i cannot seem to find where to put in the start and stop frame once i get the info off of videoreader
See an example from the above link and look at the use of the movie function.
the output from read(....) does not result in an array of frames. so movie function does not work.
What is your output from read?

Sign in to comment.

Tags

Asked:

on 30 Mar 2015

Commented:

on 1 Apr 2015

Community Treasure Hunt

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

Start Hunting!