Log in

View Full Version : LWLibavVideoSource + sRestore + strange source


Selur
7th February 2022, 20:06
I'm using:

# Imports
import os
import sys
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/SourceFilter/LSmashSource/vslsmashsource.dll")
# Import scripts
import havsfunc
# source: 'C:\Users\Selur\Desktop\Sample_8bit.avi'
# current color space: RGB24, bit depth: 8, resolution: 320x224, fps: 59.94, color matrix: 470bg, yuv luminance scale: limited, scanorder: progressive
# Loading C:\Users\Selur\Desktop\Sample_8bit.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/Sample_8bit.avi", format="RGB24", cache=0, fpsnum=60000, fpsden=1001, prefer_hw=0)
# making sure frame rate is set to 59.940
clip = core.std.AssumeFPS(clip=clip, fpsnum=60000, fpsden=1001)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# adjusting color space from RGB24 to YUV444P8 for vssRestore
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="470bg", range_s="limited")
# adjusting frame count and rate with sRestore
clip = havsfunc.srestore(source=clip, frate=7.9920, omode=6)
# adjusting output color from: to YUV422P10 for ProResModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P10, range_s="limited")
# set output frame rate to 7.992fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=8000, fpsden=1001)
# Output
clip.set_output()

I expected the output to have ~362 frames, but I got 2748 frames. (MediaInfo reports 2741 frames)


I get the same when using Avisynth:

ClearAutoloadDirs()
SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE)
LoadPlugin("I:\Hybrid\64bit\Avisynth\AVISYN~1\LSMASHSource.dll")
LoadPlugin("I:\Hybrid\64bit\Avisynth\AVISYN~1\RgTools.dll")
LoadPlugin("I:\Hybrid\64bit\Avisynth\AVISYN~1\mvtools2.dll")
LoadPlugin("I:\Hybrid\64bit\Avisynth\AVISYN~1\masktools2.dll")
LoadPlugin("I:\Hybrid\64bit\Avisynth\AVISYN~1\TIVTC.dll")
LoadPlugin("I:\Hybrid\64bit\Avisynth\AVISYN~1\Average.dll")
LoadPlugin("I:\Hybrid\64bit\Avisynth\AVISYN~1\grunt-x64.dll")
LoadPlugin("I:\Hybrid\64bit\Avisynth\AVISYN~1\MedianBlur2.dll")
Import("I:\Hybrid\64bit\Avisynth\avisynthPlugins\Zs_RF_Shared.avsi")
Import("I:\Hybrid\64bit\Avisynth\avisynthPlugins\Srestore.avsi")
# loading source: C:\Users\Selur\Desktop\Sample_8bit.avi
# color sampling RGB24@8, matrix: bt601, scantyp: progressive, luminance scale: limited
LWLibavVideoSource("C:\Users\Selur\Desktop\SAMPLE~1.AVI",cache=false,format="RGB24", fpsnum=60000, fpsden=1001, prefer_hw=0)
# current resolution: 320x224
# removing ghosting
ConvertToYV24(interlaced=false, matrix="Rec601")
srestore(frate=7.992,omode=6)
# filtering
# adjust color to YUY2 (color matrix: Rec601)
ConvertToYUV422()
# adjusting bit depth current 8 to target 10
# convert to 10bit for encoder
ConvertBits(10)
# setting output fps to 7.992fps
AssumeFPS(8000,1001)
# output: color sampling YV24@10, matrix: bt601, scantyp: progressive, luminance scale: limited
return last


On other sources sRestore seems to work fine. (which is why I hoepe this is not caused by my system somehow)
source -> https://drive.google.com/file/d/1wD1jwrhFiBcPAJviKkL6RjThiANLpUi1/view?usp=sharing

Funny thing is when I load the source thorugh LWLibavVideoSource without specifying "fpsnum=60000, fpsden=1001" I get 362 frames the directly from the source filter, but sRestore has no effect in both cases. Remuxing the source to mkv and then loading the mkv doesn't change a thing.
So then I thought this is an issue of LWLibavVideoSource, but since using AviSource instead of LWLibavVideoSource has the same effect, that sRestore doesn't work, I assume it's an issue with sRestore or the source in general or my system. :)

->
A. Can someone else reproduce these effects?
a. LWLibavVideoSource with "fpsnum=60000, fpsden=1001, " => 2748 frames, LWLibavVideoSource without "fpsnum=60000, fpsden=1001, " => 362 frames
b. sRestore not having an effect on this source no matter whether "fpsnum=60000, fpsden=1001, " is used or not?

B. Does someone know what is causing this (and ideally how to fix it)?

Cu Selur

Jukus
7th February 2022, 20:39
I once saw HolyWu write that can't use lsmas and fpsnum, fpsden because it's a bug and that's it

Selur
7th February 2022, 21:23
I usually ony set fpsnum, fpsden on vfr content, but I used it here since otherwise the frame count was totally different than what MediaInfo reported.