Reading from the file timed-out error when using VideoFileReader
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi, i am using the "vision.VideoFileReader" function to read some videos in MP4 format, undistorting the frames one by one and then writing them into a new video file with "vision.VideoFileWriter", sometimes it works well, but many times the next error appears:
"Error using VideoFileReader
Reading from the file timed-out
Error in UndistortVideo (line "x")
DistFrame=videoFReader(); or DistFrame=step(videoFReader); "
I have tried different ways of programming the code:
First i always obtain the cameraParams in order to undistort the images.
1:
videoFReader=vision.VideoFileReader('Video.mp4');
videoFWriter=vision.VideoFileWriter('VideoUndist.mp4','FrameRate',videoFReader.info.VideoFrameRate,'FileFormat','MPEG4');
while ~isDone(videoFReader)
DistFrame=videoFReader();
UndistFrame=undistortImage(DistFrame, cameraParams);
videoFWriter(UndistFrame);
end
release(videoFWriter);
release(videoFReader);
2:
videoFReader=vision.VideoFileReader('Video.mp4');
videoFWriter=vision.VideoFileWriter('VideoUndist.mp4','FrameRate',videoFReader.info.VideoFrameRate,'FileFormat','MPEG4');
v=VideoReader('CERCA_HL15_3214Undist.mp4');
numFrames=v.NumberofFrames; %I kwnow this is not recommended, but it works well for me.
for i=1:numFrames
DistFrame=step(videoFReader);
UndistFrame=undistortImage(DistFrame, cameraParams);
videoFWriter(UndistFrame);
end
Each video has a duration between 5 and 20 minutes and i have also tried doing it with VideoReader function instead of vision.VideoFileReader function, but the same problem appears.
I hope you can help me with it,
Thank you all beforehand.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!