Update RIFE Model (fixes 4k48 Linux?)
This commit is contained in:
@@ -1,50 +1,50 @@
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
def createInterpolateScript(upscaleOut, tempName, inputAspect):
|
def createInterpolateScript(upscaleOut, tempName, inputAspect):
|
||||||
if os.path.isfile(upscaleOut + '.vpy'):
|
if os.path.isfile(upscaleOut + '.vpy'):
|
||||||
print('Interpolate script exists')
|
print('Interpolate script exists')
|
||||||
return
|
return
|
||||||
|
|
||||||
script = []
|
script = []
|
||||||
|
|
||||||
if inputAspect == '4:3':
|
if inputAspect == '4:3':
|
||||||
script = ['from vsrife import rife',
|
script = ['from vsrife import rife',
|
||||||
'import vapoursynth as vs',
|
'import vapoursynth as vs',
|
||||||
'from vapoursynth import core',
|
'from vapoursynth import core',
|
||||||
'clip = core.ffms2.Source(source="./' + tempName + ' [4k][HEVC].mkv")',
|
'clip = core.ffms2.Source(source="./' + tempName + ' [4k][HEVC].mkv")',
|
||||||
'clip = vs.core.resize.Bicubic(clip, width=1440, height=1080, format=vs.RGBS, matrix_in_s="709")',
|
'clip = vs.core.resize.Bicubic(clip, width=1440, height=1080, format=vs.RGBS, matrix_in_s="709")',
|
||||||
'clip = rife(clip=clip, model="4.15", factor_num=2, factor_den=1)',
|
'clip = rife(clip=clip, model="4.25", factor_num=2, factor_den=1)',
|
||||||
'clip = vs.core.resize.Bicubic(clip, format=vs.YUV420P8, matrix_s="709")',
|
'clip = vs.core.resize.Bicubic(clip, format=vs.YUV420P8, matrix_s="709")',
|
||||||
'clip.set_output()']
|
'clip.set_output()']
|
||||||
else:
|
else:
|
||||||
script = ['from vsrife import rife',
|
script = ['from vsrife import rife',
|
||||||
'import vapoursynth as vs',
|
'import vapoursynth as vs',
|
||||||
'from vapoursynth import core',
|
'from vapoursynth import core',
|
||||||
'clip = core.ffms2.Source(source="./' + tempName + ' [4k][HEVC].mkv")',
|
'clip = core.ffms2.Source(source="./' + tempName + ' [4k][HEVC].mkv")',
|
||||||
'clip = vs.core.resize.Bicubic(clip, width=1920, height=1080, format=vs.RGBS, matrix_in_s="709")',
|
'clip = vs.core.resize.Bicubic(clip, width=1920, height=1080, format=vs.RGBS, matrix_in_s="709")',
|
||||||
'clip = rife(clip=clip, model="4.15", factor_num=2, factor_den=1)',
|
'clip = rife(clip=clip, model="4.25", factor_num=2, factor_den=1)',
|
||||||
'clip = vs.core.resize.Bicubic(clip, format=vs.YUV420P8, matrix_s="709")',
|
'clip = vs.core.resize.Bicubic(clip, format=vs.YUV420P8, matrix_s="709")',
|
||||||
'clip.set_output()']
|
'clip.set_output()']
|
||||||
|
|
||||||
if not os.path.isfile(upscaleOut + '.vpy'):
|
if not os.path.isfile(upscaleOut + '.vpy'):
|
||||||
with open(upscaleOut + '.vpy', 'a') as fs:
|
with open(upscaleOut + '.vpy', 'a') as fs:
|
||||||
fs.writelines([i + '\n' for i in script])
|
fs.writelines([i + '\n' for i in script])
|
||||||
|
|
||||||
def Interpolate(interpolateOut, upscaleOut, tempName, inputAspect):
|
def Interpolate(interpolateOut, upscaleOut, tempName, inputAspect):
|
||||||
if os.path.isfile(interpolateOut):
|
if os.path.isfile(interpolateOut):
|
||||||
print('Already interpolated')
|
print('Already interpolated')
|
||||||
return
|
return
|
||||||
|
|
||||||
createInterpolateScript(upscaleOut, tempName, inputAspect)
|
createInterpolateScript(upscaleOut, tempName, inputAspect)
|
||||||
|
|
||||||
if not os.path.isfile(upscaleOut + '.vpy'):
|
if not os.path.isfile(upscaleOut + '.vpy'):
|
||||||
print('=== Interpolation script not found ===')
|
print('=== Interpolation script not found ===')
|
||||||
return
|
return
|
||||||
|
|
||||||
print('Interpolating')
|
print('Interpolating')
|
||||||
subprocess.call('vspipe -c y4m "' + upscaleOut + '.vpy" - | ffmpeg -v quiet -stats -i - -c:v hevc_nvenc -qp 5 "' + interpolateOut + '"', shell=True)
|
subprocess.call('vspipe -c y4m "' + upscaleOut + '.vpy" - | ffmpeg -v quiet -stats -i - -c:v hevc_nvenc -qp 5 "' + interpolateOut + '"', shell=True)
|
||||||
|
|
||||||
# Remove Temp Files
|
# Remove Temp Files
|
||||||
os.remove(upscaleOut + '.ffindex')
|
os.remove(upscaleOut + '.ffindex')
|
||||||
os.remove(upscaleOut + '.vpy')
|
os.remove(upscaleOut + '.vpy')
|
||||||
|
@@ -11,7 +11,7 @@ def createInterpolateScript(upscaleOut, tempName):
|
|||||||
'from vapoursynth import core',
|
'from vapoursynth import core',
|
||||||
'clip = core.ffms2.Source(source="./' + tempName + ' [4k][HEVC].mkv")',
|
'clip = core.ffms2.Source(source="./' + tempName + ' [4k][HEVC].mkv")',
|
||||||
'clip = vs.core.resize.Bicubic(clip, width=3840, height=2160, format=vs.RGBS, matrix_in_s="709")',
|
'clip = vs.core.resize.Bicubic(clip, width=3840, height=2160, format=vs.RGBS, matrix_in_s="709")',
|
||||||
'clip = rife(clip=clip, model="4.15.lite", factor_num=2, factor_den=1)',
|
'clip = rife(clip=clip, model="4.25.lite", factor_num=2, factor_den=1)',
|
||||||
'clip = vs.core.resize.Bicubic(clip, format=vs.YUV420P8, matrix_s="709")',
|
'clip = vs.core.resize.Bicubic(clip, format=vs.YUV420P8, matrix_s="709")',
|
||||||
'clip.set_output()']
|
'clip.set_output()']
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user