matlab - reading images from VideoReader gets progressively slower -
i've been trying to read mp4 file using videoreader. matlab able read images, further frame along video, more time takes.
tic;i=read(v,1);toc elapsed time 0.264011 seconds. tic;i=read(v,2000);toc elapsed time 32.859614 seconds.
also, i'm not sure if related, matlab cannot determine number of frames in file:
v=videoreader('s1140007 (~200 cubes, large).mp4'); warning: unable determine number of frames in file.
i've tried using 2 versions r2012b , r2015a, , problem persists. on different machine, however, number of frames can determined , reading times don't longer, there's configured wrong on machine. there known solution problem (can related codecs somehow?), or maybe alternative method of reading 1 image @ time (readframe not relevant needs).
any appreciated, aviram
ok, not answer, workaround... seems set numberofframes property in videoreader object created video undetermined number of frames, 1 needs read last frame using following code (as mentioned in documentation of videoreader):
v=videoreader('path.mp4'); l=read(v,inf);
this sets number of frames in video, , allows indexing , quick reading of single frames video. however, works in matlab r2012b. in 2015a, numberofframes property set read(v,inf) trick, reading still time-consuming, reason. i'm not sure why happens, , i've said, of other machines i've checked able read files (but didn't), far completed. not clear why cannot determine number of frames, or why there's variability between computers , why in versions last(v, inf) works , in others partially.
Comments
Post a Comment