View Full Version : Noise reduction / interlace
24hourloop
5th September 2002, 23:12
If I use noise reduction - will that cause TMPGEnc to deinterlace my source?
I know I can run all sorts of tests and try to glean from the results but maybe there is someone that actually knows ...
tiki4
6th September 2002, 12:40
Hello 24hourloop,
first noise reduction and deinterlacing are two completely different things. Noise reduction can be done by filters like SpatialSoften or/and TemporalSmoother which are available for Avisynth or VirtualDub. There are also some around which are highly specialized like Cleaner2D. Noise is a very common problem when capturing from TV or VHS. Please check also the video capturing forum around here and for VirtualDub and Avisynth filters you also may have a look here. (http://shelob.mordor.net/dgraft)
Deinterlacing is also related to TV capture but sometimes also to DVD conversion. Interlaced video is a video that contains single fields rather than progressive frames. Two fields make up a frame. For example in PAL TV you've got 25 frames per second which are in fact 50 fields per second. The effect of that is that you see horizontal lines if something moves on the screen. To get rid of that lines and to creative progressive material of the interlaced you have to do deinterlacing. There are two very good filters to do that: SmartDeinterlacer for VirtualDub and Decomb for Avisynth. You find them at the above URL. Again, check the forums for more information.
Both things can be done inside of TMPGEnc but that makes the encoding awfully slow. Both is done best outside via Avisynth script or inside of VirtualDub and then frame serving into TMPGenc. Check the guides on doom9's site.
I hope that helped a little bit,
tiki4
EDIT: Sorry, wrong URL.
24hourloop
7th September 2002, 22:08
Thanks tiki,
I am pretty familiar with all processes but doing noise reduction via blur on an interlaced video is more complex than on a single image. Thus, for example, Adobe Premiere simply deinterlaces the video when you blur.
I believe you are correct when you say TMPGEnc does the smoothing while maintaining interlaced signal (at least that's what it looks like). You are also correct when you say it is slooow. I have a cable quality signal that I feed in with just so much noise, just a tad. TMPGEnc was able to get rid of it without introducing noticeable blur or posterization. Must be an excellent algorithm.
To obtain similar quality with the VirtualDub/Avisynth filters and gaining a bit of speed - what do you recommend?
tiki4
8th September 2002, 14:25
That question stinks!:D
Sorry, no, I read sooo much about filtering and deinterlacing and denoising, and still there ist so much to try...
One of my main problems in trying different filters to get rid of noise is, that always the picture gets very blurry. In the capturing forum someone suggested to capture to PicVideo MJPEG with quality 19 and switching on the Denoising filter in VirtualDub. This seems to be a very good starting point for cable TV. That's what I capture. Thus you get rid of some of the noise before capturing. I was able to get really good quality by capturing with VirtualDub, active Denoiser and into the Huffyuv format. You get very large files by that, but the quality is so much better to me.
There is of course a bunch of filters there for Avisynth. TemporalSmoother seems to be a MUST, but then you're free to try everything you find. I tried SpatialSoftenMMX which gives quite good results, but blurs the picture quite much. However I found that deinterlacing via Decomb and the FieldDeinterlace() function gives me more freedom to get rid of noise afterwards. It seems much more difficult to denoise an interlaced video. As I wrote before, you should have a look into the capturing forum and read some of the recommended procedures there. Some guys only use VirtualDub for that, some others Avisynth only, but in the end it is up to you to find the solution that fits your needs. You can only decide by yourself, what looks good and what not.
tiki4
ulfschack
11th September 2002, 16:45
Yes, Filtering interlaced video like DV and TV-captures the right way does take some thought.
They way I settled for using avisynth was to separate the frames into a 50 fps stream then create two clips, each containing either odd or even frames so that all consecutive frames were aligned vertically, which would not be the case were you only to separate fields (due to the half pixel skew in odd/even)
I want them vertically aligned so that I can apply temporal filters that really just compare pixels at corresponding positions on frames before and after. For spatial filters there's no need to make two separate streams, just separate the fileds (50 fps).
The process takes time, especially if you're gonna do both spatial and temporal filtering. But it's faster than Tsunami.
cheers
tiki4
12th September 2002, 08:42
Sorry,
I just got half of what you said. How do you achieve what you describe there. The interlaced signal seems to be the main problem when filtering. So I apply FieldDeinterlace() of Decomb first. I think this can get some problems because of the noise. Would you mind to post some example Avisynth scripts? I captured a episode of the TV series 'Sex and the city' and the quality is BS. Using the denoise filter in TMPGEnc suggested an encoding time of 17 hours for half an hour of video (two-pass). That's crazy! Don't get me wrong, I'm on Athlon XP 1600+ and with CQ mode I get nearly real time encoding in TMPG (without resizing and filtering of course).
Thanks in advance.
tiki4
ulfschack
12th September 2002, 09:24
It took me a while to write such avisynth script, so I it'll take some time to redo it out of the top of my head. I'm at work now and the avs is at my home computer. I'll get back to ya asap.
Oh, BTW, It's a method for preserving the interlacing for wiewing on the tele via stand-alone. You should never deinterlace for that. If you're only interessted in viewing on the computer ... well forget what I said ... it'll be combed.
Still intersted ?
Cheers
tiki4
12th September 2002, 10:57
Yep, I'm very much interested!
Leave your time please. I'd also like to keep it interlaced as I'm doing SVCD for viewing on TV. Well, I don't own a standalone and also I don't have a TV anymore (WinTV is sufficient for me).
My only problem was, that cleaning up and keeping interlaced looked like shit. So if you like to share your experience I'd really appreciate that. As I said before, leave your time...
Thanks,
tiki4
ulfschack
12th September 2002, 11:48
Here's (http://forum.doom9.org/showthread.php?s=&threadid=31554) the thread I used to get some avisynth advice. I ended up changing the script somewhat from what was written there because I couldn't test it from work. But you get the idea ...
I settled for the one script involving convolution3d since I never really understood the tomsmocomp method :)
cheers
ulfschack
12th September 2002, 18:14
...And here's the script I used in the end.
loadplugin("c:\video\convolution3d\convolution3d.dll")
a=avisource("g:\clip1.avi").converttoyuy2.separatefields
even=a.SelectEven().convolution3d(0,8,16,0).BicubicResize(720-64,288-24).Addborders(32,12,32,12)
odd=a.SelectOdd().convolution3d(0,8,16,0).BicubicResize(720-64,288-24).Addborders(32,12,32,12)
b=interleave(even,odd).assumefieldbased.weave
return b
The resize and AddBorders are simply what I do to get my DV video to get inside the TV's overscan whitout cropping. You can cut it after "convolution" if you want.
cheers
WarpEnterprises
12th September 2002, 22:54
I am very pleased with convolution3D,too but I use it without treating the fields individually (that is without even, odd->interleave).
Did you compare your results against:
AssumeTFF() # or AssumeBFF - the right one is very important here
SeparateFields()
Convolution3d(...)
Weave()
??
tiki4
13th September 2002, 10:52
Thanks Ulf Schack (is this the right name?).
From the link to the thread you gave yesterday I ended up with the following script:
LoadPlugin("C:\Avisynth\Plugins\Convolution3D.dll")
clip=AVISource("G:\capture.avi").AssumeFrameBased().SeparateFields()
even=clip.SelectEven().Convolution3D(0,8,8,8,8,3,0)
odd=clip.SelectOdd().Convolution3D(0,8,8,8,8,3,0)
Interleave(even,odd).weave()
ConvertToRGB()
My results have been promising so far but still I think it is blurring way too much. My source is TV captured MJPEG (quality 19) at 480x576. I transcode that with TMPGEnc to SVCD. This method is very fast compared to my former SpatialSoftenMMX and TemporalSmoother. Anyway I think my cable TV is so noisy sometimes that I really should capture in Huffy. On the other hand this gets really large files. Any idea how I can improve my filtering based on MJPEG input. The last line I just use to circumvent the msyuv.dll bug in color space conversion of DX 8.1.
Thanks for the input.
tiki4
ulfschack
13th September 2002, 13:05
@Warp: Yes, I have compared with the method you proposed, in fact that's how I used to do it. But due to the vertical shift between consecutive frames in the separatefileds-stream too much (unmotivated)filtering is done. I have to admit I don't know what AssumeTFF() or AssumeBFF does exactly, but you say it's important, so maybe I should look it up :)
@Tiki4:
ok, that's pretty much the same. If it blurs too much why not ease up on the parameters, or simply give the spatial a rest and just use TemporalSmoother instead. It'll give you speed for sure :). I've done that my self from time to time.
cheers
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.