Log in

View Full Version : 16:9 + 4:3 interlaced togheter


symonjfox
18th October 2004, 10:50
Hi, I just went on holiday with my DV camera. I could record about 1h of tape, then the camera didn't work anymore (it had some problems with head, it must be repared by techical support).

I used the 16:9 flag (so the resolution of my cassette is 720*576 16:9 INTERLACED PAL).

So, I met some friends that come from near my country and they borrow me their DV tape, so I will use the parts where we were togheter to complete my holidays' DVD.

Their settings were 4:3, 720*576 INTERLACED.

So here's the problem:

My goal is to create a DVD that contains BOTH films, but in 1 only file and everything in 16:9.

Since both the files are INTERLACED, the problem is that I can't just RESIZE and CROP, but I think that I should SEPARE the Even and Odd fields, RESIZE and CROP them separatly; and put them togheter.

Do you have any suggestion?
Is it there another better way to do this?

Obiously I'm going to use Avisynth.
I tried to search something, and I found something useful, but I don't understand how to resize and crop every field correctly, and also to put them toghter with the same order.


Avisource("Temp01.avi")
SeparateFields()
odd=SelectOdd
evn=SelectEven
Interleave(evn,odd)
Weave()
DoubleWeave.SelectOdd()
Converttoyuy2(interlaced=TRUE)

To reach my goal, should i use:

...
odd=SelectOdd
odd=LanczosResize(odd,???,???)
odd=Crop(odd,??,??,??,??)
odd=LanczosResize(odd,720,288)
... *the same for even field


Am I right?
Is it there a program that calculates the right dimensions of resize and cropping?

Thank you

Mug Funky
18th October 2004, 11:17
one thing about DV cams and 16:9... they shoot 4:3, crop, then upsize. the good thing is that we know we're not going to lose a lot by doing the reverse, unlike with true anamorphic.

here's what i'd do for the 16:9 bits:



assumebff() # it's DV footage, so i'm 90% sure it'll be bff
tdeint(1,0) # smartbobbing in bff

lanczosresize(720,432) # obtained 432 by 768*9/16
separatefields().selectevery(4,1,2).weave()
# selectevery 4,1,2 turns it to DVD native TFF. use 4,0,3 for bff

addborders(0,208,0,224)
# keeps borders on macroblock edges to help compression a little

symonjfox
18th October 2004, 11:40
one thing about DV cams and 16:9... they shoot 4:3, crop, then upsize. the good thing is that we know we're not going to lose a lot by doing the reverse, unlike with true anamorphic.I didn't know it. I thought it captures in true anamorphic. If I knewed it, I surely captured in 4:3 :)

ok, I'm triing to open this avs but it gives me an error
"There's no function named tdeint"

Maybe do I need a dll plugin for this?

I wanted to test my theory, and it WORKS!!
Avisource("Capture.1 [00_00_00_05].avi")

SeparateFields()

odd=SelectOdd
odd=LanczosResize(odd,720,384)
odd=Crop(odd,0,48,720,288)

evn=SelectEven

evn=LanczosResize(evn,720,384)
evn=Crop(evn,0,48,720,288)

Interleave(evn,odd)
Weave()
DoubleWeave.SelectOdd()

Yes, the upsampling is not so sharp, but the result is ok for me.
I'll test your method and then I'll choose the best for me.

Thank you

symonjfox
18th October 2004, 11:53
I tried your AVS (yes, I dl the Tdeint plugin), but there's a problem with the AR.
If I watch it at 1:1 it's ok, but I'm going to create a DVD, so it would be stretched a lot (I did a preview in VDubMod using the 16:9 AR).

My way worked well so I will use it.

Thank you again :cool:

Mug Funky
18th October 2004, 12:43
when you upsize individual fields you'll get a vertical shimmer because each field is displaced by half a pixel. this is why you should bob rather than separating fields. it's a little slower (or a lot depending on what bob you use), but the results will be better.

the cropping is a matter of taste i guess. what is the destination aspect ratio you're after? remember DVD can do both, and you wont gain anything by going anamorphic off a DV cam (unless you got one of those funky anamorphic lenses).

[edit]

here's a shortened version of your script. dot syntax and "implicit last" makes things easier.


Avisource("Capture.1 [00_00_00_05].avi")

SeparateFields()
LanczosResize(720,384)
Crop(0,48,720,288)
assumefieldbased()
Weave()
DoubleWeave.SelectOdd()

the doubleweave.selectodd is to change field order, yeah?

scharfis_brain
18th October 2004, 16:02
never ever use separatefields().resize().weave() !

it will (besides of the bad-quality resizing) place the new genrerated fields in a spatial (vertical) incorrect position, causing diagonals become jaggy and the image becoming slighty jumping on TV.

better use for the easiest method, which at least creates a correct field-placement:

bob()
resize()
converttoyuy2() # only, if YV12
assumebff() # for BFF output
#assumetff() # for TFF output
separatefields()
selectevery(4,0,3)
weave()

for much better result use a more advanced bobber, like tdeint, kernelbob or tmcbob.

But this already has been explained by Mug Funky

symonjfox
18th October 2004, 18:15
Ah, ok, I understood.

But the first script you post gives to me a strange video. The result is not 720*576 that must be flagged to 16:9, but a 1:1 video (720*864) with big black borders on top and botton.

Also I don't understand the difference between TFF and BFF. I know that I must chose the even or odd field as first. I tried to read on the avisynth documentation but it doesn't explain anything.

the doubleweave.selectodd is to change field order, yeah?Yes, because if I encode it in CCE without it, I get wrong field order; while if I do the doubleweave.selectodd I get the right order. I know that I can choose the first field in the encoder (CCE or TMPGEnc) but I do this because these records are 4 files from 4 different cassettes, so I want to be sure that the whole movie will be ok.

Now I tried this one and it seems to be ok (I hope)

Avisource("Capture.1 [00_00_00_05].avi")

assumebff() # it's DV footage, so i'm 90% sure it'll be bff
tdeint(1,0) # smartbobbing in bff
LanczosResize(720,384)
Crop(0,48,720,288)
assumefieldbased()
Weave()
DoubleWeave.SelectOdd()

Is this AVS correct? I VDubMod is perfect (if seen as 16:9), and this time I bobbed instead of separatefield.

The final result must be 720*576 to be encoded AS 16:9. It doesn't matter if the quality is damaged. If I don't reencode it as 16:9, I can't join the 2 different AR cassettes, you understand?
The other solution is to convert my 16:9 cassette into a 4:3 one, but I prefer to convert the other cassette.

scharfis_brain
18th October 2004, 18:19
no it is wrong.
it halves vertical resolution.


better use:

Avisource("Capture.1 [00_00_00_05].avi")
tdeint(1)
lanczos4resize(720,432) #only 432 lines will result in a correct AR
converttoyuy2() # only, if YV12
assumefieldbased()
assumebff()
separatefields()
selectevery(4,0,3)
weave()
addborders(0,72,0,72)

symonjfox
18th October 2004, 18:55
Originally posted by scharfis_brain
no it is wrong.
it halves vertical resolution.

better use:
Avisource("Capture.1 [00_00_00_05].avi")
tdeint(1)
lanczos4resize(720,432) #only 432 lines will result in a correct AR
converttoyuy2() # only, if YV12
assumefieldbased()
assumebff()
separatefields()
selectevery(4,0,3)
weave()
addborders(0,72,0,72)
Your AVS is good if I would create a DivX file (so the AR is 1:1).

I don't! I want to create a DVD with 16:9 AR. So I expand the vertical resolution (from 288 to 384) and then I crop 48 lines on top and 48 lines on bottom. The result is PERFECT.

The part I doubt is the BOB and WEAVE settings. They should be ok.

scharfis_brain
18th October 2004, 19:10
this script is NOT suitable for divx or others.
it is not a square-pixel format. it delivers DVD conform 1:1.094 PAR.


but if you want upsize 4:3 to 19:9 use this:
(I always thought, you wanted the opposite!)

Avisource("Capture.1 [00_00_00_05].avi")
tdeint(1)
crop(0,72,0,432)
lanczos4resize(720,576)
converttoyuy2() # only, if YV12
assumefieldbased()
assumebff()
separatefields()
selectevery(4,0,3)
weave()

also, I have to repeat myself:
384 active lines are not representing 16:9!

704x432 = proper 16:9
(704 -> 768x432 = 1.777777 = 16:9)

704x384 = 2.000 inbetween 16:9 and 1:2.35

symonjfox
18th October 2004, 19:17
OK, this is perfect. Thank you.

I don't remember how I found 384, I'm not so good in maths.

Never mind. This script works, I'll use it.

Thank you again