Log in

View Full Version : Swap just chroma between fields?


Karyudo
11th January 2005, 09:06
I just know somebody's going to be able to solve this in no time at all -- unfortunately, that person isn't me.

A friend of mine needs a filter/script that can swap the chroma channels between fields. He is editing a field sequential 3D video, but for some reason, the video he has been given has the chroma for field A on field B and vice versa.

I haven't found anything tailor-made to fix it, but some initial research on AviSynth.org suggests that maybe SeparateFields(), AssumeTFF(), AssumeBFF(), SwapFields(), Weave(), and some of them fancy YtoUV() and other colour-plane filters are required. Normally I'd search harder, and then eventually struggle along until I solved it myself (how else to learn?), but in this case a quick fix is needed.

Can anyone bang out a quick'n'dirty script to do this?? (Many thanks in advance!)

Didée
11th January 2005, 09:42
MergeChroma( SwapFields() )

Karyudo
11th January 2005, 15:51
Holy s*** -- that's it? Thirty-six minutes elapsed time between request and answer, two commands on one line, and that's it?!?

I'm dumber than I thought.

Thanks, Didée. From following along on the LS/iiP threads I knew you were good at this stuff, but here with this startlingly simple script you've shown me just how good.

Didée
11th January 2005, 16:41
First try it out and see if it works as expected. From your description, I *suppose* that this is the solution to your problem. However, this is about interlaced stuff - and I consider myself as "interlacing impaired" :D

scharfis_brain
11th January 2005, 17:22
indeed. didée's solution works.

The only thing, that I didn't try was the chroma placement.
I am not sure whether swapfields() is handling YV12-interlaced correctly.

the more correct way *should* be this:


separatefields()

even1=selecteven()
odd1=selectodd()

even=even1.mergechroma(odd1)
odd=odd1.mergechroma(even1)

interleave(even,odd)


if the wrong planes are getting swapped try inserting duplicateframe(0) after separatefields() and ensure to set the correct fieldorder directly after loading the video using assumetff() respectively assumebff().

dokworm
12th January 2005, 15:22
I have a similar problem, but AVIsynth seems to stuff it up.

I want to load VOBs directly, but if I use:
DirectShowSource("g:\jaws3d.vob")

It seems to have only picked up one field. (i.e. instead of getting interlaced video, I get it de-interlaced somehow)

Is there another way to load a VOB file without it throwing away one of the fields?
Or alternatively is there a filter for vdub that will do the equivalent of MergeChroma( SwapFields () )

scharfis_brain
12th January 2005, 16:07
do not use directshowsource for VOB-Files.
use DVD2AVI / DGindex instead.

directshowsources uses the directshow-filterchain to get the video.
but most mpeg-2-decoders for directshow are set to deinterlacing per default.

dokworm
12th January 2005, 16:24
Ahh, OK thanks for that. It now loads correctly.

I had to use weave() instead of interleave(even,odd)
Otherwise it effectively de-interlaced again.

Even using either method of MergeChroma, it doesn't appear to fix the problem.

I have attached a pic of the file with the fields unfolded to an above/below layout to show the problem.
Perhaps the problem is something else?

dokworm
12th January 2005, 16:27
here is the output file with the colour problem.
The original file is a 3D interlaced field sequential file.
i.e. the left eye is on the odd field and the right eye is on the even field.
However as you can see there is a problem with the chroma

dokworm
12th January 2005, 16:38
Ahh, OK thanks for that. It now loads correctly.

I had to use weave() instead of interleave(even,odd)
Otherwise it effectively de-interlaced again.

Even using either method of MergeChroma, it doesn't appear to fix the problem.

I have attached a pic of the file with the fields unfolded to an above/below layout to show the problem. Perhaps it is something else?
http://mr-pete.server101.com/jaws3d/jaws3d-source.png
http://mr-pete.server101.com/jaws3d/jawsout.jpg

dokworm
21st January 2005, 13:50
anyone?

scharfis_brain
21st January 2005, 14:03
which codec has been used to store the 3d-animation into the avi-container?

dokworm
21st January 2005, 14:29
Not sure, they are on a DVD that plays in a normal player - so they are .vob files. How can I check?

scharfis_brain
21st January 2005, 14:56
it seems, that they have been encoded improperly with progressive encoding instead of interlaced encoding.

is there no chance for you to get the raw uncompressed videos?
or even to render the 3D-animation again.

dokworm
21st January 2005, 15:00
No, there really isn't - the originals are from 3D VHD discs that I do not have access to.

I was hoping there may be some way to clean up the mess that the chroma is now in...

Macanudo
21st January 2005, 15:02
Originally posted by scharfis_brain
it seems, that they have been encoded improperly with progressive encoding instead of interlaced encoding.

is there no chance for you to get the raw uncompressed videos?
or even to render the 3D-animation again.

Would shh's Restream be of any help?http://shh.sysh.de/

scharfis_brain
21st January 2005, 15:23
no. it won't help.
the chroma information is already destroyed.

you may want to put a sample vob online,
so I can have a look on it.
(cut it down to some Megabytes with copperxp)

maybe it is just a weird decoding error.