Can a MPEG-2 file have variable frame rate?

0

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?

KAE

Posted 2012-09-27T13:56:12.477

Reputation: 1 467

Answers

0

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.

Haqa

Posted 2012-09-27T13:56:12.477

Reputation: 549

Thanks, very helpful. My frame count problem may not be due to Matlab's support of MPEG2, but rather to memory problems: http://www.mathworks.com/matlabcentral/answers/49144-unable-to-determine-the-number-of-frames-in-this-file .

– KAE – 2012-09-27T17:07:30.683

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 (http://superuser.com/questions/480381/codec-for-mpeg2-file-on-64-bit-windows-7-system).

– KAE – 2012-09-28T16:04:15.053