Log in

View Full Version : Dv -> Mpg2


NinjaOne
19th August 2003, 18:04
I know theres tons of guides for downsizing dvds, and making dvds from many sources. But I have yet to find one for encoding from dv to mpeg2 for dvd authoring. It'd be great if someone could post one. TIA.

bb
22nd August 2003, 10:15
Well, yes, this has been on my to-do list for months now, but I did not yet find the time to write one. I am still hoping that I can soon provide a guide.

bb

NinjaOne
22nd August 2003, 14:51
Well thanks a million, I've been following the dvd encoding guides and just trying to experiment accordingly sometimes getting good results and some times getting horrendous ones.

bb
23rd August 2003, 23:19
I can give you at least a few hints: Use AviSynth to frame serve your video, and use Convolution3D to clean the picture before encoding. Make sure you separate the fields before, if your source is interlaced (and weave them back together before handing it over to the encoder).

If you use CCE (2.66), use "MPEG-2 (ES, One-pass VBR)" at a Q factor of 60 or less - I often use 40 - or "MPEG-2 (ES, Multipass VBR)" at the highest bitrate you can afford. I wouldn't go higher than 8000 kbps average, though. For multipass VBR use at least 2 passes; 3 passes is even better, but more is useless.

Use the correct aspect ratio settings (4:3 for most DV sources, but I usually use 16:9), and don't process the audio in CCE (better use BeSweet). In the Video settings select "DVD video compliant", and uncheck the "Upper field first" box (better correct for field order in AviSynth if necessary).

In the menu you get when clicking the "Quality" button, unselect "Low pass filter", "Effect restricted vertical filter", and "Dithered quantization". I leave the flat part priority at the default of 16. Set "Intra block DC precision" to 9 Bits. For interlaced sources select "Block scanning order" = "Alternate", for progressive sources select "Zigzag" and check "Progressive frame flag".

bb

FredThompson
24th August 2003, 08:02
If your source is NTSC DV, use Xesdeeni's 411Helper if VirtualDub or trbarry's 4:1:1->4:2:2 AviSynth converter (which I prefer.)

Long discussions about these. You can find them through search. NTSC DV uses one chroma value for 4 horizontal pixels. MPEG2 typically uses 1 value for a 2x2 grid of pixels. The two don't play nice so it's a good idea to "correct" the chroma.

NinjaOne
24th August 2003, 11:08
Wow after reading your post I learned I don't know anything about dv -> mpg2 encoding. Thanks a bunch both of you, and yes my material is NTSC.

lamola2003
25th August 2003, 17:49
"bb" I read your post. It is very good.
Please, post the AVS script for me and all newbies.
I am compiling for CVD y DVD. I use eccl y cce 2.66
My DV is PAL
My english es very bad. I read english but I not write english.
Thank you. From Alicante
Lamola

bb
25th August 2003, 19:07
Originally posted by lamola2003
Please, post the AVS script for me and all newbies.
Welcome to the forum, Lamola.

Well, it depends much on the source, and on your personal taste, how your AviSynth script would look like. A simple two-liner may be all you need, like
AviSource("C:\MyDVFiles\DV_type2_file.avi")
Convolution3D(1, 6, 10, 6, 8, 2.8, 0)
or
DirectShowSource("C:\MyDVFiles\DV_type1_file.avi", 25)
Convolution3D(1, 6, 10, 6, 8, 2.8, 0)
(the 25 above is the frame rate for PAL; for NTSC you'd use 30.)

This is what I use often to encode my progressive PAL material. Of course you may want to alter the Convolution3D parameters, or you may want to include some additional filters.

As many people will have to cope with interlaced sources:
AviSource("C:\MyDVFiles\DV_type2_file.avi")
SeparateFields()
odd=SelectOdd.Convolution3D(1, 6, 10, 6, 8, 2.8, 0)
evn=SelectEven.Convolution3D(1, 6, 10, 6, 8, 2.8, 0)
Interleave(evn,odd)
Weave()

This way each field will be filtered separately, thus the interlaced structure will be preserved.

Replace AviSource with DirectShowSource like above if your DV AVI is type-1.

Hope that helps. Comments are welcome, of course.

bb

lamola2003
26th August 2003, 08:24
Thank you, bb.
I read your script and I will use for.
My source is DV-PAL, Sony pc10e, steadyshot:on. The quality source is, frequently, ligth:regular, movement:normal/high.
The script I use:
FOR CVD:
LoadPlugin("C:\ARCHIV~1\DVD2SVCD\AVISYN~1.5PL\Mpeg2dec\MPEG2D~1.DLL")
LoadPlugin("C:\ARCHIV~1\DVD2SVCD\AVISYN~1.5PL\INVERS~1\decomb.dll")
AVISource("D:\RIPEO\peli.avi",False)
ConvertToYUY2()
FieldDeinterlace()
BicubicResize(352,576,0.0,0.6)
ConvertToYUY2()
FOR DVD:
LoadPlugin("C:\ARCHIV~1\DVD2SVCD\AVISYN~1.5PL\Mpeg2dec\MPEG2D~1.DLL")
LoadPlugin("C:\ARCHIV~1\DVD2SVCD\AVISYN~1.5PL\INVERS~1\decomb.dll")
AVISource("D:\RIPEO\peli.avi",False)
ConvertToYUY2()
FieldDeinterlace()
ConvertToYUY2()

bb: What modifications for my scripts, please? Is it well for my video editions?

lamola

GParent
28th August 2003, 19:09
I'm just learning this AVISYNTH scripting. Expanding BB's script, I added a line to convert from my RGB32 AVI to YUY2, and I am planning to feed this through CCE Mpeg Encoder. I installed AVISYNTH 2.5.2 and the latest HUFFYUV codec.

I have read documentation at the Convolution3D web site. In my case, I have a MiniDV that was captured with no frame loss and was edited using Vegas4. The output normally would go directly into CCE. I have now included the following script. Why? To see if the Convolution3D filter would make the video better.

Background Info: In my case, the video originated from one of those Cable TV access stations where live music was recorded, and fed to a PC or MAC where it was edited. Then, I got it when the editor made me a copy onto a MiniDV tape. I have no idea what problems were introduced in the chain up to when I got it. Therefore, maybe the Convolution3D filter is medicine that is too late to help my video, which is not bad but could look better.

I am trying to grasp what the different parameter combinations will do for you. For example, the first number in the filter is a 1. I read where this uses the blur more aggressively. I'm not sure what that means or if I should have used a 0, for less aggressive. Is there going to be more discussion of this filter? It looks like a winner!

My AVI Script into CCE:

AviSource("SOURCE.AVI")
ConvertToYUY2(interlaced=true)
SeparateFields()
odd=SelectOdd.Convolution3D(1, 6, 10, 6, 8, 2.8, 0)
evn=SelectEven.Convolution3D(1, 6, 10, 6, 8, 2.8, 0)
Interleave(evn,odd)
Weave()

Bugsy
29th August 2003, 09:04
These are two scripts I'm using for converting PAL DV to DVD.

#Directshow version
LoadPlugin("c:\windows\system32\Convolution3D.dll")
DirectShowSource("C:\Movie0002.avi",fps=25)
FixBrokenChromaUpsampling() # If you use a MS codec
convertToYUY2() # A YV12 version is available, but this works well
fps50=SeparateFields()
even=selectEven(fps50).Convolution3D (1, 6, 10, 6, 8, 2.8, 0)
odd=selectOdd(fps50).Convolution3D (1, 6, 10, 6, 8, 2.8, 0)
interleave(even,odd).weave()
DoubleWeave().SelectOdd() # For fixing the CCE upper field bug

NB! No sound using DirectShow unless the brilliant sh0dan comes up with something...
http://forum.doom9.org/showthread.php?threadid=57357

#AviSource version with alternative Convolution3D settings
LoadPlugin("c:\windows\system32\Convolution3D.dll")
AviSource("C:\Movie0002.avi")
convertToYUY2()
fps50=SeparateFields()
even=selectEven(fps50).Convolution3D (1, 6, 10, 6, 8, 2.8, 0)
odd=selectOdd(fps50).Convolution3D (1, 6, 10, 6, 8, 2.8, 0)
# Replace the Convolution3D setting above according to this:
# Convolution3D(1, 16, 32, 16, 24, 2.8, 0) # Alternative for noisy DV
# Convolution3D (1, 6, 10, 6, 8, 2.8, 0) # For good DV source
interleave(even,odd).weave()
DoubleWeave().SelectOdd() # For fixing the CCE upper field bug

For CCE settings follow the settings from bb.

Good luck!

Bugsy

bb
29th August 2003, 09:40
Originally posted by lamola2003

FOR CVD:
LoadPlugin("C:\ARCHIV~1\DVD2SVCD\AVISYN~1.5PL\Mpeg2dec\MPEG2D~1.DLL")
LoadPlugin("C:\ARCHIV~1\DVD2SVCD\AVISYN~1.5PL\INVERS~1\decomb.dll")
AVISource("D:\RIPEO\peli.avi",False)
ConvertToYUY2()
FieldDeinterlace()
BicubicResize(352,576,0.0,0.6)
ConvertToYUY2()
FOR DVD:
LoadPlugin("C:\ARCHIV~1\DVD2SVCD\AVISYN~1.5PL\Mpeg2dec\MPEG2D~1.DLL")
LoadPlugin("C:\ARCHIV~1\DVD2SVCD\AVISYN~1.5PL\INVERS~1\decomb.dll")
AVISource("D:\RIPEO\peli.avi",False)
ConvertToYUY2()
FieldDeinterlace()
ConvertToYUY2()


- There's no need to load the MPEG2DEC plugin; this is for opening d2v sources only.

- Why do you call ConvertToYUY2() twice?

- For better deinterlacing I'd try Donald Graft's new kernel deinterlacer. For DVD I'd rather keep it interlaced (and encode interlaced, too, using "alternate scan" etc.).

bb

bb
29th August 2003, 09:50
Originally posted by GParent
For example, the first number in the filter is a 1. I read where this uses the blur more aggressively. I'm not sure what that means or if I should have used a 0, for less aggressive. Is there going to be more discussion of this filter? It looks like a winner!


The first parameter decides whether a "full-1 matrix" is being used or not. The full-1 matrix gives every neighbour pixel in time and space equal weight, whereas the standard matrix weighs the neighbour pixels according to the distance from the current pixel. So yes, "1" may blur a little more, but results in better compression, too. Most of the time I prefer the "1" over the "0".

There's been a lot of discussion in the AviSynth Usage forum when the filter has been introduced. You'll find a few very long threads about it, e.g.
http://forum.doom9.org/showthread.php?s=&threadid=29829
or
http://forum.doom9.org/showthread.php?s=&threadid=32762

Lately there wasn't very much new discussion about the filter, I guess because vlad59 couldn't continue development any longer. For that reason the YV12 version hasn't been finished.

bb

NinjaOne
2nd September 2003, 14:42
Thanks a million for your DV to DVD guide, it came at just the right time.

bb
2nd September 2003, 15:01
You are very welcome. Feel free to post your experience with the guide, so that I can improve it.

bb

Kika
2nd September 2003, 15:20
BicubicResize(352,576,0.0,0.6)

For CVD (Half-D1), that's not correct. CVD bases on 704x576, not 720x576. So that's better:

BicubicResize(352,576,0,0.6,8,0,704,576)