PDA

View Full Version : Question on processing tape captures


Joe Daring
10th February 2003, 19:36
Hello'"Masters of AVISynth"!!! :-)

Here is my very first post in this Forum... so far I've spent some long hours reading your posts over here, and find them VERY informative, even if sometimes too advanced for a newbie like me...

But I guess that, in a Forum blessed with the presence of so many great developpers, it couldn't be any different than that!

So, why am I boring you with this LONG post?

It is easily said:

I am totally new to the AVISynth world, and starting to use this GREAT program (V2.5 right now) to edit some videos of mine, and to transfer them to SVCD at the moment, and to DVD-r in the future...

I've been digging the Forum for the tricks/info I need, but haven't found them, or found something that gave too much for known and, unfortunately, did not make things clear for me... not your fault, guys, but mine, since I'm a total newbie :-)

I started with tryng to put my Wedding Video on SVCD... and stumbled in some problems... let's see if I can get any help here...

WARNING!!!! Stupid/Easy Questions ahead! Steer clear if this bores you!!! ;-)

OK... the video is a 76 Minutes PAL Video shot 6 years ago with a Pro Sony camera in Beta format...

It has been edited and rendered to a SVHS tape by the Video Service that did the shooting... this is to give you a hint at the overall quality of the material Im'starting with...

I have to say that I expected an overall better quality, given it was handled by a professional service, but can't complain too much, anyway...

I have captured the video with an ATI A.I.W. Radeon 9000and VirtualDub, at 720x576 using the PicVideo MJPEG SoftCodec at maximum quality, and set the codec to capture NON-Interlaced, since after a few experiments I had the feeling that Non-Interlaced caps were a bit better than Interlaced ones, and cropped while capturing at 690x560, to cut some border noise,. Quality of the capture in nothing to sneeze at.

The capture I have on my HD now has some defects that I would like to correct...

Mainly they are:

-A strong PAL color line artifact... you know, thin red/green lines alternated on the video... also, this artifact makes the reds in my video to shift toward purples...

-Every now and again, there are glitches on the video, that are essentially thin gray lines, or couple of such lines, wich affect just one-to-three frames in a row

-There is some noise, but not much,

-Overall Audio level is low,

-Some parts of the audio has a defective Right Channel... Left is always OK.

My AVISynth script so far is this (...But, of course, not everything works :-( ):
============================================
#AVISynth script for Wedding Video Cleanup & convert to PAL SVCD res
#Output should be fed to TMpeg Plus Encoder

#Load necessary AVISynth Plugins...
#LoadPlugin("filename"[,...])
LoadPlugin("C:\Programmi\Video e Grafica\AviSynth\plugins\Convolution3dYV12.dll")

#Load eventual VirtualDub Plugins...
#LoadVirtualDubPlugin("filename","filtername", preroll)
Grafica\AviSynth\plugins\Filename.vdf","Filtername")

#Load Video File...
#AVISource(string filename[,...], bool "audio", string "pixel_type")
Avisource("E:\Temp_Folder\Video_Captures\Wedding_Video.avi")

#================#
#Audio Processing#
#================#

#Removes broken right channel for a portion of video,
#and return good left channel on a mono clip:
GoodAudio1=Trim(0,3144)
BadAudio=Trim(3145,3830).GetLeftChannel
GoodAudio2=Trim(3831,116660)
GoodAudio1+BadAudio+GoodAudio2


#Normalize audio signal to 95%:
Normalize(0.95)

#================#
#Video Processing#
#================#

#Correct levels after checking with VirtualDub's "Level" Filter.
#AVISynth "Level" filter can use the same values supplied by VirtualDub's one...
#Levels(clip, int input_low, float gamma, int input_high, int output_low, int output_high)
Levels(5,1.0,255,0,255)

#Clean-Up some video glitches in frames...
#FreezeFrame(clip, int first_frame, int last_frame, int source_frame)
FreezeFrame(41,41,40)
#More of these FreezeFrame lines...
FreezeFrame(222,224,225)
#More of these FreezeFrame lines...
FreezeFrame(18655,18655,18656)

#This Custom-Function definition should be an AVISynth
#replacement for what "rmPAL" VirtualDub's filter does
#I.E. removing PAL Phase Alternating color artifact.
function rmPAL(clip c) {
c=c.AssumeFrameBased.SeparateFields.AssumeFrameBased
MergeChroma(c,c.BlendFields(),1)
AssumeFieldBased()
return Weave()
}

#Invokes the "rmPAL" function defined above...
rmPAL

#Clean-Up some noise... Alternative noise filter...
Convolution3dYV12(0,32,128,16,64,10,0)

#Resize to PAL SVCD legal size...
#BilinearResize(clip, int target_width, int target_height)
BilinearResize(480,576)
==========================================
So... here are the problems I have with this script:

The Audio processing part for replacing broken Right Channel content with good Left Channel content does NOT work, nor seems I'm able to make it work :-(

best I can, I end-up with a video that has the Right Channel replaced by the Left one FOR THE WHOLE LENGHT of the video, not only for the part that has broken audio, making it virtually MONO... OR, I end-up with a short piece of video that is the part I defined "BadAudio", with the Right Channel correctly replaced by the Left one.

If I try to splice the three parts together, I get an error message complaining that sound formats does not match, maybe because I have a mono piece between two stereo piece....
What can I do? I know I could get the audio in a good audio tool and then audiodub it back in my video, but I would like to know if this trick is doable in AVISynth alone, and I think it is!

The low audio level problem gets cured by the Normalize command I use in my script but, is this the correct way to do it?

Level correction is very subtle, and maybe unnecessary, but it's there since I would like to create a script which would serve me as a general basis for future problems... is that OK?

The "Clean-up some glitches" part is the one stealing me A LOT of TIME. I would appreciate some suggestions... you see I'm basically covering the "Glitched" frames with the previous or following good ones... as far as I can see, there are no adverse effects on motion, since they are just single, double, or triple frames corrections. Problem is, the job is very long and tedious and, worst of all, it will not help me for other captures, since affected frames are capture-specific. Is there any kind of automatic filtering that can be done with any plugin, for this specific defect? I'm afraid the answer will be...NO! But I feel it's worth asking :-)

...and while we are at it... is it possible, with freezeframe or something else, to replace ONLY a portion of a frame (Let's say the lower third...) with the corresponding portion of another good source frame?

The custom function replicating rmPAL VirtualDub's filter (Found this function in the "Favourite Scripts" thread her... thanks guys!) really works well for tha PAL alternating lines defect... removes the Green/Red lines and, WOW, restores the reds in my video wothout affecting the other colors, as far as I can see. So where's the problem? Simply, since I don't understand what this function does, I wonder if I'm losing something by using it... the result is good, and I know this is what counts, but am I doing something bad to my video? Is there any better way to achieve the same result?

Noise cleaning... I have put here Convolution3d, but just as an example... What is best in your experience, to clean some mild noise in SVHS-VHS-HI8 tape captures? Please, if possible, besides pointing me to some filters, can you also suggest their settings?

And, more on a general issue, what is better for what, talking about filters (Temporal vs. Spatial)?

Resizing is not a problem, but have a little question... since I started with a cropped size of 690x560, from an un-cropped original of 720x576, will I encounter an Aspect Ratio modification? I know it will not be much, with these values, but I need to know for the future... should I also crop in 4:3 sizes?

And, generally, what should be the sequence of the operations?
I.E. ... deinterlace before noise reduction or rmPAL? resixe at the end or before anithing else but deinterlace... this kind of info, you know...

Final question now:

My next project will be transferring all my Honeymoon/Holidays/Kids videos to SVCD, and those come from a Canon consumer HI8 camcorder... some shots are great, some others are too dark, hence noisy like hell :-(

I would like some indication on general way to treat them... things like Deinterlace or not, what filter should I use for noise and with wich settings etc...

Well, guys... I know it's whole bunch of questions in a single go, and I want to make it clear that it's not that I'm lazy and don't want to try by myself... it's just that I'm doing this in a very limited spare time and, also, lacking the technical knowledge you have on these things I may end-up testing lot of wrong/unuseful stuff and never actually doing what I want to do... get those video on digital formats! :-)

I know that part of the fun is the trial-and-error part, and I usually enjoy that too, but here we are talking BIG time spent without having good results, wich isn't fun at all...

I hope some of you will undergoo the pain to reply this long (and boring, I know...) message, and put my on straight tracks with this editing jungle...

for this, I'm really grateful to you all, and well in advance, since the little things I know on these subjects, I've learnt on this Forum!

Thank you everybody!

Looking forward to your comments/flames/insults ;-) !

Joe Daring, Italy

sh0dan
10th February 2003, 22:24
Yeah - it's a long one - short answers ;)

Use "badaudio = mergechannels(badaudio,badaudio) for making a mono signal stereo.

Normalize() is the best way to amplify audio!

"Bad" Frame detection is not possible to my knowledge.

The easiest way to cropping is to crop, with the current aspect. You don't have to, but it's way easier to calculate. For instance, for TV footage I do:

crop(16,12,-16,-12) # 4:3 input - cropped with 4:3 aspect.
Bicubicresize(512,384) # 4:3 aspect = the same as input. Width is now the final resolution
crop(0,0,512,288) # output is now 16:9 aspect.


It's silly, but way easier to calculate. ;)

About you SVCD - in my opinion you should:
- Crop garbage from borders.
- Deinterlace (decomb field-deinterlace)
- Convotion3D (something like movieLQ)
- Resize (Bicubic, neutral)
- Temporalsoften (3,6,6, mode=2, scenechange=10)
- Correct color and brightness levels (use coloryuv or tweak with histogram())

Joe Daring
10th February 2003, 23:48
Hi sh0dan and all...

Thanks for undergoing the pain to read my msg, and to post some helpful hints...

Sh0dan... I'll test the audio trick in a few minutes... I'll let you know how it ends up...

Thanks also for the other suggestions... waiting some more inputs to see what's the general consensus...(If there are more brave readers that have the courage to go through my post ;-) )

Couple more questions...
About you SVCD - in my opinion you should:
- Deinterlace (decomb field-deinterlace)

...do you mean that I should Deinterlace even if I set-up the capture codec to cap NON-Interlaced?

How can I decide if I have to deinterlace or NOT?

Is there any test I can run on a video file to see if it needs to be deinterlaced, orshould I simply know what kind of file it is in the beginning?

What happens if I try to de-interlace a video that doesn't need to be de-interlaced?

Sorry for more questions, but hopefully after some reply to this post of mine, I'll finally have clearer ideas on what to do to my videos...

Thanks again, Sh0dan and all...

Joe Daring

neuron2
11th February 2003, 01:22
Joe, it's clear you have not read FAQs and done your basic homework. Nor have you read and absorbed the forum rules. You can't expect people to spend lots of time on basic stuff when you won't do that. Go study for a while and then come back and ask questions that demonstrate you don't expect us to repeat Video 101 for every newbie that arrives.

More important advise: Don't make a long post with multiple problems. People won't want to digest it. Start with your most serious problem and make a short concise post about it. Get the issue solved and then move on to your next most serious problem. I read your post and my eyes just glazed over. I'm amazed you even got a response. :)

sh0dan
11th February 2003, 07:55
Originally posted by Joe Daring
...do you mean that I should Deinterlace even if I set-up the capture codec to cap NON-Interlaced?

How can I decide if I have to deinterlace or NOT?


When you capture in height bigger than 288, you will often get interlaced video. Look for the interlacing lines, when stepping through the file in vdub.

Have a look at 100fps.com - it has some nice pictures to illustrate.

Joe Daring
11th February 2003, 08:59
Hi Everybody...

@Neuron2
I painfully accept your criticism... while, believing or not, I DO HAVE read Forum Rules (And violate some, I know...) and spent some hours reading FAQs and a lot of stuff about video, I'm still stuck with some basic issues with this kind of editing... maybe I've spent my time reading the wrong pages :-( that just confused me more... or maybe it's just me being confused beyond the point of no-return. ;-)

Actually, you are right... I'm also surprised to get some replies at all, and I'm really grateful for that...

@Sh0dan...
The audio problem is OK now.. thanks for pointing me in the right direction,(MergeChannel)

...now I go and check the site you suggested me about Interlaced Vs. De-Interlaced...

Thanks a lot so far everybody... but... "I'll be baaaack!" ;-)

Joe Daring

sh0dan
11th February 2003, 12:14
I don't think neuron intended to moderate you - just give you hints on how to get "more effecient" help in this forum. These aren't FAQ's, but you could find some of the answers by searching around. :cool:

I was also :eek: by your long post - so I just searched out the questions and try to answer them shortly. :)

neuron2
11th February 2003, 14:37
@sh0dan

Your patience is greatly appreciated.

@joe

sh0dan is correct. I hope I haven't discouraged you. Waiting anxiously for your return. :)

Joe Daring
12th February 2003, 00:15
Hi Neuron2, Sh0dan and ALL...

Don't worry guys, I'm pretty hard skinned, so I can take some hits :-)

and, by the way, even if Neuron2 wanted to moderate me, no problems... he's got the authority to do it... but thank you for making it clear to me...

Well... I go studying the 100fps site... is very promising... and the interlace questions are the biggest problem I have now... I'll start from there!

Bye All...

Joe Daring

PS... Neuron2 is your avatar your cat? It's lovely... I love cats... have a grey Norwegian Skogkatt here...

Bye again!

gigah72
12th February 2003, 04:20
hi Joe and all,

i hope you don't mind, asking this in your thread.

i saw your are using this rmPal function. i also started using it, but after avisynth 2.5 is so attractive, i don't know how to get it to work without a BlendFields function in the available mpeg(?)xdec(?)'s for 2.5. is there a workaround or plugin to emulate/simulate this function ?

g.

ulfschack
12th February 2003, 15:13
Joe,

you do know that SVDC resolutions are 480x576 right?

Also a nice tip is to add borders to the movie. Theses borders wont be seen (made small enough) whilst playing on your stand-alone due to TV overscan, but it helps counter the allready narrow zoom angle genrally found in camcorders. You'll loose resolution either way, but as long as your resizing you might as well get some benefits.

Here's what I used prior to entering the blessed DVD era :)

BicubicResize(448, 528)
AddBorders(16,24,16,24) #16 is multiplied by 3/2 by the player.

If you think about it (assuming your tv overscans 24 pixels) the viewable area will contain just as many pixels, but you'll be getting "more people in the frame" so to speak. Another benefit will be more bits per pixel (15 - 20% more) as black is "almost free", which is sorely needed for 2600 kbps.

cheers

Joe Daring
12th February 2003, 15:15
Hi Gigah72 and all...

I don't mind at all... only I think you'll have better chances to get a reply, if you put your question in a separate new thread...

...the question is obviously NOT for me, since I have declared in my post that I'm using the function, but can't understand fully what it does to my footage, and was asking if it is actually doing something bad, in terms of destroying original structure of the clip...

FWIW, I'm also wondering if PAL artifact gets cured by any kind of interlace... got to do some tests, as soon as I understand all this stuff about interlace ;-)

Anyway, are you sure the BlendFields function is in an external plugin??? Sure it is not in the main AVISynth code?

I'm not sure at all wether what I'm saying does make sense at all or not, anyway... :-)

Good luck!

I'll look at your post's replies with great interest;-)

Ciao Everybody!

Joe Daring

Joe Daring
13th February 2003, 00:45
Hi all...

One more post...

@ulfschack

Thanks for the trick... what you suggest me does make sense... I'll do some experiments...Thanks again...

@Gigah72

About the rmPAL emulation...
I investigated a bit further and... it eems that BlendFields is NOT in AVISYNTH set of functions, while I found it in the MPEG2DEC2 dll made by Dividee (Hi!)...

BUT! Strange enough (for me ;-) ), I just tried the script with the function in AVISYNTH 2.5 Beta and... IT WORKS! Well... it seems to do what it used to do: remove the PAL artifacts and restores the red's hue in the video... and I'm not loading any MPEG2DEC dll...

Now I think I have a serious problem in understanding this... being a function of Dividee's MPEG2DEC2, it shouldn't have worked without it, right? HOW comes it does?

And... the more I read about this, the more I think this rmPAL stuff is just some kind of de-interlacing... is there any way to surrogate this function with the standard interlace tecniques?

Would like to do some tests, but I'll be travelling for a couple of days for my work, so don't have my "video-pc"...

Anybody wants to jump into this??? C'mon... after all, this is not in the FAQs... I DID a search on this! ;-)

Thanks everybody!

Joe Daring

-

Wilbert
13th February 2003, 11:03
About the rmPAL emulation...
I investigated a bit further and... it eems that BlendFields is NOT in AVISYNTH set of functions, while I found it in the MPEG2DEC2 dll made by Dividee (Hi!)...
True besides a typo: it is mpeg2dec.dll.

BUT! Strange enough (for me ;-) ), I just tried the script with the function in AVISYNTH 2.5 Beta and... IT WORKS! Well... it seems to do what it used to do: remove the PAL artifacts and restores the red's hue in the video... and I'm not loading any MPEG2DEC dll...

Now I think I have a serious problem in understanding this... being a function of Dividee's MPEG2DEC, it shouldn't have worked without it, right? HOW comes it does?
Because AviSynth has an autoloading plugin feature (it loads every plugin in your plugin dir.). Remove mpeg2dec.dll from the plugin dir and try again :)

And... the more I read about this, the more I think this rmPAL stuff is just some kind of de-interlacing... is there any way to surrogate this function with the standard interlace tecniques?
Did you try decomb? A script like should be enough:

...
telecide() # instead of rmPAL
...

Try it with the blend option set to false and true (see correspoding docs).