View Full Version : Avisynth script for anime with grain
Toguro
9th July 2013, 12:11
Hi
I'm newbie.
I don't know what to do.
I have a source with grain BDMV anime, and I have no idea if encode it as is, or use a avisynth script to remove the grain...
Here's a pic:
http://i.imgur.com/8k3RRoZ.jpg
Could you guide me on the script I need?
Thanks in advance
regards
Chainmax
9th July 2013, 23:30
That looks like a bad scan job from a magazine. :eek:
I have no idea how to deal with the horizontal white lines, maybe Despot or Descratch. As for the noise itself, I'd start with a FFT3DFilter line with plane=4 (so that both noise and chroma noise get hit) and a high sigma. If that is not enough, I'd follow it up with MDegrain3. If that desn't work, I'd use Avisynth's built-in TemporalSoften. You might also have to use TComb right after source loading.
For information on how to use those, do a few searches for their names, many example should appear within the results. In any case, there's hardly much we can do to help if you post a screenshot, and a JPG at that (which is lossy). Please post an unprocessed sample so we can get a look atit and make better recommendations.
DragonM
9th July 2013, 23:35
That looks like a bad scan job from a magazine. :eek:
I have no idea how to deal with the horizontal white lines, maybe Despot or Descratch. As for the noise itself, I'd start with a FFT3DFilter line with plane=4 (so that both noise and chroma noise get hit) and a high sigma. If that is not enough, I'd follow it up with MDegrain3. If that desn't work, I'd use Avisynth's built-in TemporalSoften. You might also have to use TComb right after source loading.
For information on how to use those, do a few searches for their names, many example should appear within the results. In any case, there's hardly much we can do to help if you post a screenshot, and a JPG at that (which is lossy). Please post an unprocessed sample so we can get a look atit and make better recommendations.
Why'd you have to use TComb? The source looks fine and doesn't contain rainbows or dotcrawl... So it will only ruin the picture.
creaothceann
9th July 2013, 23:51
Note that in the case of film (http://en.wikipedia.org/wiki/Film_stock) clips, grain is good. It's part of the medium and removing it is likely to do more harm than good.
Stereodude
10th July 2013, 03:54
What are you trying to do with it? What are you trying to encode it to / for?
MCTemporalDenoise() (http://forum.doom9.org/showthread.php?t=139766) does a fantastic job removing grain, but it's slow.
Toguro
10th July 2013, 11:30
That looks like a bad scan job from a magazine. :eek:
I have no idea how to deal with the horizontal white lines, maybe Despot or Descratch. As for the noise itself, I'd start with a FFT3DFilter line with plane=4 (so that both noise and chroma noise get hit) and a high sigma. If that is not enough, I'd follow it up with MDegrain3. If that desn't work, I'd use Avisynth's built-in TemporalSoften. You might also have to use TComb right after source loading.
For information on how to use those, do a few searches for their names, many example should appear within the results. In any case, there's hardly much we can do to help if you post a screenshot, and a JPG at that (which is lossy). Please post an unprocessed sample so we can get a look atit and make better recommendations.
The source is a BDMV folder, untouched. The files inside folder named "stream", and its extensions is *.m2ts.
How I can cut a sample?
Note that in the case of film (http://en.wikipedia.org/wiki/Film_stock) clips, grain is good. It's part of the medium and removing it is likely to do more harm than good.
Yes, but what in anime?
In my opinion it is annoying:(
What are you trying to do with it? What are you trying to encode it to / for?
MCTemporalDenoise() (http://forum.doom9.org/showthread.php?t=139766) does a fantastic job removing grain, but it's slow.
The BDMV source weighs a lot in hard disk. About 6,4 GB each chapter...i want to encode to get a reasonable weight, without much grain.
Toguro
10th July 2013, 13:55
here's a sample
https://mega.co.nz/#!l9Yn3Taa!aEunwDsNB5ocebteLNMZIUhBeH5P3xNbfK7gz3MlIYs
https://mega.co.nz/#!l9Yn3Taa!aEunwDsNB5ocebteLNMZIUhBeH5P3xNbfK7gz3MlIYs
Asmodian
10th July 2013, 20:23
I would use a denoiser like Stereodude suggested. Even a simple --nr xxx (maybe 100-500?) as part of the x264 command line should give decent results. With something like Ranma you could also resize to 720p, that saves a lot of space and removes some grain too. Denoising before resizing is better but also slower.
BTW, the vertical white lines are rain not an artifact. :)
creaothceann
10th July 2013, 20:32
Note that in the case of film (http://en.wikipedia.org/wiki/Film_stock) clips, grain is good. It's part of the medium and removing it is likely to do more harm than good.
Yes, but what in anime?
Anime was created by painting cels, stacking them to construct a frame, and photograph that frame onto film stock (see link above). That's why high-detail anime (for example movies) have grain that should be kept. Examples: 01 (https://i.minus.com/ibhapylwRGnEOY.png) 02 (https://i.minus.com/ihmZDDYUqyOqW.png) 03 (https://i.minus.com/id1ko6iddOOk5.png) 04 (https://i.minus.com/iJeYUsHkCiZJr.png) 05 (https://i.minus.com/i5dyJsbCzV7ux.png) 06 (https://i.minus.com/iwYnIRN0mIY66.png) 07 (https://i.minus.com/ibligc9CpDv74l.png) 08 (https://i.minus.com/iPKX30HyddTQZ.png) 09 (https://i.minus.com/iIiN6qzhg9UBB.png) 10 (https://i.minus.com/iN0VxTQP5Ffqa.png)
A filter is going to remove detail. I'd use a temporal filter, but especially the rain lines in the example clip would suffer from that.
Stereodude
11th July 2013, 02:01
A filter is going to remove detail. I'd use a temporal filter, but especially the rain lines in the example clip would suffer from that.Trying it out on the sample he posted MCTD "medium" leaves the rain pretty much alone, however removing the fine grain still leaves a pile of artifacts. MCTD "high" does better with the artifacts, but impacts the rain more.
Toguro
16th July 2013, 14:42
I would use a denoiser like Stereodude suggested. Even a simple --nr xxx (maybe 100-500?) as part of the x264 command line should give decent results. With something like Ranma you could also resize to 720p, that saves a lot of space and removes some grain too. Denoising before resizing is better but also slower.
BTW, the vertical white lines are rain not an artifact. :)
The "--nr" x264 command does not improve the video.
If i denoising resizing, takes the same that if not apply resizng. why it is important to apply before the denoising?
What are you trying to do with it? What are you trying to encode it to / for?
MCTemporalDenoise() (http://forum.doom9.org/showthread.php?t=139766) does a fantastic job removing grain, but it's slow.
Yeah, it works. But, operates at a speed of 0,01 fps...with settings=high, that is the only option that offers a satisfactory result. Never saw anything so slow.
My specs:
Core 2 duo E8400, 3 ghz
ati radeon hd 7750, 1 GB
Asus p5e
Any trick to increase the speed?
My script:
LoadPlugin("\tools\dgavcindex\DGAVCDecode.dll")
AVCSource("\00000_0001.dga")
ConvertToYV12()
MCTemporalDenoise(settings="high")
Thanks in advance
Anime was created by painting cels, stacking them to construct a frame, and photograph that frame onto film stock (see link above). That's why high-detail anime (for example movies) have grain that should be kept. Examples: 01 (https://i.minus.com/ibhapylwRGnEOY.png) 02 (https://i.minus.com/ihmZDDYUqyOqW.png) 03 (https://i.minus.com/id1ko6iddOOk5.png) 04 (https://i.minus.com/iJeYUsHkCiZJr.png) 05 (https://i.minus.com/i5dyJsbCzV7ux.png) 06 (https://i.minus.com/iwYnIRN0mIY66.png) 07 (https://i.minus.com/ibligc9CpDv74l.png) 08 (https://i.minus.com/iPKX30HyddTQZ.png) 09 (https://i.minus.com/iIiN6qzhg9UBB.png) 10 (https://i.minus.com/iN0VxTQP5Ffqa.png)
A filter is going to remove detail. I'd use a temporal filter, but especially the rain lines in the example clip would suffer from that.
Yes, remove some detail, but acceptable.
personally, the anime granulated, it looks pretty bad.
Luckily, the new anime is being created without celluloid
Stereodude
17th July 2013, 00:09
Yeah, it works. But, operates at a speed of 0,01 fps...with settings=high, that is the only option that offers a satisfactory result. Never saw anything so slow.
My specs:
Core 2 duo E8400, 3 ghz
ati radeon hd 7750, 1 GB
Asus p5e
Any trick to increase the speed?
My script:
LoadPlugin("\tools\dgavcindex\DGAVCDecode.dll")
AVCSource("\00000_0001.dga")
ConvertToYV12()
MCTemporalDenoise(settings="high")
What's the CPU usage? You've only got a dual core processor without Hyper-Threading so the effectiveness of your options are going to somewhat limited. You can use the multithreaded version of MVtools. You can use AVIsynth MT (potentially has temporal side effects). Or, you can use encode to intermediate lossless files by splitting the source in two and processing both halves at the same time. Then join the two AVI files with AVIsynth and feed them to x264. If you doing a CRF encode and not 2 (or more) pass encode you can skip the intermediate lossless files, encode directly, and just join the two .264 files you get.
What x264 preset are you using? veryslow?
Groucho2004
17th July 2013, 00:51
But, operates at a speed of 0,01 fps...with settings=high, that is the only option that offers a satisfactory result. Never saw anything so slow.
You haven't tried TNLMeans yet. :D
Whatever way you toss, turn and tweak it, your processor is simply too slow for this particular task.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.