VideoReader: Unrecognized function or variable 'hasFrame'

I am following the VideoReader documentation from https://www.mathworks.com/help/matlab/ref/videoreader.html
When I try to run the example code using R2024a Update 5,
currAxes = axes;
v = VideoReader("xylophone_video.mp4");
while hasFrame(v)
vidFrame = readFrame(v);
image(vidFrame,"Parent",currAxes)
currAxes.Visible = "off";
pause(1/v.FrameRate)
end
the line with while hasFrame(v) throws an error: Unrecognized function or variable 'hasFrame'.
The VideoReader object was created, but the hasFrame(v) line does not work. Was support for this function removed? If so, what replaced it?

댓글 수: 5

Can you share OS version? Because it is working fine for me on windows 11 R2024a as well as MATLAB Online R2024a
For debugging purposes, try examining
methods(v)
@Avni Agrawal I am running Windows 11 Pro, Version 10.0.22631 Build 22631. What update of R2024a are you using?
@Walter Roberson It gives me:
Methods for class VideoWriter:
VideoWriter delete open set
close get saveobj writeVideo
Static methods:
getProfiles
Methods of VideoWriter inherited from handle
It doesn't list hasFrame as one of the methods for the class.
MATLAB Version: 24.1.0.2537033 (R2024a)
Operating System: Microsoft Windows 11 Enterprise Version 10.0 (Build 22631)

댓글을 달려면 로그인하십시오.

 채택된 답변

Avni Agrawal
Avni Agrawal 2024년 7월 23일
이동: Walter Roberson 2024년 7월 23일

0 개 추천

You are trying to access VideoWriter instead of VideoReader. Are you sure the code you are trying to run has VideoReader() but not VideoWriter() ?
Because, methods(v) is returning:
Methods for class VideoReader:
VideoReader hasFrame read saveobj
get inspect readFrame set
Static methods:
getFileFormats

추가 답변 (0개)

카테고리

제품

릴리스

R2024a

질문:

2024년 7월 23일

이동:

2024년 7월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by