Log in

View Full Version : Repairing edges and fades


gunfelix
3rd August 2015, 13:22
I'm trying to repair the edges and fades on this video that got mangled due to compression.

The lines/edges are dull, break up, almost dissapear in the background or are causing aliasing/flickering (samples 1-3):
http://i.imgur.com/KDee5sS.png
http://i.imgur.com/SdLM0RS.png
http://i.imgur.com/HjW6H1y.png
I'm not sure if the aliasing is caused because of a bad deinterlace or the 720x576 to 768x576 resize. nnedi+santiag cleans up some aliasing. Toon multiple times repairs some of the lines. Is there a different way to approach this?

The other problem I have is that the fading is filled with artifacts (sample4):
http://i.imgur.com/fD6jmgk.png
Are there any filters that can repair fading?

Samples:
https://mega.co.nz/#F!LY1GgZaS!F_wbRxS79H932jl9rnLS-A

Script:
ffVideoSource("sample3.mkv")
MosquitoNR(strength=15)
Deblock_QED()
SeparateFields()
SelectEven()
nnedi3(dh=true, nns=4)
Santiag()
Santiag()
Dehalo_alpha()
Crop(4,4,-4,0)
EEDI2().TurnRight().EEDI2().TurnLeft()
LSFMod(strength=238, defaults="slow")
Toon()
Spline36Resize(760,572)
Toon()

Commandline:
avs2yuv.exe "script.avs" -o - | x264x64.exe - --profile high --level 4.0 --preset veryslow --no-fast-pskip --qcomp=0.9 --crf 17 --tune animation --output "output.mkv" --demuxer y4m

ChiDragon
3rd August 2015, 16:36
Your samples are H.264 encodes. Post the original source.

gunfelix
3rd August 2015, 17:18
Your samples are H.264 encodes. Post the original source.

That is my 'source'. It's from the TV3 Catalonia streaming service. Or do you mean the entire mp4?

MediaInfo from the entire file:
General
Complete name : 1437702699055.mp4
Format : MPEG-4
Format profile : Base Media / Version 2
Codec ID : mp42
File size : 187 MiB
Duration : 21mn 40s
Overall bit rate mode : Variable
Overall bit rate : 1 204 Kbps
Encoded date : UTC 2015-07-24 01:50:17
Tagged date : UTC 2015-07-24 01:50:17

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main@L3.2
Format settings, CABAC : Yes
Format settings, ReFrames : 6 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 21mn 40s
Bit rate mode : Constant
Bit rate : 1 100 Kbps
Width : 768 pixels
Height : 576 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.099
Stream size : 172 MiB (92%)
Language : English
Encoded date : UTC 2015-07-24 01:50:17
Tagged date : UTC 2015-07-24 01:50:17
Color range : Limited

Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 21mn 40s
Bit rate mode : Variable
Bit rate : 93.6 Kbps
Maximum bit rate : 232 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 KHz
Compression mode : Lossy
Stream size : 14.5 MiB (8%)
Language : English
Encoded date : UTC 2015-07-24 01:50:17
Tagged date : UTC 2015-07-24 01:50:17
mdhd_Duration : 1300039

foxyshadis
4th August 2015, 10:26
Given that it's mostly happening around red, it might be bad chroma upsampling. How are you grabbing the screenshots?

For the blocking on the fade you're just going to have to denoise. KNLMeans, dfttest, and SMDegrain are all good denoisers, and they can work in 16-bit to minimize banding problems.

gunfelix
4th August 2015, 20:29
Given that it's mostly happening around red, it might be bad chroma upsampling. How are you grabbing the screenshots?

VLC -> Shift+S

For the blocking on the fade you're just going to have to denoise. KNLMeans, dfttest, and SMDegrain are all good denoisers, and they can work in 16-bit to minimize banding problems.

I've tried them, but there isn't a noticeable difference, even when using high values or using them multiple times.

GMJCZP
5th August 2015, 13:46
With the aliasing have to try the alternatives to achieve that best suits you: daa, santiag, saa, etc (see External filters - Avisynth wiki).

With respect to fading, it seems a problem of prior coding. I think all you can do is make a deblocking (Deblock_QED, for example).

killerteengohan
12th November 2015, 09:44
See if this helps any. I had a similar looking issue with a source and this fixed it for me.

MergeChroma(BicubicResize(width/2,height/2).BicubicResize(640,480).aWarpSharp2(depth=10))


Just change the resolution to the one you want to use if 640,480 is not the one you want.

wonkey_monkey
12th November 2015, 18:51
VLC -> Shift+S

I think that's VLC doing bad upsampling, or at least it might be partially to blame. I noticed it myself just the other day. Try MPC-HC.

Or, at least, you might find it's not so bad if you grab the screenshot instead from VirtualDub via AviSynth, for example (use converttorgb24 in AviSynth to be on the safe side).