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 18th May 2019, 00:54   #3361  |  Link
aldix
Registered User
 
Join Date: Sep 2012
Posts: 156
think i've almost everything fixed and set up now the way i need to. sorry about being so dense.

i'm still struggling with core.std.Interleave tho. what's the correct way using it?

i'm getting
Quote:
vapoursynth.Error: Interleave: the clips' formats don't match
using:
Quote:
...
src = core.fmtc.resample(clip,w=1280,h=720, kernel="blackmanminlobe", taps=4)
...
video = core.f3kdb.Deband(video,sample_mode=2,dynamic_grain=False,keep_tv_range=False,dither_algo=3,output_depth=8,y=48,cb=48,cr=48,grainy=48,grainc=48)
int = core.std.Interleave(clips=[src,video])
int.set_output()
and both are 1280/720.

Last edited by aldix; 18th May 2019 at 01:29.
aldix is offline   Reply With Quote
Old 18th May 2019, 02:11   #3362  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
resolution is not enough, comment out that interleave line and add:
src = src.text.ClipInfo()
src.set_output()
to see parameters of that clip and then delete those two lines and add other clip:
video = video.text.ClipInfo()
video.set_output()

Last edited by _Al_; 18th May 2019 at 02:14.
_Al_ is offline   Reply With Quote
Old 18th May 2019, 02:25   #3363  |  Link
aldix
Registered User
 
Join Date: Sep 2012
Posts: 156
Quote:
| Format: YUV420P16
...
Format: YUV420P8
hmm, so src clip is 16-bit and filtered is 8? but how do i change the src clip to 8-bit right at the beginning?
and will it mess all the rest up again, or what?

Last edited by aldix; 18th May 2019 at 02:29.
aldix is offline   Reply With Quote
Old 18th May 2019, 02:41   #3364  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
don't know , you can change it right after loading src source or just before interleaving

src = core.resize.Bicubic(src, format = vs.YUV420P8)
_Al_ is offline   Reply With Quote
Old 18th May 2019, 02:51   #3365  |  Link
aldix
Registered User
 
Join Date: Sep 2012
Posts: 156
think i fixed it with these changes.

Quote:
src = core.fmtc.resample(clip,w=1280,h=720, kernel="blackmanminlobe", taps=4,css=420)
src = core.fmtc.bitdepth(clip,bits=8,dmode=1)
at least the script runs now. but, um, when i initiate the preview, i've no idea which frames from which i'm looking at?

too used to moving back and forth with keyboard arrows with the regular interleave. what's the how-to here?
aldix is offline   Reply With Quote
Old 18th May 2019, 02:54   #3366  |  Link
aldix
Registered User
 
Join Date: Sep 2012
Posts: 156
hmm, never mind.

think it does work the same way, though. just the changes are too negligible with finesharp. oh well.

gotta try to get seesaw to work now
aldix is offline   Reply With Quote
Old 18th May 2019, 03:04   #3367  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
You could switch to zimg - Vapoursynth's resize, like in my example, that changes resolutions, color spaces and much more. fmtconv is another way to do it though. Zimg is written by myrsloik I think so I'm sure it sits well within Vapoursynth.
_Al_ is offline   Reply With Quote
Old 18th May 2019, 04:28   #3368  |  Link
edcrfv94
Registered User
 
Join Date: Apr 2015
Posts: 84
Will vivtc.VFM support ovr text file like tivtc?
edcrfv94 is offline   Reply With Quote
Old 24th May 2019, 04:05   #3369  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
If anyone can answer,
why there is kernel or resize method set as resize attribute and not just an argument in core.resize ?
example: clip = core.resize(clip, kernel = Bicubic, ......)
_Al_ is offline   Reply With Quote
Old 24th May 2019, 11:03   #3370  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
Something like that will work:

Code:
resizer = {
    'bicubic': core.resize.Bicubic,
    'bilinear': core.resize.Bilinear,
    'spline36': core.resize.Spline36,
    'spline16': core.resize.Spline16
}
clip = resizer['bicubic'](clip, 960, 540, format=vs.YUV420P8)
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 24th May 2019, 15:16   #3371  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
I meant why is that, if author wanted that to look more like Avisynth command, to keep a pattern. Not that it matters.

That example is cool, yes tables with dictionaries, tuples, lists, that's the way to go. :-).

Or checking if kernel exists might be done by checking if it exists as a resize attribute:
Code:
my_cool_function(clip, kernel='Bicubic', miracle_settings=True)
try:
     getattr(vs.core.resize, kernel)
except:
      print("Wrong kernel")
edit: fixed missing quotes , because that's the whole point in this example with getattr , getting an object from a string name

Last edited by _Al_; 24th May 2019 at 16:39.
_Al_ is offline   Reply With Quote
Old 26th May 2019, 02:21   #3372  |  Link
aldix
Registered User
 
Join Date: Sep 2012
Posts: 156
ok, i'm back again so please bear with me here.

Quote:
...
maskstars=src.mt_binarize(upper=false)
...
mt_merge(last,maskstars)
...
so i went ahead and tried

Quote:
...
maskstars = core.std.Binarize(src,threshold=0)
...
video = core.std.Merge(video,maskstars)
...
but think i'm doing something wrong, cos "threshold=0" doesn't seem to equal "upper=false" for video picture changes color in weird ways etc. so how should i use the vs binarize? is it even what i'm after here?
merge seems to be mt_merge, though, so at least that is straightforward.

Quote:
z = 2 # z = zero point
p = 0.9 # p = power
str = 0.9 # str = strength
rad = 1.0 # radius for "gauss"

o = last
g = o.bicubicresize(round(o.width()/rad/4)*4,round(o.height()/rad/4)*4).bicubicresize(o.width(),o.height(),1,0)

mt_lutxy(o,g,"x x y - abs "+string(z)+" / 1 "+string(p)+" / ^ "+string(z)+" * "+string(str)+" * x y - x y - abs 0.001 + / * +",U=2,V=2)
still don't know what to do with ^. as much as i googled, there seems to be some alternative for mt_lutxy under vs, but not like i'd know how to use it.
the resize can be done with core.std.resize etc i suppose. as far as the following calculation goes though, i've no idea. as much as i can recall, this
script snippet is something Didee wrote ages ago (if that helps any).

thanks!
aldix is offline   Reply With Quote
Old 26th May 2019, 18:18   #3373  |  Link
WolframRhodium
Registered User
 
Join Date: Jan 2016
Posts: 162
Code:
maskstars=src.mt_binarize(upper=false)
in AVS is equivalent to
Code:
maskstars=src.std.Binarize(threshold=128+1, planes=[0])
in Vapoursynth.

Quote:
Originally Posted by aldix View Post
still don't know what to do with ^.
The equivalent in std.Expr() is "pow".

Quote:
Originally Posted by aldix View Post
there seems to be some alternative for mt_lutxy under vs, but not like i'd know how to use it.
It could be implemented through std.Lut2() or std.Expr(). The semantics of the later one is more close to mt_lutxy(), e.g.
Code:
core.std.Expr([o, g], [f"x x y - abs {z} / 1 {p} / pow {z} * {strength} * x y - x y - abs 0.001 + / * +", ""])
Avisynth functions and their VapourSynth equivalents may be helpful to you.

Last edited by WolframRhodium; 26th May 2019 at 18:21.
WolframRhodium is offline   Reply With Quote
Old 27th May 2019, 02:13   #3374  |  Link
aldix
Registered User
 
Join Date: Sep 2012
Posts: 156
Quote:
Originally Posted by WolframRhodium View Post
Code:
maskstars=src.mt_binarize(upper=false)
in AVS is equivalent to
Code:
maskstars=src.std.Binarize(threshold=128+1, planes=[0])
in Vapoursynth.



The equivalent in std.Expr() is "pow".


It could be implemented through std.Lut2() or std.Expr(). The semantics of the later one is more close to mt_lutxy(), e.g.
Code:
core.std.Expr([o, g], [f"x x y - abs {z} / 1 {p} / pow {z} * {strength} * x y - x y - abs 0.001 + / * +", ""])
Avisynth functions and their VapourSynth equivalents may be helpful to you.
awesome! thank you so much, i've the maskstars part sorted now.

how would i write this in vs though? with a bunch of different core.resize.Bicubic calls or what? hmm, and what's the equivalent in vs for "round" and "rad"?

Quote:
g = o.bicubicresize(round(o.width()/rad/4)*4,round(o.height()/rad/4)*4).bicubicresize(o.width(),o.height(),1,0)

thanks a lot in any case. really loving the community here!
aldix is offline   Reply With Quote
Old 27th May 2019, 03:19   #3375  |  Link
WolframRhodium
Registered User
 
Join Date: Jan 2016
Posts: 162
Quote:
Originally Posted by aldix View Post
how would i write this in vs though? with a bunch of different core.resize.Bicubic calls or what? hmm, and what's the equivalent in vs for "round" and "rad"?

Code:
g = o.bicubicresize(round(o.width()/rad/4)*4,round(o.height()/rad/4)*4).bicubicresize(o.width(),o.height(),1,0)
Code:
g = o.resize.Bicubic(round(o.width/rad/4)*4, round(o.height/rad/4)*4).resize.Bicubic(o.width, o.height, filter_param_a=1, filter_param_b=0)
"rad" is a variable in your code,
Code:
rad = 1.0 # radius for "gauss"
(Actually "round" should be implemented like this)
Code:
_round = lambda x: -int(-x+0.5) if x < 0 else int(x+0.5)
g = o.resize.Bicubic(_round(o.width/rad/4)*4, _round(o.height/rad/4)*4).resize.Bicubic(o.width, o.height, filter_param_a=1, filter_param_b=0)
WolframRhodium is offline   Reply With Quote
Old 28th May 2019, 02:58   #3376  |  Link
aldix
Registered User
 
Join Date: Sep 2012
Posts: 156
Quote:
Originally Posted by WolframRhodium View Post
Code:
g = o.resize.Bicubic(round(o.width/rad/4)*4, round(o.height/rad/4)*4).resize.Bicubic(o.width, o.height, filter_param_a=1, filter_param_b=0)
"rad" is a variable in your code,
Code:
rad = 1.0 # radius for "gauss"
(Actually "round" should be implemented like this)
Code:
_round = lambda x: -int(-x+0.5) if x < 0 else int(x+0.5)
g = o.resize.Bicubic(_round(o.width/rad/4)*4, _round(o.height/rad/4)*4).resize.Bicubic(o.width, o.height, filter_param_a=1, filter_param_b=0)

thank you so very much!! yes! this works.

and now i've whole of my old avs script working!

aldix is offline   Reply With Quote
Old 28th May 2019, 13:01   #3377  |  Link
bjoker
Registered User
 
Join Date: Jan 2013
Posts: 50
Python exception: No attribute with the name ffms2 exists. Did you mistype a plugin n

Could anyone please advise on how to link ffms2 plugin to VapourSynth on Ubuntu linux? As there is no VapourSynth FATPACK for linux i had to compile/build ffms2. Please see below and advise, thanks!

Quote:
vspipe /root/MyMovie.vpy - --y4m | x265 --crf 22 --preset slow --output-depth 10 --ctu 32 --max-tu-size 16 --analysis-reuse-level 8 --no-rect --b-intra --aq-mode 3 --subme 5 --merange 60 --max-merge 4 --weightb --bframes 8 --rc-lookahead 80 --ref 5 --colorprim bt709 --colormatrix bt709 --transfer bt709 --deblock -2:-1 --no-sao --no-strong-intra-smoothing --y4m --output /root/MyMovie-out.mkv -
Script evaluation failed:
Python exception: No attribute with the name ffms2 exists. Did you mistype a plugin namespace?

Traceback (most recent call last):
File "src/cython/vapoursynth.pyx", line 1937, in vapoursynth.vpy_evaluateScript
File "src/cython/vapoursynth.pyx", line 1938, in vapoursynth.vpy_evaluateScript
File "/root/MyMovie.vpy", line 8, in <module>
clip = core.ffms2.Source(r"/root/MyMovie-1min.mkv", cachefile = r"/root/MyMovie-1min.mkv.ffindex")
File "src/cython/vapoursynth.pyx", line 1532, in vapoursynth.Core.__getattr__
AttributeError: No attribute with the name ffms2 exists. Did you mistype a plugin namespace?

x265 [error]: unable to open input file <->
Quote:
root@ubuntu19:~# cat MyMovie.vpy
import os
import sys
ScriptPath = '/root/VS/Scripts'
sys.path.append(os.path.abspath(ScriptPath))
import vapoursynth as vs
core = vs.get_core()
clip = core.ffms2.Source(r"/root/MyMovie-1min.mkv", cachefile = r"/root/MyMovie-1min.mkv.ffindex")
clip.set_output()
Quote:
root@ubuntu19:~# python -V
Python 3.7.3
root@ubuntu19:~#
root@ubuntu19:~# vspipe --version
VapourSynth Video Processing Library
Copyright (c) 2012-2018 Fredrik Mellbin
Core R45
API R3.5
Options: -
root@ubuntu19:~# x265 --version
x265 [info]: HEVC encoder version 2.9
x265 [info]: build info [Linux][GCC 8.2.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
root@ubuntu19:~# ffmpeg --version
ffmpeg version 4.1.3-0ubuntu1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8 (Ubuntu 8.3.0-6ubuntu1)
configuration: --prefix=/usr --extra-version=0ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Unrecognized option '-version'.
Error splitting the argument list: Option not found
root@ubuntu19:~#

root@ubuntu19:~# uname -a
Linux ubuntu19 5.0.0-15-generic #16-Ubuntu SMP Mon May 6 17:41:33 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
root@ubuntu19:~#
I did set these below:
Quote:
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
PYTHONPATH=/usr/local/lib/python3.7/site-packages/; export PYTHONPATH
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig; export PKG_CONFIG_PATH
LD_RUN_PATH=$LD_RUN_PATH:/usr/local/lib; export LD_RUN_PATH

and tried this too..
root@ubuntu19:~/.config/vapoursynth# cat /root/.config/vapoursynth/vapoursynth.conf
SystemPluginDir=/usr/local/lib/pkgconfig
root@ubuntu19:~/.config/vapoursynth#
fms2 install log:
Quote:
root@ubuntu19:~/ffms2# make install
make[1]: Entering directory '/root/ffms2'
/usr/bin/mkdir -p '/usr/local/lib'
/bin/bash ./libtool --mode=install /usr/bin/install -c src/core/libffms2.la '/usr/local/lib'
libtool: install: /usr/bin/install -c src/core/.libs/libffms2.so.4.0.0 /usr/local/lib/libffms2.so.4.0.0
libtool: install: (cd /usr/local/lib && { ln -s -f libffms2.so.4.0.0 libffms2.so.4 || { rm -f libffms2.so.4 && ln -s libffms2.so.4.0.0 libffms2.so.4; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libffms2.so.4.0.0 libffms2.so || { rm -f libffms2.so && ln -s libffms2.so.4.0.0 libffms2.so; }; })
libtool: install: /usr/bin/install -c src/core/.libs/libffms2.lai /usr/local/lib/libffms2.la
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the 'LD_RUN_PATH' environment variable
during linking
- use the '-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
/usr/bin/mkdir -p '/usr/local/bin'
/bin/bash ./libtool --mode=install /usr/bin/install -c src/index/ffmsindex '/usr/local/bin'
libtool: install: /usr/bin/install -c src/index/.libs/ffmsindex /usr/local/bin/ffmsindex
/usr/bin/mkdir -p '/usr/local/share/doc/ffms2'
/usr/bin/install -c -m 644 doc/ffms2-api.md doc/ffms2-changelog.md '/usr/local/share/doc/ffms2'
/usr/bin/mkdir -p '/usr/local/include'
/usr/bin/install -c -m 644 ./include/ffms.h ./include/ffmscompat.h '/usr/local/include'
/usr/bin/mkdir -p '/usr/local/lib/pkgconfig'
/usr/bin/install -c -m 644 ffms2.pc '/usr/local/lib/pkgconfig'
make[1]: Leaving directory '/root/ffms2'
root@ubuntu19:~/ffms2#
bjoker is offline   Reply With Quote
Old 28th May 2019, 13:33   #3378  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Maybe someone could make a flatpack / appimage / snap version with vsedit, vapoursynth and some plugins.
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 28th May 2019, 15:14   #3379  |  Link
bjoker
Registered User
 
Join Date: Jan 2013
Posts: 50
I solved issue of loading plugins by
Quote:
root@ubuntu19:~# cat MyMovie.vpy
import os
import sys
ScriptPath = '/root/VS/Scripts'
#LoadPlugin(path='/usr/local/lib/pkgconfig/ffms2.pc')
sys.path.append(os.path.abspath(ScriptPath))
import vapoursynth as vs
core = vs.get_core()
core.std.LoadPlugin(path='/usr/local/lib/vapoursynth/libffms2.so')
clip = core.ffms2.Source(r"/root/eega-1min.mkv", cachefile = r"/root/eega-1min.mkv.ffindex")
clip.set_output()

root@ubuntu19:~#
But do I need to load each one manually that I need?
bjoker is offline   Reply With Quote
Old 28th May 2019, 15:24   #3380  |  Link
Are_
Registered User
 
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 321
The problem is /usr/local/lib is not in your path.
You can pass it to configure when you build ffms2 and then install to the common path:

Code:
./configure --prefix=/usr --libdir=/usr/lib64
Ops, and then soft-link in "/usr/lib64/vapoursynth" I guess.

Last edited by Are_; 28th May 2019 at 16:16.
Are_ 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 10:09.


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