View Full Version : Processing interlaced footage for the first time, need help
Chainmax
1st October 2005, 18:57
A friend of mine made a short film and I want to process the very crappy source into something decent. Following many posts here saying that interlaced should stay that way in order to retain motion fluidity, I'm going to do so. The source is 720x576 and I have to crop it (X1=16,X2=16,Y1=4,Y2=16) in order to remove VHS artifacting, then resize it back to 720x576. Here's my script so far:
Crop(16,4,688,556,align=true)
ConvertToYV12(interlaced=true)
SeparateFields()
even = SelectEven(last).LTSMC().LimitedSharpen().AddGrain(5,0,0)
odd = SelectOdd(last).LTSMC().LimitedSharpen().AddGrain(5,0,0)
Interleave(even, odd)
Lanczos4Resize(720,288)
Weave()
I'm especially unsure about the cropping part because I'm cropping into the picture and wonder if that will mess up the interlacing or not. Any feedback will be greatly appreciated.
Revgen
1st October 2005, 19:14
I think it would be better to take the fields that are affected by the artifacts and just make them black rather than crop them. The black fields won't be seen on a TV.
Unfortuately I don't know how to do this in avisynth.
EG:
111111111111111
222222222222222
333333333333333
444444444444444
555555555555555
666666666666666<-If this field is showing the artifacts, turn this field to a black color. Doing so shouldn't affect the interlacing.
I hope this helps.
Ebobtron
1st October 2005, 19:36
I recommend cropping after separatefields as you resized properly before the weave.
Resizing the frame before separate will blend the fields. Keep them apart they about 1/50 of a second apart time wise.
Chainmax
1st October 2005, 20:44
Revgen: that sounds like a good idea, but I don't know how to do it either. Besides, there are vertical black bars and vertical halos near those that I will cut out too.
Ebobtron: I see what you mean, but how should I crop after SeparateFields? Would this:
ConvertToYV12(interlaced=true)
SeparateFields()
Crop(16,2,688,278,align=true)
...
be ok? Also, what do you mean by "Keep them apart they about 1/50 of a second apart time wise"?
scharfis_brain
1st October 2005, 21:33
resizing interlaced footage is always a bad idea. better just add black borders.
mg262
1st October 2005, 22:38
scharfis_brain: what about just doing the horizontal resizing -- would that be okay?
scharfis_brain
1st October 2005, 22:47
mg262: yeah. but it'll destroy the AR.
chainmax: I suggest this script:
#bob-deinterlace using mvbob()
assume?ff() # set the correct input fieldorder
mvbob()
#undo VHS chroma shift down, replace '2' by any number
mergechroma(crop(0,2,0,0).addborders(0,0,0,2))
# denoising & sharpening (pleeeze, tweak the filters. never run them with defaults!)
ConvertToYV12(interlaced=false)
Crop(16,4,688,556,align=true)
LTSMC()
LimitedSharpen() # if you want to resize, do it via dest_x & dest_y
AddGrain(5,0,0)
#addborders here:
#addborders(...)
#reinterlace
converttoyuy2()
assume?ff() # set the correct input fieldorder again
separatefields().selectevery(4,0,3).weave()
If you have insufficient RAM (<1024 MB :D ) and patience (some days for an hour of your video) for mvbob() & LTSMC(), you may want to try
TDeint(mode=1,type=3) instead of mvbob().
When using mvbob() you *may* use a resizer afterwards, because its deinterlacing has enough headroom for heavy pixel manipulations. (resizing IS a heavy pixel manipulation).
TDeint and all other Common Deinterlacers do not provide this headroom, so just use addborders instead of a resize.
Revgen
1st October 2005, 22:58
I believe Chainmax is trying to remove VHS border aritfacts without affecting interlacing.
Here is a problem from one of my vids that he may have.
http://img219.imageshack.us/img219/117/interlacevhs2ib.jpg (http://imageshack.us)
^
It's the fields at the bottom.
Ebobtron
1st October 2005, 23:08
Ebobtron: I see what you mean, but how should I crop after SeparateFields? Would this:
ConvertToYV12(interlaced=true)
SeparateFields()
Crop(16,2,688,278,align=true)
...
That is how I do it. There are lots of ideas about deinterlacing.
be ok? Also, what do you mean by "Keep them apart they about 1/50 of a second apart time wise"?
True interlaced content means that each frame contains two pictures. For 25 fps, that is about 1/50 of a second apart in time. In other words the two fields are recorded 1/50 of a second apart then blended. The video recorder records the fields separately; we put them together as frames in this digital video world.
Got to go cut some grass, I'll look in later.
scharfis_brain
1st October 2005, 23:13
it does not matter whether you crop before or after separatefields().
Kika
1st October 2005, 23:50
@scharfis_brain
Did i miss something (again)?
separatefields().selectevery(4,0,3)
No Weave() ?
mg262
1st October 2005, 23:56
That's because he used a Bob de-interlace (expand each field to a separate frame).
scharfis_brain
2nd October 2005, 00:13
Yes, I forgot weave()!
I is corrected now!
Ebobtron
2nd October 2005, 02:05
it does not matter whether you crop before or after separatefields().
Yes, scharfis_brain is right. I have just made it a habit to use separatefields() before I do any sizing or anything that might blend the frame.
Didée
2nd October 2005, 02:34
When using mvbob() you *may* use a resizer afterwards, because its deinterlacing has enough headroom for heavy pixel manipulations. (resizing IS a heavy pixel manipulation).
TDeint and all other Common Deinterlacers do not provide this headroom, so just use addborders instead of a resize.
TDeint is such a weak deinterlacer we shall better not resize its output?
Please elaborate. We people not dreaming interlaced during night do not understand the reasons for this.
scharfis_brain
2nd October 2005, 11:58
TDeint, Kerneldeint and other deinterlacers do a - whathever - kind of interpolation (kernel, EDI/ELA, linear, point ...) in areas where they find motion.
This interpolation effectively halves resolution. Resizing this halved resoluted image, will transform the intact pixels and interpolated pixels while resizing. This my result in very jaggy diagonal lines (like the stairstepping found in fieldblends, Didèe!).
mvbob's output is mostly build out of non-interpolated pixels, due to motion compensation. so here it is not that harmful to resize, because resolution is not halved.
Sorry can't explain that better :(
Chainmax
2nd October 2005, 17:19
RevGen is right, I am trying to crop VHS artifacts without affecting interlacing. Here's a source frame:
http://img387.imageshack.us/img387/9264/example9sd.png
scharfis_brain: what exactly is the deal with the mergechroma(crop(0,2,0,0).addborders(0,0,0,2)) line and how should I tweak the "2"? Also, why converting to YUY2 before reinterlacing? By the way, I do tweak filter when needed. In this case, I was using LTSMC on defaults because I wanted to see if they are enough (they aren't). As for LimitedSharpen, the default supersampling sharpens better (IIRC, higher supersampling would yield slightly smoother results), and the default strength is already very effective.
Ebobtron: about the second part of your reply, I know that. I just didn't understand what you meant by "keep them apart" which now I assume means "not to do things that might blend them".
mg262
2nd October 2005, 17:24
crop(0,2,0,0).addborders(0,0,0,2)
Chops two scanlines of the top and adds two scanlines at the bottom-- so it moves the picture up by two lines. Using mergechroma with that just pushes the chroma up by two lines while leaving the luma alone. An alternative to do the same is ChromaShift by Simon Walters.
Revgen
2nd October 2005, 18:56
@Chainmax
I've now found out how to do it with my 480-line NTSC clip.
I had to cut and add 8 pixels from the bottom using:
crop(0,0,0,472)
addborders(0,0,0,8)
http://img219.imageshack.us/img219/3153/croppedaddborder8aq.jpg (http://imageshack.us)
^
The artifact is now replaced with black rather resizing the whole clip
The artifact on your video seems larger than mine. It may need 10-20 pixels to be cropped. Just experiment with the crop() parameter until it's removed. Then use the addborders command.
I hope this helps.
EDIT
Also the crop needs to be an even number if your working with a YUV clip. 2 pixels, 4 pixels, 6 etc.
mg262
2nd October 2005, 19:01
Or: look up letterbox in the documentation.
Revgen
2nd October 2005, 19:26
Your right,letterbox(0,8) also works.
scharfis_brain
2nd October 2005, 22:57
tweak the '2' means:
adjust both numers equally, until the chroma is shifted correctly.
converting to yuy2 before reinterlacing is necessary for three reasons:
1) reinterlacing YV12 yields into chroma displacement (YV12 limitation!)
2) nearly all MPEG-2 encoders do NOT accept YV12
3) using converttoyuy2(interlaced=true) after reinterlace make chroma more blurry.
Chainmax, can you please provide a sample video? the longer, the better!
But do NOT recompress it.
Chainmax
3rd October 2005, 02:38
Revgen, mg262: Letterbox(4,12,16,16) sounds like a good idea (thanks a lot for the rec, btw: didn't think about it), but the documentation says that while faster and easier than Crop it's generally not better. Then again, I have three questions:
1) Wouldn't cropping be able to affect the interlacing just like resizing does since it's quite possible that you crop an actual scanline when ensuring that you remove all the black borders or artifacts?
2) If I use Letterbox instead, can the issue in 1) happen as well if a scanline gets covered?
3) Are the borders created with Letterbox progressive or interlaced? Whatever the case, could they create conflicts with the interlacing?
scharfis_brain: almost no MPEG2 encoder accepts YV12? I never had any problems with CCE :confused:. Isn't MPEG2 (at least as used in #VCD and DVD) YV12? About the chroma shifting, I didn't notice it; having never processed interlaced footage I get easily distracted by the combing :). Anyway, I guess I'll use ajordan's FixChromaBleeding function (http://forum.doom9.org/showthread.php?t=77074) for that.
One more question, do you always use
Assume#FF()
TDeint(mode=1,type=3) or MVBob()
Chroma shifting correction if needed
ConvertToYV12() <--- if needed
Letterbox(t,b,l,r) or cropping and adding borders after filtering
Filtering if needed
ConvertToYUY2()
Assume#FF()
SeparateFields()
SelectEvery(4,0,3)
Weave()
for interlaced footage? What should I do if wanting to make a DVD and letterboxing is not enough, forcing me to resize? About the clip, first I have to ask the person who created this since it's a short film he made. If he accepts, how much of it would you want? The whole source is 3min long and takes up 658MB.
Revgen
3rd October 2005, 03:18
@Chainmax
Cropping is good if you don't care about the AR or the resolution of your encode, since cropping unwanted pixels results in better compression. Since I assume that you want to keep your clip AR and resolution at a PAL standard, letterbox would be better to use.
1) No. Resizing changes the AR and the entire resolution of the clip. Your clip would then be a non-PAL standard clip. This is not good if you are trying to encode to DVD or VCD and play on a TV. Using the letterbox command retains the original PAL resolution and AR.
2) see above.
3) They are progressive. I don't think they would cause a problem since they are always black and contain no motion. But I don't know for sure. I'd suggest using Trim() and encode a small clip to see what happens.
I hope this helps.
scharfis_brain
3rd October 2005, 13:00
almost no MPEG2 encoder accepts YV12? I never had any problems with CCE . Isn't MPEG2 (at least as used in #VCD and DVD) YV12?
CCE doesn't understand YV12. It lets a DShow-Filter like DivX or XVid decode the video to YUY2 or RGB.
Since these DShow-Filters ALWAYS assume progressive YV12, they WILL upsample the interlaced YV12-chroma incorrectly. yielding in a yerky mess!
I hope, you understand now.
About the chroma shifting, I didn't notice it; having never processed interlaced footage I get easily distracted by the combing . Anyway, I guess I'll use ajordan's FixChromaBleeding function for that. Even when using this function you should correct the chroma shift before.
One more question, do you always use... In roughly, yeah.
What should I do if wanting to make a DVD and letterboxing is not enough, forcing me to resize? I don't understand.
If he accepts, how much of it would you want? The whole source is 3min long and takes up 658MB. No problem. I have a FTP. Just PM me.
midnightsun
3rd October 2005, 14:07
Chainmax, if you're interested hc accepts YV12 material.
Chainmax
3rd October 2005, 23:48
CCE doesn't understand YV12. It lets a DShow-Filter like DivX or XVid decode the video to YUY2 or RGB.
Since these DShow-Filters ALWAYS assume progressive YV12, they WILL upsample the interlaced YV12-chroma incorrectly. yielding in a yerky mess!
I hope, you understand now.
I see, thanks for the explanation. That would happen as well when encoding to Xvid or x264, right? What if I'm using the Helix decoders?
Even when using this function you should correct the chroma shift before.
I see. How would I notice if the value I use is too small or too big?
I don't understand.
In this case, for a plain MPEG4 encode I can just crop what I want and encode with a 4:3 PAR. If I want to make a PAL DVD and use Letterbox(4,12,16,16) then the picture won't be centered. FitCD tells me that for a 4:3 PAL DVD with 2 blocks overscan I should do Lanczos4Resize(672,544).AddBorders(16,16,16,16).
No problem. I have a FTP. Just PM me.
Ok, I'll ask him. If he agrees then I'll be uploading for quite a few days, having only a 64kbps upload speed :).
midnightsun: thanks for the recommendation, but I need speed more than quality and from what I read around here HC is quite slower than CCE.
Chainmax
4th October 2005, 00:32
By the way, do you think it would be possible to tweak TDeint so that it provides enough headroom for heavy pixel manipulations? If so, that might be a good thing to talk to tritical about. If MVBob is that slow and memory consuming a faster alternative would be good to have, right?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.