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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

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

Reply
 
Thread Tools Search this Thread Display Modes
Old 16th October 2023, 14:55   #1  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,860
RemoveDirt crashes depending on mod

I noticed something odd when I using (this avi)
MPEG-4 Visual, color space: YUV420P8, bit depth: 8, resolution: 1500x1080, fps: 24, color matrix: 709, yuv luminance scale: limited, scanorder: progressive

and the following script:
Code:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'F:/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/DenoiseFilter/RemoveDirt/RemoveDirtVS.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Import scripts
import removeDirt
# current color space: YUV420P8, bit depth: 8, resolution: 1500x1080, fps: 24, color matrix: 709, yuv luminance scale: limited, scanorder: progressive
# Loading C:\Users\Selur\Desktop\RemoveDirtCras\RemoveDirtConfusion.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="G:/clips/RemoveDirtCrash/RemoveDirtConfusion.avi", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
# Setting detected color matrix (709).
clip = core.std.SetFrameProps(clip, _Matrix=1)
# Setting color transfer info (709), when it is not set
clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=1)
# Setting color primaries info (), when it is not set
clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# making sure frame rate is set to 24
clip = core.std.AssumeFPS(clip=clip, fpsnum=24, fpsden=1)
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive

clip = removeDirt.RemoveDirt(input=clip, limit=10)

# set output frame rate to 24fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=24, fpsden=1)
# Output
clip.set_output()
Processing the script directly crashes when rendering the second frame.

when add to mod8:
Code:
clip = core.std.AddBorders(clip=clip, left=2, right=2, top=2, bottom=2) # add borders to archive mod 8 (vsRemoveDirt) - 1504x1084
# denoising using VsRemoveDirt
clip = removeDirt.RemoveDirt(input=clip, limit=10)
clip = core.std.CropRel(clip=clip, left=2, right=2, top=2, bottom=2) # removing borders (vsRemoveDirt) -  1500x1080
it works fine.
using:
Code:
clip = core.std.AddBorders(clip=clip, left=2, right=2, top=0, bottom=0) # add borders to archive mod 8 (vsRemoveDirt) - 1504x1080
# denoising using VsRemoveDirt
clip = removeDirt.RemoveDirt(input=clip, limit=10)
clip = core.std.CropRel(clip=clip, left=2, right=2, top=0, bottom=0) # removing borders (vsRemoveDirt) -  1500x1080
so seems like mod16 width is the problem.

when add to mod16:
Code:
clip = core.std.AddBorders(clip=clip, left=4, right=4, top=4, bottom=4) # add borders to archive mod 16 (vsRemoveDirt) - 1508x1088
# denoising using VsRemoveDirt
clip = removeDirt.RemoveDirt(input=clip, limit=10)
clip = core.std.CropRel(clip=clip, left=4, right=4, top=4, bottom=4) # removing borders (vsRemoveDirt) -  1500x1080
it crashes.

=> Would be nice to know if others can reproduce this too.

Cu Selur
__________________
Hybrid here in the forum, homepage, its own forum

Last edited by Selur; 16th October 2023 at 15:36.
Selur is offline   Reply With Quote
Old 17th October 2023, 03:23   #2  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 398
Is there RemoveDirtVS.dll available for download somewhere?
I think it is needed to run core.rdvs in script.
_Al_ is offline   Reply With Quote
Old 17th October 2023, 17:20   #3  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,860
I uploaded the two RemoveDirt libaries I got (RemoveDirtVS.dll and vsremoveDirt.dll) to my GoogleDrive.
RemoveDirtVS.dll was from (https://forum.doom9.org/showthread.php?t=169771 when the download worked and no clue where the other was from, but both have this issue.
If someone has a newer RemoveDirt build which might fix this, please let me know.

Cu Selur
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Old 18th October 2023, 01:11   #4  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 398
same results as you described, original video crushed, it worked with first crop(mod8), not the second(mod16), used this script:
Code:
import vapoursynth as vs
from vapoursynth import core

def RemoveDirt(input, repmode=16, remgrainmode=17, limit=10):
  cleansed = core.rgvs.Clense(input)
  sbegin = core.rgvs.ForwardClense(input)
  send = core.rgvs.BackwardClense(input)
  scenechange = core.rdvs.SCSelect(input, sbegin, send, cleansed)
  alt = core.rgvs.Repair(scenechange, input, mode=[repmode,repmode,1])
  restore = core.rgvs.Repair(cleansed, input, mode=[repmode,repmode,1])
  corrected = core.rdvs.RestoreMotionBlocks(cleansed, restore, neighbour=input, alternative=alt, gmthreshold=70, dist=1, dmode=2, noise=limit, noisy=12)
  return core.rgvs.RemoveGrain(corrected, mode=[remgrainmode,remgrainmode,1])

clip = core.ffms2.Source("RemoveDirtConfusion.avi")
clip = RemoveDirt(input=clip, limit=10)
clip.set_output()
_Al_ is offline   Reply With Quote
Old 18th October 2023, 04:13   #5  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,860
Thanks for testing, now I at least know that it is not some strange thing due to my system.
__________________
Hybrid here in the forum, homepage, its own forum

Last edited by Selur; 4th May 2025 at 11:41.
Selur is offline   Reply With Quote
Old 2nd October 2025, 10:04   #6  |  Link
yuygfgg
Registered User
 
Join Date: Oct 2024
Posts: 20
I've converted all SSE code to scalar, and the 1508x1088 input clip works for me.

Also fixed an issue related to dFactor.

Please test to see if it resolves your issue.

My fork: https://github.com/yuygfgg/removedirtvs. Binaries can be found in Actions.
yuygfgg is offline   Reply With Quote
Old 2nd October 2025, 14:23   #7  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,860
Nice Will test and report back.

Cu Selur
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Old 2nd October 2025, 14:47   #8  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,860
Ran it through ~20 test clips and had no crash, so it looks fine so far.
Will report back in case I encounter problems.
Thanks.

Cu Selur
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Old 4th October 2025, 17:54   #9  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,860
@yuygfgg: planning a release any time soon?
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Old 4th October 2025, 18:09   #10  |  Link
yuygfgg
Registered User
 
Join Date: Oct 2024
Posts: 20
Quote:
Originally Posted by Selur View Post
@yuygfgg: planning a release any time soon?
https://github.com/yuygfgg/removedirtvs/releases/tag/R1
yuygfgg is offline   Reply With Quote
Old 5th October 2025, 07:16   #11  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Location: Between my two ears
Posts: 959
Of course you need a release, actions artifacts arn't "perpetual"
Z2697 is online now   Reply With Quote
Old 5th October 2025, 07:37   #12  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,860
Thanks!
I usually try to build the last tagged release, and actions tend to vanish after a while.

Cu Selur
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Old 7th October 2025, 07:59   #13  |  Link
yuygfgg
Registered User
 
Join Date: Oct 2024
Posts: 20
I just found that pinterf's fork also supports vapoursynth. If it works, it would be a better replacement of mine.

https://github.com/pinterf/RemoveDirt
yuygfgg is offline   Reply With Quote
Old 7th October 2025, 16:09   #14  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,860
Thanks for the info.
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Old 8th October 2025, 07:07   #15  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Location: Between my two ears
Posts: 959
The SSE code might just be too old, the scalar version or more precisely the optimization done by compiler is slightly faster.
Maybe you can do it on the pfmod fork, or port the pfmod to your fork.
Z2697 is online now   Reply With Quote
Old 8th October 2025, 15:40   #16  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,860
yes, a pull request to pinterf would be cool.
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Reply

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 19:05.


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