Selur's Little Message Board
[HELP] FeMaSR processing - Printable Version

+- Selur's Little Message Board (https://forum.selur.net)
+-- Forum: Hybrid - Support (https://forum.selur.net/forum-1.html)
+--- Forum: Problems & Questions (https://forum.selur.net/forum-3.html)
+--- Thread: [HELP] FeMaSR processing (/thread-3780.html)



FeMaSR processing - MikeMcI - 17.07.2024

Good morning, probably a stupid newbie question, but if you don't ask you don't know.
I ran a trial of a 30 second clip from a DVD film I'd like to upscale to 1080, on a couple of the SR models. FeMaSR was very pleasing. At 7 FPS, I'm happy enough to spend a few days with the PC running in the background processing.
When I've gone to process the entire film, the job starts, then nothing further appears to happen, the job sitting at about 17% completion after 24 hours.
There is definitely something happening. The GPU (GTX1660 Super) is running at 100% and the RAM is using 21 GB. Indicated FPS is 0.02. I haven't turned on Tensor as the GPU doesn't support it.

Am I right in assuming that there is some background processing going on that'll just have to wait out, or is it just whistful dreaming with my current system? My OS is Windows 11, CPU 8th Gen i7.

Thganks in advance for your insights.

Mike Mc.


RE: FeMaSR processing - Selur - 18.07.2024

FeMaSR is notoriously slow, but a subjob is sitting at 17% for so long seems wrong. (the job in general can be right)
I suspect some power saving or something similar interfering and causing the Vapoursynth script to be stuck.
I never used such a card, I would:
a. check the Windows task manager to see whats running (if both Vapoursynth and gpu usage is
b. enable the debug output and see whether the debug output adds some data to the debug output file.
(Side note: for me, TensorRT doesn't properly work with FeMaSR at all, I always get one a green screen, reported it ages ago, but got ignored)

Cu Selur


RE: FeMaSR processing - MikeMcI - 19.07.2024

Thank you for that Selur.
The job completed after 32 hours. It had completed the video processing, but crashed muxing in the audio, giving the error message "Failure while importing media: Bitsream not compliant". 
Repeating encoding with a smaller file gave the same result. I'd set the audio to passthrough.

Audio decoding is set as aa3. I'll try the alternative in the settings.
If all else fails, I'll try upscaling with the audio stream ignored & remux the audiostream from the original file into the completed file.

Regards
Mike Mc.


RE: FeMaSR processing - MikeMcI - 19.07.2024

Hi Selur.

If you get a chance, any feedback from the debug report would be appreciated.

Regards
Mike Mc.


RE: FeMaSR processing - Selur - 19.07.2024

# Imports
import vapoursynth as vs
# getting Vapoursynth core
import site
import ctypes
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'C:/Program Files/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("C:/Program Files/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
# Adding torch dependencies to PATH
path = site.getsitepackages()[0]+'/torch_dependencies/bin/'
ctypes.windll.kernel32.SetDllDirectoryW(path)
path = path.replace('\\', '/')
os.environ["PATH"] = path + os.pathsep + os.environ["PATH"]
# loading plugins
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SharpenFilter/CAS/CAS.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/EEDI3m.dll")# vsQTGMC
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/scenechange.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DeinterlaceFilter/Bwdif/Bwdif.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/LSMASHSource.dll")
# Import scripts
import havsfunc
import validate
# Source: 'M:\Hybrid Vapoursynth\Master\The Comic Strip Presents... - 1x06- Five go mad on Mescalin.mkv'
# Current color space: YUV420P8, bit depth: 8, resolution: 720x576, frame rate: 25fps, scanorder: top field first, yuv luminance scale: limited, matrix: 470bg
# Loading M:\Hybrid Vapoursynth\Master\The Comic Strip Presents... - 1x06- Five go mad on Mescalin.mkv using LWLibavSource
clip = core.lsmas.LWLibavSource(source="M:/Hybrid Vapoursynth/Master/The Comic Strip Presents... - 1x06- Five go mad on Mescalin.mkv", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
frame = clip.get_frame(0)
# Setting detected color matrix (470bg).
clip = core.std.SetFrameProps(clip=clip, _Matrix=5)
# setting color transfer (170), if it is not set.
if validate.transferIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Transfer=6)
# setting color primaries info (to 470), if it is not set.
if validate.primariesIsInvalid(clip):
  clip = core.std.SetFrameProps(clip=clip, _Primaries=5)
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=1)
# making sure frame rate is set to 25fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# making sure the detected scan type is set (detected: top field first)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=2) # tff
# Deinterlacing using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=True) # new fps: 50
# Making sure content is preceived as frame based
clip = core.std.SetFrameProps(clip=clip, _FieldBased=0) # progressive
from vsfemasr import femasr as FeMaSR
# adjusting color space from YUV420P8 to RGBS for vsFeMaSR
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
# Step 1: current: 720x576, target: 1808x1440
# resizing using FeMaSR
clip = FeMaSR(clip=clip, model=1, device_index=0) # 2880x2304
# resizing 2880x2304 to 1808x1440
# adjusting resizing
clip = core.fmtc.resample(clip=clip, w=1808, h=1440, kernel="lanczos", interlaced=False, interlacedd=False)
# denoising stepped resize using RemoveGrain
# adjusting color space from RGBS to YUV444P16 for vsRemoveGrain
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
# removing grain using RemoveGrain
clip = core.rgvs.RemoveGrain(clip=clip, mode=2)
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
# sharpening stepped resize using LSFMod
# adjusting color space from RGBS to YUV444P16 for vsLSFMod
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
clip = havsfunc.LSFmod(input=clip)
# adjusting color space from YUV444P16 to RGBS for vsFeMaSR
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_s="limited")
# Step 2: current: 1808x1440, target: 2880x2304
# resizing using FeMaSR
clip = FeMaSR(clip=clip, model=1, device_index=0) # 7232x5760
# resizing 7232x5760 to 2880x2304
# adjusting resizing
clip = core.fmtc.resample(clip=clip, w=2880, h=2304, kernel="lanczos", interlaced=False, interlacedd=False)
# adjusting output color from: RGBS to YUV420P10 for x265Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_s="limited", dither_type="error_diffusion")
# set output frame rate to 50fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=50, fpsden=1)
# output
clip.set_output()
You are using "stepped resizing" with FeMaSR, thus calling FeMasR two times!
Last time is on 1808x1440 content, that is bound to take ages.
=> disable stepped resizing

Cu Selur


RE: FeMaSR processing - MikeMcI - 21.07.2024

Thank you Selur. That sorted it.

Regards
Mike Mc.