Log in

View Full Version : LibavSMASHSource <> InterFrame -> tons of black frames


Selur
2nd July 2020, 16:14
I'm having a strange problem with this source (https://drive.google.com/file/d/12QIprs7ZSb6EDKPtLtP8j1_d16P1udz7/view?usp=sharing) (19MB) using LibavSMASHSource and InterFrame,
using:
# Imports
import os
import sys
import vapoursynth as vs
core = vs.get_core()
# Import scripts folder
scriptPath = 'I:/Hybrid/64bit/vsscripts'
sys.path.append(os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/FrameFilter/Interframe/svpflow2_vs64.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/FrameFilter/Interframe/svpflow1_vs64.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Import scripts
import havsfunc
# input color space: YUV420P8, bit depth: 8, resolution: 656x480, fps: 25
# Loading C:\Users\Selur\Desktop\Test.mp4 using LibavSMASHSource
clip = core.lsmas.LibavSMASHSource(source="C:/Users/Selur/Desktop/Test.mp4",fpsnum=25)
# making sure input color matrix is set as 470bg
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# adjusting frame count with Interframe/SVP
clip = havsfunc.InterFrame(clip, NewNum=60, NewDen=1, OverrideAlgo=13) # new fps: 60
# Output
clip.set_output()
Vapoursynth returns 5944933 black frames.
Without Interframe:
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# input color space: YUV420P8, bit depth: 8, resolution: 656x480, fps: 25
# Loading C:\Users\Selur\Desktop\Test.mp4 using LibavSMASHSource
clip = core.lsmas.LibavSMASHSource(source="C:/Users/Selur/Desktop/Test.mp4")
# making sure input color matrix is set as 470bg
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# Output
clip.set_output()
the decoding works fine and I get the normal 4838 frames.
Using FFMS2 instead of LibavSMASHSource with Interframe:

# Imports
import os
import sys
import vapoursynth as vs
core = vs.get_core()
# Import scripts folder
scriptPath = 'I:/Hybrid/64bit/vsscripts'
sys.path.append(os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/FrameFilter/Interframe/svpflow2_vs64.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/FrameFilter/Interframe/svpflow1_vs64.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
# Import scripts
import havsfunc
# input color space: YUV420P8, bit depth: 8, resolution: 656x480, fps: 25
# Loading source using FFMS2
clip = core.ffms2.Source(source="C:/Users/Selur/Desktop/Test.mp4",cachefile="E:/Temp/mp4_85cc5ab7e7a053ca0629800dc986bd68_853323747.ffindex",fpsnum=25,format=vs.YUV420P8,alpha=False)
# making sure input color matrix is set as 470bg
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# adjusting frame count with Interframe/SVP
clip = havsfunc.InterFrame(clip, NewNum=60, NewDen=1, OverrideAlgo=13) # new fps: 60
# Output
clip.set_output()
the output is as expected 11609 frames.

Seems like it's a problem with the LibavSMASHSource <> InterFrame combination.
I tried whether using a seek_threshold like 60 doesn't help either.


=>
a. Can someone reproduce the issue (to be sure it's not just my setup) ?
b. Does someone know a workaround for the LibavSMASHSource <> InterFrame combination to work?
c. Does someone know what's causing the problem?

Cu Selur

Selur
2nd July 2020, 18:46
Thanks for the info!
I used fpsnum, since the source as identified by MediaInfo as:
Frame rate mode : Constant
FrameRate_Mode_Original : VFR
which usually means that the stream indicates vfr, but the container indicates cfr, so to be sure that the output of LibavSMASHSource is cfr I use 'fpsnum=25'.

Hope this can be fixed in one of the upcoming LibavSMASHSource releases.

Cu Selur