How to play video at specific timestamp?
조회 수: 11 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Audio and Video Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!