PDA

View Full Version : 'Hardcoded' MPEG-2 pulldown?


Matthew
30th October 2005, 23:52
Currently I can encode video at 23.976 fps and then use DGPulldown to get either a 25 or a 29.97 fps stream (and yes I know the former can be a little wobbly).

How would I replicate the effect of these flags, but instead have the repeated video hardcoded into the stream?

Does ConvertFPS(25)/ConvertFPS(29.97) provide the exact same result, or do I need to use something else?

Thanks :)

foxyshadis
31st October 2005, 00:37
I believe dgpulldown works on fields, so if you're encoding to interlaced output (such as dvd) that would generally look smoother than changefps. For 24->30fps that's basically equivalent to hard telecining. ConvertFPS will blend frames, which looks okay but compresses badly. ChangeFPS just inserts full frames at even intervals.

There's also truemotion, which aims to interpolate frames based on movement, like mg262's new filter, but that's not quite production quality yet. ;)

IanB
31st October 2005, 04:07
Simulate exactly as DGPulldown does it :-???Source() # 23.976 fps
ChangeFPS(60000, 1001) # or (50, 1)
SeparateFields()
SelectEvery(4, 0, 3)
Weave()

Matthew
1st November 2005, 00:36
Thank you for the replies.

Where would resize etc fit in the context of this? Is this correct?

AVISource("H:\test.avi",audio=false)
FreezeFrame(0,1,1)
ChangeFPS(60000, 1001) # or (50, 1)
SeparateFields()
SelectEvery(4, 0, 3)
Weave()
BicubicResize(720,480,0.0,0.6,5,0,567,416)
AddBorders(0,0,0,0)
ConvertToYUY2()

Also, what would be the appropriate script to simulate DGPulldown's 23.976->25 fps?

Thanks :)

foxyshadis
1st November 2005, 01:19
Resize after ivtc/deinterlace and before tc/interlacing. In fact those should usually be the first and last steps if being done. If at all possible, do the resizing in progressive mode, only resize interlaced if it can't be avoided (and be sure to use interlaced resize in that case).

Since you apparently start out progressive, resize and convert to yuy2 first. yuy2 is preferred for interlaced video because you won't get as much chroma bleed.

(Why the zero-width addborders?)

scharfis_brain
1st November 2005, 01:38
do converttoyuy2() BEFORE separatefields()

Matthew
1st November 2005, 01:59
Thanks for the replies.

foxyshadis the zero-width addborders is there because I copied/pasted from an autogenerated script and didn't delete that line.

So I take it this will do:
AVISource("H:\test.avi",audio=false)
#deinterlace etc if required
FreezeFrame(0,1,1)
BicubicResize(720,480,0.0,0.6,5,0,567,416)
AddBorders(0,0,0,0)
ChangeFPS(60000, 1001) # or (50, 1)
ConvertToYUY2()
SeparateFields()
SelectEvery(4, 0, 3)
Weave()

And ooops, I just realised that I was already given the answer for 23.976->25 fps ;o

IanB
1st November 2005, 22:39
AVISource("H:\test.avi",audio=false)
#deinterlace etc if required
FreezeFrame(0,1,1) # Zero cost
BicubicResize(720,480,0.0,0.6,5,0,567,416) # H & V Resize
AddBorders(0,0,0,0) # No-op (normally 1 blit + border fill)
ConvertToYUY2() # Fmt xlate
ChangeFPS(60000, 1001) # or (50, 1) # Zero cost
SeparateFields() # Zero cost
SelectEvery(4, 0, 3) # Zero cost
Weave() # 2 blitsDo the ConvertToYUY2 before the ChangeFPS it will be quite a bit faster. ChangeFPS returns the same video frame multiple times, the next filter in sequence does not have knowledge of this so it must operate on every frame, so in your case would be doing 2.5 times more ConvertToYUY2's.

Also for maximum speed do the Resize and AddBorders in the fastest colorspace (YV12, YUY2, RGB32 then RGB24). i.e if the input were RGB then do the ConvertToYUY2 first, if YV12 then as it is.

I have include the approximate cost of each filter stage. Zero cost filters just do pointer arithmetic they do not process any data, there may be the hidden cost of a blit with multipath scripts (your one is linear) if the next filter in the chain does a MakeWriteable().

Matthew
3rd November 2005, 23:11
Thanks a bunch for the extra information :)