PDA

View Full Version : A third option for encoding DV in CCE (re: field orders)


Logiqx
14th May 2003, 15:47
I often see threads relating to peoples trouble encoding DV material in CCE. So far I have seen two options suggested to deal with field order (of course, we all know that DV is bottom field first):

1) Use the 'top field first' flag in CCE to move the video up one line and in effect change the footage from bff to tff.

2) Encode in CCE then use pulldown, restream or whatever your preferred tool is for switching the tff/bff flags in the mpeg stream.

I've been using a third option on my footage and find the results very pleasing so I thought that it could be worth sharing. Using AviSynth (v2.51) I use a simple script to change the DV material from bff to tff. This means that I can encode as usual and should anyone need to work with my footage later (e.g. rip from my DVD and re-encode for some reason) then the footage is tff and should not cause them any problems.

The principal is simple:

1) Split the frames into separate fields
2) Add a blank field at the start and end of the footage.
3) Weave the fields back together and hey presto, it has changed to tff.


Here's an example of the kind of script that I use:

# Load the DV footage as individual fields, bottom field first is automatic.
# Note: Fix the chroma upsampling of the Canopus DV codec.

dv=AVISource("vhs.avi").FixBrokenChromaUpsampling.ConvertToYV12

fields=dv.SeparateFields

# Add a blank field at the start and end of the original footage.

BlankClip(fields, 1) + fields + BlankClip(fields, 1)

# Weave the fields back together, the result being top field first.

AssumeFieldBased.AssumeTFF.Weave

# Trim the footage to the desired length.

Trim(0, 106018)

# Use the Convolution3D plugin to smooth out VHS capture nasties!

Convolution3D(preset="vhsBQ")

# Switch back to YUY2 colorspace for MPEG-2 encoding.

YV12toYUY2


Maybe this trick will be of use (or just of interest) to you. It's just a little something that I came up with one day and been using ever since.


Logiqx

RB
14th May 2003, 16:06
To convert bff to tff in AVISynth, you can also simply doDoubleWeave().SelectOdd()

Logiqx
14th May 2003, 16:44
Thanks RB,

That will remove most of the clutter from my DV related scripts. :)

I should have spotted the DoubleWeave opportunity myself.

Logiqx

Swan
14th May 2003, 21:05
Logiqx, this sounds interesting.
But.. Since you add one black frame at the start of the video, doesn't the audio need to be moved forward 1 frame as well?
That's 1/25 second in PAL video and 1/29.97 sec for NTSC.
Maybe I'm totally off here, but I just want to check. ;)

Logiqx
14th May 2003, 23:03
The extra fields also insert the correct amount of silence too. I checked this by inserting 1001 blank fields as a test and getting ~20 seconds of black screen silence at the start of my PAL clip. I guess it's quite easy for VirtualDub to deal with this in PAL (since 48,000Hz audio can be divided exactly by 50) but it may lose a tiny bit of synchronisation in NTSC (since 48,000 / 59.97 doesn't work out exactly). I'm yet to try the DoubleWeave idea but I see no reason why it won't be just as good my longer method (except for the loss of one field at each end of the clip but I'm not that fussy, lol).

Logiqx

troy
17th May 2003, 03:47
can you explain what this line is for. Do I need this when encoding my minidv material??????
FixBrokenChromaUpsampling.ConvertToYV12

Logiqx
17th May 2003, 10:57
The FixBrokenChromaUpsampling is only required if you use the Canopus codec (read the sticky thread at the top of this forum for further information). It definitely is needed for the Canopus codec... it is easy to see why when examining interlaced material in particular.

The ConvertToYV12 is because I am using Avisynth 2.5x and in theory, subsequent filters should be faster in that colorspace. The version of Convolution3D for AviSynth 2.5x may only work in that colorspace too, I forget. Note how I have to switch back to YUY2 at the end of the script anyway.

bb
17th May 2003, 11:21
Originally posted by Logiqx
The version of Convolution3D for AviSynth 2.5x may only work in that colorspace too, I forget.
The YUV2 version of Convolution3D is now available for AviSynth 2.5x, too. See http://www.avisynth.org/~warpenterprises/

bb

midiguy
30th May 2003, 23:24
what if you just use the m$ dv codec? do you still need to use the FixBrokenChromaUpsampling line?

Logiqx
31st May 2003, 17:47
Not to my knowledge but I have not used the Microsoft codec. I opted for the Canopus codec after reading the sticky thread in this forum and examining the example images:

http://forum.doom9.org/showthread.php?s=&threadid=33526

Logiqx

Ookami
2nd June 2003, 16:53
Originally posted by RB
To convert bff to tff in AVISynth, you can also simply doDoubleWeave().SelectOdd()

http://forum.doom9.org/showthread.php?s=&threadid=46765