Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 22nd September 2021, 01:20   #1  |  Link
Earthnuker
Registered User
 
Earthnuker's Avatar
 
Join Date: Mar 2021
Location: Germany
Posts: 7
Cleanup of heavy compression artifacts

Hi,

I've been working on a script to clean and upscale the official Invader Zim DVDs for a while now, and I've encountered a difficult to handle part in Episode 1 which has some pretty heavy compression artifacts.

Untouched sample from the DVD re-encoded to lossless H265: https://keybase.pub/earthnuker/Zim_0..._artifacts.avi

I'm talking about the scene where the camera pans, frame 12 to 16 in the clip.

After de-interlacing two frames have artifacts, i tried reconstructing them using MVTool's FlowInter with little success, with scene detection it just does frame blending and without it results in messy interpolation artifacts.

Any help would be appreciated.

Best regards,

Earthnuker
__________________
Hack the planet!
Earthnuker is offline   Reply With Quote
Old 22nd September 2021, 06:38   #2  |  Link
Julek
Registered User
 
Julek's Avatar
 
Join Date: Dec 2020
Posts: 31
Can you send a sample in .vob raw? It would be easier to find a solution.

#EDIT: Never mind, I think this avi is enough

I tested the VFM here and it doesn't seem to have blend, just a very strong block, you will get the best result probably with dpir, but it is very slow.
https://github.com/Irrational-Encodi...deblock.py#L15

Last edited by Julek; 22nd September 2021 at 06:49.
Julek is offline   Reply With Quote
Old 22nd September 2021, 15:31   #3  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,619
https://github.com/IFeelBloated/Oyster
feisty2 is offline   Reply With Quote
Old 23rd September 2021, 19:10   #4  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 6,439
QTGMC + BasicVSR++ with Model 5:

Script I used:
Code:
# Imports
import os
import sys
import ctypes
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("I:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# Import scripts folder
scriptPath = 'I:/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/EEDI3.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/temporalsoften.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
# Import scripts
import havsfunc
# source: 'C:\Users\Selur\Desktop\Zim_01_compression_artifacts.avi'
# current color space: YUV420P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 470bg, yuv luminance scale: limited, scanorder: top field first
# Loading source using FFMS2
clip = core.ffms2.Source(source="C:/Users/Selur/Desktop/Zim_01_compression_artifacts.avi",cachefile="E:/Temp/avi_5e80f5192093a24d3bd5bffe5fc965ee_853323747.ffindex",format=vs.YUV420P8,alpha=False)
# making sure input color matrix is set as 470bg
clip = core.resize.Bicubic(clip, matrix_in_s="470bg",range_s="limited")
# making sure frame rate is set to 29.970
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# setting field order to what QTGMC should assume (top field first)
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=2)
# Deinterlacing using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=True) # new fps: 29.97
# make sure content is preceived as frame based
clip = core.std.SetFieldBased(clip, 0)
clip = clip[::2]
# adjusting color space from YUV420P8 to RGBS for vsBasicVSRPPFilter
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
# Quality enhancement using BasicVSR++
from vsbasicvsrpp import BasicVSRPP
clip = BasicVSRPP(clip=clip, model=5)
# adjusting output color from: RGBS to YUV420P10 for x265Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_s="limited")
# set output frame rate to 29.970fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
# Output
clip.set_output()
file: https://filebin.net/ofmr7imvd8c4pzxp...R___model5.mkv (will be up 6 days)

Cu Selur
__________________
Hybrid here in the forum, homepage
Notice: Since email notifications do not work here any more, it might take me quite some time to notice a reply to a thread,..
Selur is offline   Reply With Quote
Old 23rd September 2021, 19:50   #5  |  Link
Earthnuker
Registered User
 
Earthnuker's Avatar
 
Join Date: Mar 2021
Location: Germany
Posts: 7
Hi,

Quote:
Originally Posted by Julek View Post
Can you send a sample in .vob raw? It would be easier to find a solution.

#EDIT: Never mind, I think this avi is enough

I tested the VFM here and it doesn't seem to have blend, just a very strong block, you will get the best result probably with dpir, but it is very slow.
https://github.com/Irrational-Encodi...deblock.py#L15
haven't had much luck with autodb_dpir and in its current form it eats ridiculous amounts of GPU memory because it loads multitple instances of the DPIR model, i did manage to bump the memory usage down by quite a bit with a small change but it doesn't seem to do too good of a job at cleaning up the two frames with heavy blocking

Quote:
Originally Posted by feisty2 View Post
the latest version of Oyster (commit 7d52c78 according to VSRepo) seems to be broken, looks like it's an issue with mvsf having updated?
The error i get is
Code:
AttributeError: There is no function named Degrain
when it tries to access core.mvsf.Degrain


Quote:
Originally Posted by Selur View Post
QTGMC + BasicVSR++ with Model 5:

Script I used:
<code omitted for brevity>
file: https://filebin.net/ofmr7imvd8c4pzxp...R___model5.mkv (will be up 6 days)

Cu Selur
just gave this a try and wow, it completely removes the artifacts with very little noticeable impact on the quality, that is really impressive!

thanks everyone for the help

Best regards,

Earthnuker
__________________
Hack the planet!
Earthnuker is offline   Reply With Quote
Old 17th October 2021, 21:42   #6  |  Link
LightArrowsEXE
Registered User
 
LightArrowsEXE's Avatar
 
Join Date: Nov 2016
Posts: 1
Quote:
Originally Posted by Earthnuker View Post
Hi,



haven't had much luck with autodb_dpir and in its current form it eats ridiculous amounts of GPU memory because it loads multitple instances of the DPIR model, i did manage to bump the memory usage down by quite a bit with a small change but it doesn't seem to do too good of a job at cleaning up the two frames with heavy blocking
autodb_dpir was designed in a way that specifically does not call every DPIR instance unless they're absolutely necessary (because VS is smart enough to know when a filter is and isn't used for a frame once it's done with its initialisation). Out of curiosity, what were the changes you made? Also, did you check the strengths and thresholds and adjust them? You can add more thresholds/strengths to deal with the frames with very strong blocking by adding them to the list.

Last edited by LightArrowsEXE; 17th October 2021 at 21:43. Reason: further questioning
LightArrowsEXE is offline   Reply With Quote
Reply

Tags
cleanup, compression, invader zim

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:26.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.