PDA

View Full Version : 4.3 LB To 16.9 anamorphic WS


Master Yoda
22nd March 2007, 18:13
I was wondering how i would go about converting a 4.3 letterboxed film to a 16.9 anamorphic dvd. I know how to add in crop and resizer's but how would i caculate what i would need to keep the aspect correct ?? without just guessing and then loading the avs into VD to see if its correct.

After doing so would it be a good idea to run a sharpening filter.?

MuttLover
22nd March 2007, 23:39
There is an option in DVDRebuilder to accomplish this in the PRO version -- here's the aviscript it creates (NTSC sizes).

Hope this helps.


#------------------
# AVS File Created by DVD Rebuilder
# VOBID:01, CELLID:01
#------------------
LoadPlugin("C:\Program Files\DVD-RB PRO\DGDecode.dll")
mpeg2source("C:\IMAGES\DVDRBWORK\D2VAVS\V01.D2V")
trim(0,3449)
SeparateFields().LanczosResize(720,288,0,36,720,216).Weave()
ConvertToYUY2(interlaced=true)
AudioDub(BlankClip())

Master Yoda
23rd March 2007, 00:18
mmmmmm tried that gave me a massive black bar at the bottom, a small one and top and was 720x576.

what i had was ...

Crop(0,46,0,-46)
LanczosResize(720,480)

the 46 was just me guessing, doubt the ar was correct. I have a couple of older films i would like to try this on. One is NTSC, 29.970 and interlaced the others are PAL not sure wether there interlaced or progressive, have'nt checked. Was trying the NTSC one first.

davidhorman
23rd March 2007, 10:44
Anamorphic has 1.333x the vertical res of non-anamorphic, so you need to crop away 1/4 of the pixels before you resize. For NTSC, that's crop(0,60,0,-60).

I think the script MuttLover posted is for PAL, which is why it didn't work when you tried it.

David

G_M_C
23rd March 2007, 11:10
Anamorphic has 1.333x the vertical res of non-anamorphic, so you need to crop away 1/4 of the pixels before you resize. For NTSC, that's crop(0,60,0,-60).

I think the script MuttLover posted is for PAL, which is why it didn't work when you tried it.

David

Nope it's for PAL -interlaced-, your film is probably progressive (at least: reading from your post I think it is).

Use Virtualdub to get the cropping and the resizing right (to make it easy on yourself, use Crop (xxx,xxx,xxx,xxx) and ?????Resize (xxx,xxx) seperately).

Going on the info in your posts I think it has to be
For PAL:
Crop (0,72,0,-72)
Spline16Resize(720,576)

For NTSC:
Crop (0,60,0,-60)
Spline16Resize(720,480)

And ... DONT FORGET TO ENCODE AS ANAMORPHIC !

Or it'll look like sh*t ;)

Master Yoda
23rd March 2007, 17:33
The NTSC footage is actually interlaced, by doing what im trying to do this wont cause a problem will it like pulling the two fields apart ?? i dont need to do any seperating or weaving do i.

And should i use Spline16Resize as you have sugguested or use LanczosResize like i was already ??

Master Yoda
26th March 2007, 03:25
Sorry just need to bump this as i need to know when doing what im doing do i need to do that SeparateFields and Weave thing as the NTSC footage is interlaced and if so what should my script look like ??

As i was going to use
Crop (0,60,0,-60)
Spline16Resize(720,480) or LanczosResize(720,480)

So if i need to SeparateFields and weave how would i do this ..

davidhorman
26th March 2007, 10:38
You need to bob rather than separatefields, otherwise the fields will be offset when you come to weave them together:


assumetff/assumebff # depending on your source
bob # consider using a better bobber - dgbob, tdeint, mvbob, mcbob...
crop(0,60,0,-60)
spline16resize(720,480)
separatefields
selectevery(4,0,3)
weave


It may seem odd to separatefields after you've already bobbed, but this is the way to do it :)

David

Master Yoda
26th March 2007, 23:42
I see... So this is what i have now

assumetff
dgbob(order=1)
crop(0,60,0,-60)
spline16resize(720,480)
separatefields
selectevery(4,0,3)
weave

AddAudio()
ConvertToYUY2(interlaced=true)


Need to ask as i like to have some idea as to why when doing things.... is it nesasery to bob, separatefields and weave when doing what i am hoping to achive ?? is so why is there the need ?? also whats the selectevery(4,0,3) part of the script about and why is assumetff need.

I mean if i was to use just
Crop (0,60,0,-60)
Spline16Resize(720,480) or LanczosResize(720,480)
with interlaced footage would i get problems ? i guessing this is fine for progressive footage though.

525/60
27th March 2007, 00:41
Yep, the simpler script is good for progressive.

The complicated script takes an interlaced stream and outputs an interlaced stream. Between the bob and separatefields the stream is progressive and you can resize there. selectevery(4,0,3) selects the top field from the first frame, the bottom field from the second frame, the top field from the third frame, the bottom fields from the fourth frame, etc. You end up with the same interlacing you started with. But effectively you resized the fields separately.

Master Yoda
27th March 2007, 00:48
Ah... thanks for the explanation, so weave just combines the two frames together right?. I take it that resizing is easier when progressive.

So out of curiosity if you was to use the simpler script on a interlaced source would this cause problems then ??

Oh using LanczosResize instead would be fine right ? never used spline16 or 32 before.

Next step fire up CCE and encode.

Thanks for the help.

Master Yoda
28th March 2007, 18:06
Bloody hell... All in all i dont think its worth trying to go from 4.3LB to 16.9 Wide with interlaced, using that script its going to take 3 hours 40 minutes just to create the .vaf file and i was intending to do 6 pass'.

I take it theres no way of doing this a quicker way...??

Leak
28th March 2007, 18:21
Bloody hell... All in all i dont think its worth trying to go from 4.3LB to 16.9 Wide with interlaced, using that script its going to take 3 hours 40 minutes just to create the .vaf file and i was intending to do 6 pass'.
Ugh... how about encoding to a lossless format first, then running your 6 passes off that?

np: Bleubird - Kill Guys (Rip USA (The Birdfleu))

Master Yoda
29th March 2007, 00:20
Encode it to lossless using that script so everything is resized and cropped first ?? and would encoding to lossless be a slow process aswell ??

If so what do you suggest ?? which lossless ??

I dont wanna lose any quality though in doing this.

Leak
29th March 2007, 09:22
Encode it to lossless using that script so everything is resized and cropped first ?? and would encoding to lossless be a slow process aswell ??
You said you wanted to do 6 passes with whatever encoder you were using.

Encoding to a lossless format first adds a pass, so to speak, but since all other passes need to do exact zero filtering afterwards it's going to go a lot faster...

If so what do you suggest ?? which lossless ??

I dont wanna lose any quality though in doing this.
I've always used ffdshow's HuffYUV codec and never had a problem with it.

And by encoding with a codec that doesn't affect quality at all because the decoded video is a 1:1 reproduction of the video you encoded (hence the term "lossless") it's rather hard to hamper the result's quality...

G_M_C
29th March 2007, 11:00
I dont exactly know if your source is actually worth doeing sophisticated de-interlacing at all. Often it is not a big problem when you leave the clip interlaced, but resized to 19:9 ana. Keeping things simple when possible is the best advise anyway. Maybe you can upload a 1-minute clip somewhere ?

Without de-interlacing the whole process would be considerably faster.

You said in reaction to my earlier post (sorry i didnt react back earlier btw.) that you source clip is NTSC, interlaced. In wich case i posted the wrong suggestion. For NTSC, interlaced, it should be:


SeparateFields()
Crop (0,30,0,-30)
Spline16Resize(720,240)
Weave()

(separating the fields results in half hight, so halving the figures I gave earlier for clip-hight should do the trick).

BTW: I see you use CCE to do the encoding (the .vaf file-extention gave that away). Make shure there is a ConvertToYUY2(interlaced=true) in your script somewhere.

There are some other things that you might have to check when you use CCE, but in most cases the default settings (for DVD-RB ?) are OK, but dont forget the YUY2(interlaced)-bit I wrote about above.

davidhorman
29th March 2007, 12:32
I dont exactly know if your source is actually worth doeing sophisticated de-interlacing at all. Often it is not a big problem when you leave the clip interlaced, but resized to 19:9 ana.

You must deinterlace (specifically, bob) before resizing vertically. If you don't, the fields will be blended in your resized frame and won't play back properly.

SeparateFields()
Crop (0,30,0,-30)
Spline16Resize(720,240)
Weave()

This won't work (well, not perfectly) - you have to bob before resizing, otherwise you'll introduce a small vertical offset between fields (less than a pixel, but possibly enough to cause an unpleasant judder).

The correct code would be:

bob # consider a better bobber - leakkernelbob is simple and fast and gives much nicer results
crop(0,60,0,-60)
spline16resize(720,480)
separatefields
selectevery(4,0,3)
weave

David

Master Yoda
29th March 2007, 18:07
Well G_M_C's sugguestion was alot quicker, speed got up to 2.6 40 odd mins to do the .vaf but if thats going to cause problems like davidhorman said then i would rather not do it, a judder would bug me.

The only problem is having to Bob, that seems to be whats slowing it right down.

Now if i was to do Leak suggestion will it take long to convert to a lossless format and what sort of file size am i looking at. Film is nearly 2 hours.

Im starting to wish this was progressive rather than interlaced. The simple script would have worked fine then.

Leak
29th March 2007, 18:27
Now if i was to do Leak suggestion will it take long to convert to a lossless format and what sort of file size am i looking at. Film is nearly 2 hours.
In that case, several tens of gigabytes... it's the good ol' time vs. space tradeoff...

np: Bleubird - Switchblades (Rip USA (The Birdfleu))

Master Yoda
29th March 2007, 18:34
Tens of GB... hehehe, we talking say 30GB or more near 90GB ?? and what sort of time am i looking at to convert to lossless with that script to crop and resize?

foxyshadis
29th March 2007, 19:24
Load it into virtualdub and start the conversion. Within a minute or two it'll give you good statistics on how long it'll take and how large it will be. (Unless the movie starts with all black frames or something, those will throw the size off. Wait until it gets into real frames.) There are several different lossless codecs, you might pick something like lagarith or ffdshow's ffv1 if huffyuv is just way too large.

Master Yoda
30th March 2007, 17:20
OK, i think im going to go down the lossless format first route, i will have space once i clean one of me drives up abit. But before i go ahead

With settings in VD

video->full processing mode
video->compression->ffdshow video codec->configure
then encoder set to HuffYUV, FourCC HFYU, predictor Place, colour space which one should i select ?? YUY2 or YV12

it had around 6hours 40mins and was about 50GB. Now in my script i have ConvertToYUY2(interlaced=true) to i need this for VD or do i need something different??

A did to a quick test buy when i try and load the new avi into CCE ICDecompressgetformat() failed :-1

I know this is a lossless format but i asked about the quality as its being upscaled i thought it may loss more quality rather than doing a mutlipass in CCE would.

Leak
30th March 2007, 17:36
With settings in VD

video->full processing mode
Unless you're using VirtualDub's own filters you really should choose "Fast recompress" or you'll get one or two unneeded colorspace conversions in there.

video->compression->ffdshow video codec->configure
then encoder set to HuffYUV, FourCC HFYU, predictor Place, colour space which one should i select ?? YUY2 or YV12
YV12 is what DVDs use, so choose that.

Now in my script i have ConvertToYUY2(interlaced=true) to i need this for VD or do i need something different??
Drop the conversion, as it looks like your script works in YV12 anyway, and unneeded colorspace conversions only cost quality.

A did to a quick test buy when i try and load the new avi into CCE ICDecompressgetformat() failed :-1
If CCE uses Video for Windows (VfW) - have you set ffdshow to decode HuffYUV for VfW? There's an entry "VFW Configuration" in ffdshow's start menu folder; run it, go to the decoder tab and choose "libavcodec" for HuffYUV on the codecs page.

I know this is a lossless format but i asked about the quality as its being upscaled i thought it may loss more quality rather than doing a mutlipass in CCE would.
Errr... what? Lossless encoding doesn't affect quality at all, modulo colorspace conversions. Filtering, on the other hand, will affect quality, but it'll do it no matter if you feed the result to a HuffYUV codec or CCE...

And could you perhaps post your exact script?

Master Yoda
30th March 2007, 17:54
this is the script

assumetff
dgbob(order=1)
crop(0,60,0,-60)
spline16resize(720,480)
separatefields
selectevery(4,0,3)
weave

AddAudio()
ConvertToYUY2(interlaced=true)

So i can drop the ConvertToYUY2(interlaced=true), when it comes to Encoding the new avi in CCE will i need ConvertToYUY2(interlaced=true) back though as im sure its needed for CCE ??

So

AVISource("******.avi")

Addaudio()
ConvertToYUY2(interlaced=true)

Leak
1st April 2007, 11:34
this is the script
So i can drop the ConvertToYUY2(interlaced=true), when it comes to Encoding the new avi in CCE will i need ConvertToYUY2(interlaced=true) back though as im sure its needed for CCE ??
I don't know CCE, but it shouldn't be neccessary if the video is in YV12 colorspace already - why don't you just take a 10 second clip and give if a try? :)

Note that the "interlaced=true" just tells ConvertToYUY2 to treat the chroma a bit differently when converting, it doesn't somehow magically make the video interlaced or anything...

np: Styrofoam - Future Debt Collector (The Point_Misser)

Master Yoda
1st April 2007, 12:37
The reason i asked wether i need to add ConvertToYUY2(interlaced=true) when encoding the new avi to mpeg2 in CCE was because when using fitcd to get the correct resize for other avi conversions and both dif4u and scenaid always have ConvertToYUY2(interlaced=true) or ConvertToYUY() at the end.

I run a small test sample using the script i posted and using the settings in vd you suggested, i then encoded the short test with cce but for some strange reason the video footage is upside down the avi is the correct way up though, any ideas??

Lastly i opened the newly encode avi in vb using a short script with
Avisource("*******.avi")
Info()

The info says parity : bottom field first even though that script is telling it top field first and the original m2v file is top first.

525/60
1st April 2007, 22:30
@LeakNote that the "interlaced=true" just tells ConvertToYUY2 to treat the chroma a bit differently when converting, it doesn't somehow magically make the video interlaced or anything...I wonder if you realize the video coming out of that script *is* interlaced? The bobbing is only done to allow vertical resizing of interlaced material. The line SelectEvery(4,0,3)converts it back to interlaced.
I don't know CCE, but it shouldn't be neccessary if the video is in YV12 colorspace alreadyConvertToYUY2 doesn't convert it to the YV12 colorspace.

@Master Yoda
It is very possible that CCE can't read the YV12 colorspace.I run a small test sample using the script i posted and using the settings in vd you suggested, i then encoded the short test with cce but for some strange reason the video footage is upside down the avi is the correct way up though, any ideas??Yes, CCE is probably using a different decoder for viewing than you use for the avi. There was a parallel problem with VirtualDub when AviSynth started using YV12: How do I use v2.5x if the encoding programs can't handle YV12 (like TMPGEnc or CCE SP)? (http://avisynth.org/mediawiki/YV12_FAQ#How_do_I_use_v2.5x_if_the_encoding_programs_can.27t_handle_YV12_.28like_TMPGEnc_or_CCE_SP.29.3F)*Actually, the part of the fax I wanted to quote doesn't exist anymore.
In such situations, you only need judge the quality of the avi.
The info says parity : bottom field first even though that script is telling it top field first and the original m2v file is top first.Perhaps you need to add AssumeTFF before SeparateFields. It should be very obvious if SeparateFields and Weave are not using the same parity though.

Stephen

Leak
1st April 2007, 23:18
@Leak: I wonder if you realize the video coming out of that script *is* interlaced?
Yes, I do know that. I'm just not sure Master Yoda knows exactly what setting that flag does.

ConvertToYUY2 doesn't convert it to the YV12 colorspace.
Of course not, but an MPEG2 encoder worth it's salt should be able to encode YV12 natively, don't you think?

After all, 4:2:0 color subsampling is in the DVD spec...

np: Death Cab For Cutie - Stability (The Stability EP)

foxyshadis
2nd April 2007, 00:36
CCE is weird, its importing hasn't changed since the days when YUY2 and RGB were the only ways anyone explicitly dealt with interlaced material. (Adobe software also mostly won't accept YUV at all.) I guess they figure everyone would get confused having to manually decide how to upsample the chroma? Who knows, but you have to use YUY2 with it.

Master Yoda
2nd April 2007, 17:47
OK, im nearly there i think. Importing into CCE using a .avs instead of the avi it's self Its up the correct way, only two lines....

AVISource("*****.avi")

ConvertToYUY2()

Last thing i need to sort, VD is still saying the new avi is BFF


Perhaps you need to add AssumeTFF before SeparateFields. It should be very obvious if SeparateFields and Weave are not using the same parity though.

Stephen

I tried adding AssumeTFF before SeparateFields instead of before dgbob but it still saying its BFF, unfortanatly its not obvious to me if SeparateFields and Weave are not using the same parity though so could i get a explaination on how it is please.

Just need to sort this last hurdle out of getting the AVI to be TFF.

525/60
2nd April 2007, 19:14
I am not sure what causes parity to shift, but it seems to do so often. Just to make sure, I would try inserting info() both before and after both SeparateFields and Weave.

@Leak and foxyshadisI guess they figure everyone would get confused having to manually decide how to upsample the chroma?When AviSynth went natively YV12, a faq had to be created explaining what it was and how to deal with it. Users were very confused. So I can understand why developers are reluctant to implement it. RGB is easy to understand; YUV is hard enough without offering it in two flavors.

Stephen

Master Yoda
3rd April 2007, 00:02
I tried adding info() both before and after both SeparateFields and Weave. When before SeparateFields and after weave it says TFF, when its after SeparateFields and before weave it has both TFF and BFF over lapping each other.

So if its TFF both before SeparateFields and after Weave why is the new output avi showing up as BFF

ChiDragon
3rd April 2007, 01:43
AVISource assumes that any input is BFF since AVIs don't hold any info about parity. You can use AssumeTFF after it.

Master Yoda
3rd April 2007, 01:55
When you say after it do you mean at the end of the script ?? so it would be thus..

dgbob(order=1)
crop(0,60,0,-60)
spline16resize(720,480)
separatefields
selectevery(4,0,3)
weave
assumetff

Or do you mean when encoding to mpv ?? like thus ??

avisource("******.avi)
assumetff

converttoyuy2()

I think i get what you saying, the avi it's self is'nt BFF but AVISource is assumeing its BFF. So im guessing the second script for encoding the avi to mpv is the correct one.

ChiDragon
3rd April 2007, 06:36
Yeah, the second one.

Master Yoda
10th April 2007, 18:49
Just posting to say Thanks for the help. Turned out a treat, just gotta watch it through now just to check but seems sweet as a nut.

Now just for future reference as i have a couple of other films that are LB and i may re-do to WS these are the scripts to use (gonna keep them in a txt file so i dont forget)

For Progressive
For Pal:
Crop (0,72,0,-72)
Spline16Resize(720,480) or LanczosResize(720,480)

For NTSC:
Crop (0,60,0,-60)
Spline16Resize(720,480) or LanczosResize(720,480)

For interlaced

assumetff
dgbob(order=1)
crop(0,60,0,-60)
spline16resize(720,480)
separatefields
selectevery(4,0,3)
weave

With interlaced is everything the same for pal except the resize and crop ?? selectevery is still the same ??

davidhorman
10th April 2007, 19:24
One correction:

For Progressive
For Pal:
Crop (0,72,0,-72)
Spline16Resize(720,576) or LanczosResize(720,576)

David

Master Yoda
10th April 2007, 19:33
opps my bad, i had just copied and pasted that line did'nt check it :(

ChiDragon
11th April 2007, 00:43
The SeparateFields().SelectEvery(4,0,3).Weave() would be the same yes.

EDIT: Just to clarify why it works since it took me a while to figure it out myself.

NTSC:

Source (30,000/1001 fps)
Bob (60,000/1001 fps)
Filters
SeparateFields (120,000/1001 Hz)
SelectEvery (60,000/1001 Hz)
Weave (30,000/1001 fps)


PAL:

Source (25 fps)
Bob (50 fps)
Filters
SeparateFields (100 Hz)
SelectEvery (50 Hz)
Weave (25 fps)


The numbers are different but the ratios are the same so it works for both.