VideoReader has no available frames

조회 수: 16 (최근 30일)
Clyde Webster
Clyde Webster 2018년 9월 20일
답변: Clyde Webster 2018년 10월 24일
Hi, I'm experiencing an issue with VideoReader in R2018a on Windows 10 where I create a VideoReader object, but then no frames are available to work with i.e. hasFrames(v) = 0. I'm not performing any other operations on the object before trying to use available frames. Trying an implay on the object after reading results in "Invalid Video Data - must be a numeric or logical type data". Using readFrame on the object results is "No more frames available to read from file". The same function on the same video works in Ubuntu 16.04 with the same version of matlab (R2018a). So I'm thinking it might be a windows 10 compatibility thing...
Any help would be greatly appreciated.

채택된 답변

Clyde Webster
Clyde Webster 2018년 10월 24일
I think it is just a codec thing. MATLAB seems to be surprisingly unversatile when it comes to reading different video codecs in Windows. I was using a libx264 here and it was not working. I've switched to MPEG-4 and it is now working.
Video's converted using ffmpeg:
ffmpeg -i <video_in>.avi -c:v mpeg4 -q:v 2 <video_out>.avi

추가 답변 (1개)

KSSV
KSSV 2018년 9월 26일
vidObj = VideoReader('C:\Users\Public\Videos\Sample Videos\Wildlife.wmv');
numFrames = 0;
while hasFrame(vidObj)
F = readFrame(vidObj);
numFrames = numFrames + 1;
imagesc(F)
drawnow
end
numFrames
  댓글 수: 1
Clyde Webster
Clyde Webster 2018년 9월 26일
vidObj =
VideoReader with properties:
General Properties:
Name: 'Cam-18285920.avi'
Path: 'C:\Users\11242435\Videos\Site-Day01\wand'
Duration: 33.3330
CurrentTime: 33.3330
Tag: ''
UserData: []
Video Properties:
Width: 1440
Height: 1080
FrameRate: 30.0003
BitsPerPixel: 24
VideoFormat: 'RGB24'
numFrames =
0

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

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by