PDA

View Full Version : How to patch MPEG2 frame rate?


FredThompson
1st November 2006, 08:01
How can an MPEG2 file be modified to play at a different frame rate?

IIRC, there are 2 word values which form a fraction to give the frame rate. (Wasn't this an issue with VirtualDub many moons ago where two sets of values could yield the same result but VirtualDub wanted the exact same values or it would not append?)

If this is true, would modifying those values change the rate of playback? It would seem so. I realized the motion would not be smooth. That's fine, I'm looking for a simple way to extend the display of each frame, regardless of video player and without making a special encode with duplicate frames.

dbloom
1st November 2006, 14:46
http://neuron2.net/dgpulldown/dgpulldown.html

it's not actually a fraction (those headers in MPEG-2 are pretty much unused), but a flag that causes a frame to be shown for 1.5x as long (REPEAT_FIRST_FIELD).

:-)

FredThompson
1st November 2006, 23:21
Huh? That's an entirely different issue. The question is about specifying the frame rate, not repeating a field.

Pulldown doesn't have anything to do with this, either.

dbloom
2nd November 2006, 01:11
Huh? That's an entirely different issue. The question is about specifying the frame rate, not repeating a field.

Pulldown doesn't have anything to do with this, either.

How else will you extend frame rate on MPEG-2?

Pulldown will work for this. For the REPEAT_FIRST_FIELD flag, software decoders simply display the picture for 1.5x as long (progressively - they don't interlace it).

What frame rate do you want anyway?

FredThompson
2nd November 2006, 09:00
I need 10 fps. Am running a test right now with TMPGEnc to see what its 10 fps (30 fps internal) setting really does.

I think you have an incomplete understanding of the field repeat flag.

dbloom
2nd November 2006, 19:16
I need 10 fps. Am running a test right now with TMPGEnc to see what its 10 fps (30 fps internal) setting really does.

I think you have an incomplete understanding of the field repeat flag.

Not really - I've made (or modified) software that manipulates the RFF flags on MPEG-2 (see http://davidbloom.home.mchsi.com and this thread). I know what I am talking about :)

You can only get to 2/3 the base MPEG-2 framerate using RFF without having to actually encode duplicate pictures, but it is the only standards-compliant way to pull off a lowered framerate in MPEG-2.

Running TMPG in 10fps to 30fps mode will simply cause TMPG to repeat each frame 3 times. This will probably work fine because MPEG-2 will not encode very much data for the repeated frames, but it is still less than ideal.

Instead, I would encode using 15fps-->30fps mode in TMPG (which will only repeat each frame 2 times) and then use DGPulldown to convert from 30fps to 20fps, which will then result in an actual framerate of 10fps.

Trahald
2nd November 2006, 23:15
the framerate part of a sequence header is only 4 bits so you have 8 setable values. 23.976, 24, 25 , 29.97, 30, 50, 59.97 and 60 Hz.

tmpgencs 'Internal frame rate' is whats stamped into the sequence header.

FredThompson
3rd November 2006, 07:58
Yeah, TMPGEnc does make duplicate frames. You're also correct about the flag. I hadn't thought of it that way, I just saw it as a bandwidth saver since that's how I see it used with satellite sources.

My OP was confused. I was thinking of AVI, not MPEG2 because I use VirtualDub-MPEG2 all the time. Duh!!!