Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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:… . – KAE 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 (…). – KAE Sep 28 '12 at 16:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .