Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a video file that I am trying to read. I believe the video format is MPEG-2 and the tool I'm reading it with is MATLAB's VideoReader, which has trouble with the frame indexing: if I use VideoReader to count all the frames in the file, it gives a different answer each time. The problem might occur because the file has a variable frame rate. Can a MPEG-2 file have a variable frame rate? Is there a better command-line tool that will allow me to accurately count frames, extract a frame given the frame index that I specify, and tell me the time stamp of the extracted frame?

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

I would appear that MPEG2 does support variable framerate, though I would expect any tool supporting MPEG2 to support that too.

For getting the total number of frames This solution may help.

share|improve this answer
    
Thanks, very helpful. My frame count problem may not be due to Matlab's support of MPEG2, but rather to memory problems: mathworks.com/matlabcentral/answers/… . –  KE. Sep 27 '12 at 17:07
    
Just in case someone reading this had the same problem: the solution to memory problems turned out to be using 64-bit MATLAB and converting the file to MPEG-1 (superuser.com/questions/480381/…). –  KE. Sep 28 '12 at 16:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.