VideoReader frame and framerate

7 Ansichten (letzte 30 Tage)
ace327
ace327 am 2 Aug. 2016
Hi,
I have a question regarding the VideoReader function.
I am trying to extract small portions from large and long videos. While I know I can simply read the entire video in with VideoReader and extract the portions I need by extracting the correct frames, it's not as straight forward when videos are not recorded using the same device (or version). My videos are recorded using Mac QuickTime of various versions (at 30fps), and while the above method works for some videos, some videos cannot be read correctly.
For example, for a set of videos, the duration, frame rate, and total frame numbers are inconsistent when reading them into using the VideoReader function. In particular, duration*frame rate != total frame number. Duration is often correct, and frame rate is close (for a 30fps video, it returns 29.92fps), but the total frame number is completely off (much smaller than what they should be, given the duration and frame rate). Therefore, if I want to extract the portion between 0:30 and 1:00, I can't determine at what exact frame time 0:30 and 1:00 occur because the frames seem to be all shifted. The frame calculated to be 0:30 is actually somewhere between time 0:40 and 0:50. I have tried to calculate the real frame rate using (total frames)/(duration), and using this frame rate for frame number calculation, but even this does not get me to the right time (although it does get a little closer). So the shift in frames doesn't seem to be a uniform one...
I was wondering whether anyone have encountered this problem and have any solutions.
I know VideoReader has a option to read videos starting at a certain time (instead of frame). Is there a way to manipulate this to also include an end time? That way I can simply extract videos based on time (which is what I care about) instead of frames (which is inconsistent).
*Also, if it helps, I am running MATLAB2013b on Ubuntu12.04 (and I can't really upgrade my OS due to other reasons).
Thank you!

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by