How to play video at specific timestamp?

11 ビュー (過去 30 日間)
matlabuser12
matlabuser12 2015 年 3 月 30 日
コメント済み: Geoff Hayes 2015 年 4 月 1 日
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.

回答 (1 件)

Geoff Hayes
Geoff Hayes 2015 年 3 月 31 日
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 件のコメント
matlabuser12
matlabuser12 2015 年 3 月 31 日
the output from read(....) does not result in an array of frames. so movie function does not work.
Geoff Hayes
Geoff Hayes 2015 年 4 月 1 日
What is your output from read?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by