Can't open H.264 video in Matlab 2019b
17 次查看(过去 30 天)
显示 更早的评论
I have a very simple but annoying problem. Since I upgraded to Matlab 2019b the following code doesn't work anymore:
reader = VideoReader(videoPath);
frame = readFrame(reader);
I always get the error "No more frames available to read from file.". The video is a normal .mp4 file with h.264 codec. I can open it with every other Matlab version and video player without problems.
So what happened in Matlab 2019b that this code doesn't work anymore and how can I fix it?
4 个评论
Ameer Hamza
2020-3-16
Even with this video, I got no error, the MATLAB was able to read the video file just fine. However, I am running it on macOS.
You can try to use the following method as an alternate method until the issue is solved.
frames = importdata('DJI_0060.MP4');
Let us know if this works.
回答(1 个)
Aditya Patil
2020-3-16
I was not able to replicate this issue with few sample .mp4 files with h.264 encoding. Without the file which creates the issue, it won’t be possible to solve the problem. Can you please provide the file which is causing an issue?
As a possible workaround, you can try to convert the file into another format/codec. Alternately, if you have the Computer Vision toolbox, you can use the following workaround,
vidObj = vision.VideoFileReader(videoPath);
while ~isDone( vidObj )
frame = step( vidObj ) ;
end
4 个评论
Adam Danz
2021-8-3
I'm having the same exact problem described by Vincent K above using windows 10. I've converted the mp4 file to avi and to MPEG-4 and the problem persists. When I try over and over and again with the same file on the same system, sometimes it works but ~90% of the time it does not work. Using Matlab R2021a.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!