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.

 

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

Reply
 
Thread Tools Search this Thread Display Modes
Old 9th March 2024, 13:24   #4861  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,869
hydra3333 reported a few issues regarding the portability support and installation in M-AB-S, to be tested...
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old 10th March 2024, 13:23   #4862  |  Link
amayra
Quality Checker
 
amayra's Avatar
 
Join Date: Aug 2013
Posts: 289
are you going to drop support for CPU without AVX2 like intel ivy bridge architecture (i have i7 3770)

i think there way to optimize VapourSynth for new CPU extensions when it detect without breaking support for old one right ?
__________________
I love Doom9
amayra is offline   Reply With Quote
Old 10th March 2024, 13:33   #4863  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,869
AVX2 should not be a minimum requirement, but one of several optimization paths. VapourSynth, as a Python extension, could also run on non-intel CPUs, where a required SSE/AVX support would make no sense but comparable SIMD instruction sets are available instead...
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old 10th March 2024, 16:48   #4864  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,575
Quote:
Originally Posted by amayra View Post
are you going to drop support for CPU without AVX2 like intel ivy bridge architecture (i have i7 3770)

i think there way to optimize VapourSynth for new CPU extensions when it detect without breaking support for old one right ?
Not planned. I do however think it's pointless to write optimized code paths for anything less than AVX2 for new code.

Things that definitely will be dropped at some point:
  • API3 compatibility - in a year or so, everything of value has been converted or will be soon
  • Windows 7 support - probably as a result of Python 3.8 becoming too old, not enough users actually testing it or MS relegating it to a separate compiler option with a long list of quirks much like windows XP support

Also a big part of the reason for requiring SSE2 was feature parity with x64 builds. Lots of instruction support checks that could be skipped and compiling with SSE2 instructions also produces a bit faster code.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 10th March 2024, 19:27   #4865  |  Link
amayra
Quality Checker
 
amayra's Avatar
 
Join Date: Aug 2013
Posts: 289
i always hate it when developers forced minimum requirement by not optimized application instead they use compiler flags like ("-march=cpu-type", CFLAGS, CCFLAGS and CXXFLAGS )

i fully understand and agreed with dropping old OS that not even modern web browser support

any CPU that don't support SSE2 i don't think can do anything with VS or any other applications
__________________
I love Doom9

Last edited by amayra; 10th March 2024 at 19:29.
amayra is offline   Reply With Quote
Old 13th March 2024, 12:31   #4866  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,575
The portable install script and portable zip have now been sneakily updated to fix several annoying issues related to plugin and script paths. Windows 7 support also added, however you'll need to install powershell 5.0 or later to actually run it since the bundled version on win7 is ancient.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet

Last edited by Myrsloik; 13th March 2024 at 12:33.
Myrsloik is offline   Reply With Quote
Old 13th March 2024, 19:59   #4867  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 327
Quote:
issues related to plugin and script paths
Loading vapoursynth clip from any path to portable vapoursynth could be done via loading script text using importlib module, not using scripts path.
If python loading script utility is in portable directory (or as an app), current path is an utility directory (portable directory), so dlls are loaded from portable directory. VSPipeloads that script (from portable directory) ok.

Is it related to that?
But vapoursynth installed dll's are preferred if vapoursynth is installed, dll's from Program Files/VapourSynth or AppData/Roaming/VapourSynth directory (Selur brought it up couple of times).


Code:
import importlib
vs.clear_outputs()
spec = importlib.util.spec_from_loader('vs_script_text', loader=None)
my_script_module = importlib.util.module_from_spec(spec)
exec(script_text, my_script_module.__dict__)
clip = vs.get_output(index)[0]
#or: clip = my_script_module.clip
_Al_ is offline   Reply With Quote
Old 13th March 2024, 20:11   #4868  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,347
Quote:
Selur brought it up couple of times
Yeah, still hoping that we will one day get a way to disable autoloading inside a script.
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 27th April 2024, 07:14   #4869  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,347
How can one validate the frame properties?
I want to check that '_Transfer', '_Matrix', 'Primaries', '_ColorRange', '_FieldBased' are set to valid values.
Are the enums of valid values for these properties accessible in a script, so I can compare against them?

Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 28th April 2024, 23:31   #4870  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 327
besides manually provide dictionaries or lists (as in the other thread) , vapoursynths Enums could be used:
vs.MatrixCoefficients
vs.TransferCharacteristics
vs.ColorPrimaries
vs.ColorRange
vs.FieldBased

using MatrixCoefficients Enum for example getting names and values:
print(vs.MatrixCoefficients.__members__)
getting values only:
print(vs.MatrixCoefficients.__members__.values())

so for matrix, checking if value is valid might be:
Code:
clip =  vs.core.std.BlankClip()
frame = clip.get_frame(0)
value = frame.props.get('_Matrix', None)
if value in [None, 2, 3] or value not in vs.MatrixCoefficients.__members__.values():
    clip = clip.std.SetFrameProps(_Matrix=1) # defaulting
frame = clip.get_frame(0)
print(frame.props)
<vapoursynth.FrameProps {'_DurationNum': 1, '_DurationDen': 24, '_Matrix': 1}>
>>>

Last edited by _Al_; 28th April 2024 at 23:39.
_Al_ is offline   Reply With Quote
Old 29th April 2024, 04:14   #4871  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,347
@_AI_: Thanks! That's what I was looking for.

Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 2nd May 2024, 15:31   #4872  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,347
Does anyone have an alternative TemporalDegrain2 for Vapoursynth?
(the one in G41Fun.py) crashes with extraSharp=True and I can't figure out why)
Update:
=> fixed it; problem was in CTMF

Cu Selur
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 3rd May 2024 at 13:32. Reason: found and fixed the problem
Selur is offline   Reply With Quote
Old 3rd May 2024, 19:17   #4873  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,711
There's also a version in VSDenoise: https://github.com/Jaded-Encoding-Th.../funcs.py#L193
Adub is offline   Reply With Quote
Old 3rd May 2024, 19:24   #4874  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,347
Nice! Thanks for the info!
(sadly: vs-denoise does not seem to work with Vapoursynth R65 portable, https://github.com/Jaded-Encoding-Th...se/issues/121; works with R66)
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 4th May 2024 at 06:48.
Selur is offline   Reply With Quote
Old 3rd May 2024, 19:24   #4875  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,711
@Myrsloik - plugin development question for you

Is it possible for a plugin to deterministically calculate max memory usage in Vapoursynth? For example, if I have a plugin that I know is going to work on N number of frames (say 3, prev + current + next), then can I use some aspect of the VS API to calculate the upper bound of memory usage?

It might even as simple as saying a plugin needs to process N frames, where each frame requires Y amount of data per frame and multiply that by the Z cores returned from the VS API?

I ask, because I'm considering the potential of allocating all required memory in one fell swoop (say at plugin Create) and then passing that pointer in the plugin data to GetFrame, using that as a pool, and then freeing that memory in plugin Free. Basically, I'm trying to minimize as many calls to malloc as possible.
Adub is offline   Reply With Quote
Old 3rd May 2024, 19:32   #4876  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,575
Quote:
Originally Posted by Adub View Post
@Myrsloik - plugin development question for you

Is it possible for a plugin to deterministically calculate max memory usage in Vapoursynth? For example, if I have a plugin that I know is going to work on N number of frames (say 3, prev + current + next), then can I use some aspect of the VS API to calculate the upper bound of memory usage?

It might even as simple as saying a plugin needs to process N frames, where each frame requires Y amount of data per frame and multiply that by the Z cores returned from the VS API?

I ask, because I'm considering the potential of allocating all required memory in one fell swoop (say at plugin Create) and then passing that pointer in the plugin data to GetFrame, using that as a pool, and then freeing that memory in plugin Free. Basically, I'm trying to minimize as many calls to malloc as possible.
Technically the upper bound would be the number of threads times the buffer space you need. But usually you don't even get remotely close to that due to threads spending time in other places. If you do it, WHICH YOU ABSOLUTELY SHOULDN'T, you'd be better off simply making new allocations when your filter local pool doesn't have an available set of buffers.

What you should do:
For small allocations (up to a few kb) are handled very well by new/delete/malloc/free and the process heap is your pool.

For larger allocation (like frame sizes) you can simply create a new frame (gray format for single plane). The overhead is very low and it's fast. The memory is now in the frame buffer pool and can be shared between everything. Including other instances of your own plugin.

Work with the system, don't reimplement it.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 4th May 2024, 15:09   #4877  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,347
@Mysrloik: I encountered that vsedits memory usage increases on each reload (when having biforst.dll in my scripts). Can you chime in whether this (https://github.com/YomikoR/VapourSynth-Editor/issues/55) is likely an issue of vedit, bifrost or Vapoursynth itself?
Thanks!
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 4th May 2024, 18:51   #4878  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,575
R67 is out. A pure bugfix release that should make everyone snooze.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 13th May 2024, 15:52   #4879  |  Link
wubikens
Registered User
 
Join Date: Jan 2015
Posts: 1
Dumb question, but how do you load a clip? I'm trying to use BasicVSR++, and I followed the instructions here: https://github.com/HolyWu/vs-basicvs...readme-ov-file and got this running in a PyCharm project. All of the dependencies were correctly installed, but I'm having a hell of a time figuring out how to just load a clip with VapourSynth. I'm currently using R65 with Python 3.10. I see in the documentation that VapourSynth recommends using BestSource?

https://www.vapoursynth.com/doc/gett...example-script

Quote:
It all starts with a .vpy script. Here’s a sample script to be inspired by, it assumes that BestSource is installed and auto-loaded.

from vapoursynth import core # Get an instance of the core
clip = core.bs.VideoSource(source='filename.mkv') # Load a video track in mkv file
clip = core.std.FlipHorizontal(clip) # Flip the video clip in the horizontal direction
clip.set_output() # Set the video clip to be accessible for output
But I can't seem to pip install it. If somebody could direct me at the very least to some instructions I could follow, I'd really appreciate it. Thanks!
wubikens is offline   Reply With Quote
Old 19th May 2024, 16:29   #4880  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,347
@all:
R68 was released:
Quote:
fixed portable base path detection, was broken in r67
fixed is_inspectable, was broken in r67
reverted widestring print changes in vspipe from r67
source: https://github.com/vapoursynth/vapou...leases/tag/R68

------
@Myrsloik:
When using:
Code:
import vapoursynth as vs
core = vs.core
import site
clip = core.std.BlankClip()
clip = core.text.Text(clip, str(core))
audio = vs.core.std.BlankAudio()
clip = core.std.Trim(clip=clip, first=0, last=1)
clip.set_output(index=0)
audio.set_output(index=1)
and calling
Code:
vspipe --info "path to script"
I only get just the video info.
R65 and R68 and both just return:
Code:
Width: 640
Height: 480
Frames: 2
FPS: 24/1 (24.000 fps)
Format Name: RGB24
Color Family: RGB
Alpha: No
Sample Type: Integer
Bits: 8
SubSampling W: 0
SubSampling H: 0
no mention of the audio.

I noticed, that when using:
Code:
clip.set_output(index=1)
audio.set_output(index=0)
(setting audio to be the first index)
or using:
Code:
VSPipe.exe --info "Path to script" -o 1
I get:
Code:
Samples: 441000
Sample Rate: 44100
Format Name: Audio16 (2 CH)
Sample Type: Integer
Bits: 16
Channels: 2
Layout: Front Left, Front Right
=>
Would be nice if VSPipes '--info' could be adjusted, when called without '-o X' to either:
a. output the first index and some additional info what other indexes exist
or
b. output the info for all indexes, like:
Code:
OutputIndex: 0
Width: 640
Height: 480
Frames: 2
FPS: 24/1 (24.000 fps)
Format Name: RGB24
Color Family: RGB
Alpha: No
Sample Type: Integer
Bits: 8
SubSampling W: 0
SubSampling H: 0

OutputIndex: 1
Samples: 441000
Sample Rate: 44100
Format Name: Audio16 (2 CH)
Sample Type: Integer
Bits: 16
Channels: 2
Layout: Front Left, Front Right
Thanks for thinking about this.

Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Reply

Tags
speed, vaporware, vapoursynth

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 21:20.


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