Using 'read' command to read video frame sometimes returns 'No more frames available to read from file.'
3 views (last 30 days)
Show older comments
I'm using the 'VideoReader' and 'read' commands to pull in video frames for processing. Randomly, it will give me the following error, i.e., sometimes it pulls up the video frame fine and sometimes it doesn't.
Error using DLC_FillMarkers
No more frames available to read from file.
Error in DLC_ProcDL_SagPln (line 353)
[pdata.traj_filled.(markname),gaperror] = DLC_FillMarkers(...
Error in ALII_DLC_DLSagprocess (line 113)
[DL.sag.(trialtype).(side).data, DL.sag.(trialtype).(side).vars, DL.sag.(trialtype).(side).info] = DLC_ProcDL_SagPln...
I tried upgrading from version 2020a to 2022a, as I noticed this may help in a previous post (See Here). However I am still getting the issue.
I also tried adding a pause after the 'read' command, but this didn't help either.
Below is the the full code used to read the video frame and plot it, and the contents of the VideoReader object. You can see that there are frames to read, so I don't think that is the issue? Interestingly, if I put a break before the 'read' command and run the command manually, it will usually work fine.
f1= figure('WindowState', 'maximized');
s1 = subplot(1,3,1);
vidframe1= read(vid, frames_pre(1,1)); --> frames_pre(1,1) = 1086
pause(1)
vidframe1 = imsharpen(vidframe1,'Radius',2,'Amount',2);
vidframe1 = imadjust(vidframe1,[0 1],[0 1],0.8);
imagesc(vidframe1)
vid =
VideoReader with properties:
General Properties:
Name: '3080_dldl_trial01_S2_DL_L_GX010878_12-Aug-2021_15-47-13-converted.mp4'
Path: 'P:\1.Study Info and Data\ALII Study\Data\Video\2. Named_Sorted\DL\3080\Sag'
Duration: 5.8892
CurrentTime: 0
NumFrames: 1412
Video Properties:
Width: 1920
Height: 1080
FrameRate: 239.7622
BitsPerPixel: 24
VideoFormat: 'RGB24'
3 Comments
Jonas
on 15 Jun 2023
is there something new to this topic? still happening to me when trying to read avi files. most of the time the last 3 frames are not readable using the read(videoObj,...) command.
I tried suggested solution 2 and 3, since 1 can not be used to read any frame I want.
I am on Matlab 2022a, latest patch
Edit: I noted that this error occurs only if I try to read multiple video frames in a fast rate. Manually on command line, there is no error.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!