Number of Video Frames doesn't Match Actual Computations

5 visualizaciones (últimos 30 días)
PaTchoRa
PaTchoRa el 19 de Abr. de 2018
Comentada: PaTchoRa el 19 de Abr. de 2018
I have a 25fps video that I'd like to do some further processing using MATLAB. The video was 5.03seconds long. Now, using the following codes:
video = VideoReader(video01);
video.NumberOfFrames
and a loop counter, with fcounter initialised to 1,
while hasFrame(video)
fcounter = fcounter + 1;
end
Both returned a total number of frames of 128. However, if we do the calculations, given an fps of 25 and total video time of 5.03sec, shouldn't it return a total number of frames equal to (25)(5.03) = 125.75 = 125? 128 number of frames and a 25fps would mean a video length of 5.12secs, which doesn't add up/match. Is there something wrong with my calculations? Or does MATLAB append or do some overlaps on the frames internally? I'm using MATLAB R2016b.
Thank you!
  2 comentarios
Walter Roberson
Walter Roberson el 19 de Abr. de 2018
But is it 25 fps? A lot of videos these days are variable frame rate.
PaTchoRa
PaTchoRa el 19 de Abr. de 2018
Good day sir! Yes, I checked it using ffmpeg. Actually, I already had my answer to this a while ago: I did the probing itself using Matlab and it returned a duration of 5.12s. Though when I checked it using players, they only returned the 5.03s.
I'll take a shot to this and assume that it's the players that are at fault. Or is it related to what you said being the video having variable frame rate?
The ffmpeg did say an fps of 25, as well as Matlab. Thank you!

Iniciar sesión para comentar.

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by