Log in

View Full Version : Vapoursynth


Pages : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 [73] 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

Jukus
22nd October 2019, 20:05
Is there any way to use spline144 with Vapour?
Is it true that this is the best resizer for any situation?

poisondeathray
22nd October 2019, 21:35
Is there any way to use spline144 with Vapour?


With fmtconv kernel="spline", taps=6


"spline"

Generic splines, number of sample points is twice the taps parameter, so you can use taps = 6 to get a Spline144Resize equivalent.





Is it true that this is the best resizer for any situation?

Probably not. Likely some ringing artifacts, oversharpen halos

Myrsloik
22nd October 2019, 21:50
R48-RC3 (https://github.com/vapoursynth/vapoursynth/releases/tag/R48-RC3)

Fixes the aformentioned pink line at top and bottom (general expr bug) and another 32bit bug in expr as well. Keep testing it.

Keep testing it! So far the only discovered bug in RC3 is in Convolution with float input, everything else should work fine. I'll probably do daily builds from now on until every single regression is gone.

poisondeathray
22nd October 2019, 22:02
If you have RGBS and use Expr to add 1 to channel R , is it suppose to round the value ? Or is this the same thing as the Convolution with float input issue ?

clip2 = core.std.Expr(clip, ["x 1 +", "", ""])

e.g. in vsedit, the color picker shows R=0.921468 for clip, R=1.92147 for clip2

I would have expected 1.921468 (G, B remain unchanged at 0.921468)

core.std.SetMaxCPU("none") does not affect the result, R48-RC3 x64

Myrsloik
22nd October 2019, 22:26
If you have RGBS and use Expr to add 1 to channel R , is it suppose to round the value ? Or is this the same thing as the Convolution with float input issue ?

clip2 = core.std.Expr(clip, ["x 1 +", "", ""])

e.g. in vsedit, the color picker shows R=0.921468 for clip, R=1.92147 for clip2

I would have expected 1.921468 (G, B remain unchanged at 0.921468)

core.std.SetMaxCPU("none") does not affect the result, R48-RC3 x64

That's how floating point math works. It's not exact.

StainlessS
22nd October 2019, 22:42
From VS2008 Float.h


#define FLT_DIG 6 /* # of decimal digits of precision */
#define FLT_EPSILON 1.192092896e-07F /* smallest such that 1.0+FLT_EPSILON != 1.0 */
#define FLT_GUARD 0
#define FLT_MANT_DIG 24 /* # of bits in mantissa */
#define FLT_MAX 3.402823466e+38F /* max value */
#define FLT_MAX_10_EXP 38 /* max decimal exponent */
#define FLT_MAX_EXP 128 /* max binary exponent */
#define FLT_MIN 1.175494351e-38F /* min positive value */
#define FLT_MIN_10_EXP (-37) /* min decimal exponent */
#define FLT_MIN_EXP (-125) /* min binary exponent */
#define FLT_NORMALIZE 0
#define FLT_RADIX 2 /* exponent radix */
#define FLT_ROUNDS 1 /* addition rounding: near */

poisondeathray
22nd October 2019, 22:50
Thanks Myrsloik, StainlessS ; If it's using FLT_DIG 6 , shouldn't it round to 1.921468 ? Or does it count decimal digits differently ? Or was this covered in grade school math that I might have slept through? :D

StainlessS
22nd October 2019, 22:52
Its really the binary digits that count, and 10 is not a power of 2, so it works (rounds) a bit weird.

EDIT: If it were viewed in binary, it would make sense.

poisondeathray
22nd October 2019, 22:53
Its really the binary digits that count, and 10 is not a power of 2, so it works (rounds) a bit weird.

Thanks

StainlessS
22nd October 2019, 23:22
PDR, a bit more.

There are a fractional number of binary digits per decimal digit, and although float only precise to 6 [EDIT: significant] digits, there will likely be one or more decimal digits which are not quite correct.

EDIT: Note, below 6 significant digits

0.921468
^^^^^^

1.921468 # Adding 1.0, last digit is not within first 6 significant digits : Note that the extra digit is printed because of the default print format, rather than it being within first 6 significant digits.
^ ^^^^^



a = 0.921468 # This was probably not exact to begin with

b = a + 1.0

DIGS=32 # Digits to the right of decimal point

BlankClip

RT_DebugF("a=%.*f\nb=%.*f",DIGS,a,DIGS,b)
RT_subtitle("a=%.*f\nb=%.*f",DIGS,a,DIGS,b)

return last



00000057 0.29118466 [1068] RT_DebugF: a=0.92146801948547363000000000000000
00000058 0.29125640 [1068] RT_DebugF: b=1.92146801948547360000000000000000


EDIT:

RT_subtitle("a=%.*f\nb=%.*f",DIGS,a,DIGS,b)

Equiv

RT_subtitle("a=%.32f\nb=%.32f",a,b)


EDIT: No reply necessary.

EDIT:
There are a fractional number of binary digits per decimal digit

Function Log2(float n) {
return Log(n) / Log(2.0)
}

blankclip
DIGS=32 # Digits to the right of decimal point

BitsPerDecDigit = Log2(10.0)
Test10=Pow(2.0,BitsPerDecDigit)
RT_debugF ("BitsPerDecDigit=%.*f\nTest10 =%.*f",DIGS,BitsPerDecDigit,DIGS,Test10)
RT_Subtitle("BitsPerDecDigit=%.*f\nTest10 =%.*f",DIGS,BitsPerDecDigit,DIGS,Test10)
return last



00000231 0.29308608 [4064] RT_DebugF: BitsPerDecDigit=3.32192802429199220000000000000000
00000232 0.29313752 [4064] RT_DebugF: Test10 =9.99999904632568360000000000000000

ifb
23rd October 2019, 01:35
Speed comparisons with R46 also welcome.

Threadripper 1920X w/64GB ECC and Windows 10 x64
Local build of VS with the latest AVX2 fix (ac74e9b)
Three runs on a script that's all float and 16-bit (CinemaDNG sequence):
time vspipe -e 1000 script.vpy .

1 2 3 avg stddev relative
R48-RC3+1 avx2 432.83 434.95 435.22 434.33 1.309 1.0080x
sse2 431.05 433.80 436.28 433.71 2.616 1.0095x
none 467.84 465.92 463.87 465.88 1.985 0.9398x
R46 sse2 434.29 440.49 438.68 437.82 3.188 1.0000x

~1% faster vs R46 even though AVX2 doesn't help poor Zen1. :p

Myrsloik
23rd October 2019, 09:48
Threadripper 1920X w/64GB ECC and Windows 10 x64
Local build of VS with the latest AVX2 fix (ac74e9b)
Three runs on a script that's all float and 16-bit (CinemaDNG sequence):
time vspipe -e 1000 script.vpy .

1 2 3 avg stddev relative
R48-RC3+1 avx2 432.83 434.95 435.22 434.33 1.309 1.0080x
sse2 431.05 433.80 436.28 433.71 2.616 1.0095x
none 467.84 465.92 463.87 465.88 1.985 0.9398x
R46 sse2 434.29 440.49 438.68 437.82 3.188 1.0000x

~1% faster vs R46 even though AVX2 doesn't help poor Zen1. :p

You've most likely hit the ram bandwidth limit. Run it with a single/few threads and the difference should be obvious.

Myrsloik
23rd October 2019, 13:41
R48-RC4 (https://github.com/vapoursynth/vapoursynth/releases/tag/R48-RC4)

Fixes the floating point edge handling of RC3.

Test harder!

Myrsloik
23rd October 2019, 14:26
It seems that the PATH is always added even though I have unchecked the option.

Congratulations! You've won a free RC5 build which you can redeem tomorrow! That was a really stupid typo. At least there are no known image corruption problems. (test the unprivileged installs too just to be sure)

Myrsloik
24th October 2019, 10:24
R48-RC5 (https://github.com/vapoursynth/vapoursynth/releases/tag/R48-RC5)

The only change from RC4 is that the installer now correctly respects the add to PATH options.

l00t
24th October 2019, 14:31
I've found another bug. When I try to use nyuszika7h's FFInfo the result is a pile of garbage with R48-RC4, while it was perfectly fine with R47.2. The picture is also okay without the script.

nyuszika7h's FFInfo script:
https://gist.github.com/nyuszika7h/340cd5bd529a70746f0b35a464ef9a91

with FFInfo:
https://thumbs2.imgbox.com/c5/75/lfIpTn7P_t.png (http://imgbox.com/lfIpTn7P)

without FFInfo:
https://thumbs2.imgbox.com/81/7d/ctRXj1Pu_t.png (http://imgbox.com/ctRXj1Pu)

import vapoursynth as vs
from vapoursynth import core
clip = core.ffms2.Source(source=r'some_hd_footage.mkv')
clip = vs_ffinfo.FFInfo(clip, text='some text', frame_num=True, frame_type=True, frame_time=True)
clip.set_output()

FFMS2 is the latest version from 10/07/2019 from StvG

Video parameters:
Resolution: 1920x1038
Format: YUV420P8
FPS: 24000/1001

Thanks in advance

ChaosKing
24th October 2019, 15:37
The problem is in: clip.sub.Subtitle("this is art")

Myrsloik
24th October 2019, 20:05
R48-RC6 (https://github.com/vapoursynth/vapoursynth/releases/tag/R48-RC6)

Fixes premultiplied maskedmerge and a few expr problems that most likely were never encountered by anyone.

l00t
24th October 2019, 21:29
Thanks, now it's perfect.

BTW: If someone's interested in FFInfo, I've pumped up a bit nyuszika's version: https://gist.github.com/l00tzOMG/404e81cdcae2e7415dd96b57b08f32ce

_Al_
24th October 2019, 23:55
I've pumped up a bit nyuszika's version: https://gist.github.com/l00tzOMG/404...d96b57b08f32ce
To get string equivalents for those numerical frame property values, you can use dictionaries/ tables and then just get value you need.
With if , elif approach you can end up having hundreds of them is database is large. Look in that example:
https://forum.doom9.org/showthread.php?p=1885759#post1885759

ifb
25th October 2019, 00:41
You've most likely hit the ram bandwidth limit. Run it with a single/few threads and the difference should be obvious.

core.num_threads = 1
R48 RC4 avx2 5975.40 1.0062
sse2 5938.56 1.0125
R46 sse2 6012.63 1.0000

I only did 1 run each, but still ~1% faster.

_Al_
25th October 2019, 00:41
@l00t
MATRIX = {
0:'rgb',
1:'709',
.
.
.
}
PRIMARIES = { .....}
TRANSFER = {....}

try:
lines.append(f'Matrix: {MATRIX[f.props["_Matrix"]]}')
except Exception as e:
lines.append(f'Matrix: {str(e)}')

try:
lines.append(f'Primaries: {PRIMARIES[f.props["_Primaries"]]}')
except Exception as e:
lines.append(f'Primaries: {str(e)}')

l00t
25th October 2019, 08:13
Thanks for the idea, modified the script accordingly :)

...

MonoS
27th October 2019, 20:08
Since version R46 i get the error "Failed to initialize VapourSynth environment" even execuiting a simple vspipe -v
I've tried R46, R47 and R48-RC6, all giving me the same error, this on two different machine, one Win 10 the other Win Server 2019 even after reboot

Installing R45 it works without problem.

What could be the issue? what can i do to help you diagnose the problem?

Myrsloik
27th October 2019, 20:54
Since version R46 i get the error "Failed to initialize VapourSynth environment" even execuiting a simple vspipe -v
I've tried R46, R47 and R48-RC6, all giving me the same error, this on two different machine, one Win 10 the other Win Server 2019 even after reboot

Installing R45 it works without problem.

What could be the issue? what can i do to help you diagnose the problem?

Which install type? Did you really install the vs2019 runtimes? You can simply run vspipe in a debugger if you still can't figure it out since I've even included pdbs for the main dlls.

MonoS
28th October 2019, 09:02
Which install type? Did you really install the vs2019 runtimes? You can simply run vspipe in a debugger if you still can't figure it out since I've even included pdbs for the main dlls.

64bit non portable version, installed vs2019 runtimes the first time, then in subsequent install skipped that.

For setting up the debugger what should i do? Download the source and put a breakpoint inside real_init (https://github.com/vapoursynth/vapoursynth/blob/7c488b5d33991115e148da60b7afe30040da9245/src/vsscript/vsscript.cpp#L46) and see what fail?

Myrsloik
28th October 2019, 11:13
64bit non portable version, installed vs2019 runtimes the first time, then in subsequent install skipped that.

For setting up the debugger what should i do? Download the source and put a breakpoint inside real_init (https://github.com/vapoursynth/vapoursynth/blob/7c488b5d33991115e148da60b7afe30040da9245/src/vsscript/vsscript.cpp#L46) and see what fail?

Yes, that should work and give you the best information.

MonoS
28th October 2019, 16:52
Yes, that should work and give you the best information.

Ok, i'll try to take a look, but it will probably take me about a week as i'm currently doing an encode.

Myrsloik
28th October 2019, 23:12
R48-RC6 (https://github.com/vapoursynth/vapoursynth/releases/tag/R48-RC6)

Fixes premultiplied maskedmerge and a few expr problems that most likely were never encountered by anyone.

4 days without any bugs found! Final release when bug free for a whole week. Keep testing!

Patman
29th October 2019, 19:22
Hi,

R48 final based on python 3.7.x module? Which version of Vapoursynth will be based on python 3.8?

Gesendet von meinem HMA-L09 mit Tapatalk

Myrsloik
29th October 2019, 19:38
Hi,

R48 final based on python 3.7.x module? Which version of Vapoursynth will be based on python 3.8?

Gesendet von meinem HMA-L09 mit Tapatalk

Yes, it will use python 3.7.x. I'll switch to 3.8.x when cython adds official support for it.

Patman
29th October 2019, 19:41
Yes, it will use python 3.7.x. I'll switch to 3.8.x when cython adds official support for it.Thanks for the info.

Gesendet von meinem HMA-L09 mit Tapatalk

Myrsloik
31st October 2019, 23:07
R48 is released!

stax76
3rd November 2019, 15:52
Is there a particular reason why vsrepo downloaded files don't have original timestamps?

staxrip has packages with lost timestamps and I would like to recover them.

Myrsloik
3rd November 2019, 17:43
Is there a particular reason why vsrepo downloaded files don't have original timestamps?

staxrip has packages with lost timestamps and I would like to recover them.

Because the way I'm handling things it's kinda annoying to set them. And it's not like you can ever trust them anyway...

hydra3333
9th November 2019, 08:25
Yes, it will use python 3.7.x. I'll switch to 3.8.x when cython adds official support for it.

just checking,

does that mean the v48 portable version
will run under portable python 3.7.5 ?
but not 3.8.0 ?

l00t
9th November 2019, 09:09
just checking,

does that mean the v48 portable version
will run under portable python 3.7.5 ?
but not 3.8.0 ?

exactly

Jukus
20th November 2019, 15:58
What needs to be done to make a video have different FPS?
For example, I want to do something like that

from vapoursynth import core
import havsfunc as haf

clip = core.d2v.Source('index.d2v')
clip1 = core.std.Trim(clip, 0, 5579)
clip1 = haf.QTGMC(clip1, Preset='Very Slow', Sharpness=0.5, FPSDivisor=1, SourceMatch=3, Lossless=2, MatchEnhance=0.75, TFF=True)
clip2 = core.std.Trim(clip, 5580, 24186)
clip2 = haf.QTGMC(clip2, Preset='Very Slow', Sharpness=0.5, SourceMatch=3, MatchEnhance=0.75, InputType=1)
clip = clip1+clip2

clip.set_output()

but this code will not work correctly.

poisondeathray
20th November 2019, 17:12
What needs to be done to make a video have different FPS?
For example, I want to do something like that

from vapoursynth import core
import havsfunc as haf

clip = core.d2v.Source('index.d2v')
clip1 = core.std.Trim(clip, 0, 5579)
clip1 = haf.QTGMC(clip1, Preset='Very Slow', Sharpness=0.5, FPSDivisor=1, SourceMatch=3, Lossless=2, MatchEnhance=0.75, TFF=True)
clip2 = core.std.Trim(clip, 5580, 24186)
clip2 = haf.QTGMC(clip2, Preset='Very Slow', Sharpness=0.5, SourceMatch=3, MatchEnhance=0.75, InputType=1)
clip = clip1+clip2

clip.set_output()

but this code will not work correctly.




Internally in vapoursynth, it has to be CFR (constant frame rate)

1) You can duplicate frames and framerate in the second section (but same content speed). eg. by using core.std.Interleave

Or ,

2) you can temporarily assign a 2xFPS to the 2nd section using core.std.AssumeFPS to append sections (so it plays double speed), then use external timecodes (timestamps) method to make it VFR

DJATOM
20th November 2019, 18:57
Internally in vapoursynth, it has to be CFR (constant frame rate)
No. You can splice mixed fps clips, or even mixed resolution clips, vapoursynth can handle that. But encoding app might fail to understand such clip, that depends on what you're using.
I made x264 input filter and successfully provided vapoursynth timecodes (but code is a bit dirty), you can pick it here and compile: https://pastebin.com/QhjQ26qG

_Al_
22nd November 2019, 03:30
http://www.vapoursynth.com/doc/installation.html#installation-via-pip-pypi says that pip install should be done only after Vapoursynth is installed. So what is it for, or what is the purpose of that PIP installation?

MonoS
23rd November 2019, 13:49
Yes, that should work and give you the best information.

I've reinstalled my whole system so i am now on a clean OS.
Installed Python 3.7.5 for all user (so it is in "C:\Program Files\Python37" ), installed Vapoursynth R48 and it gives me the same error.

I've then started debuging and the line that is failing is the PyImport_ImportModule in vapoursynth_api.h (https://github.com/vapoursynth/vapoursynth/blob/7c488b5d33991115e148da60b7afe30040da9245/include/cython/vapoursynth_api.h#L113), the module returned is NULL.
Folder "Lib\site-packages", where i would put my script, is empty, would expect to find file "vapoursynth.pth" and the folder "vapoursynth" (checked in another system with R45), probably is that that is making VSPipe fails?

stax76
23rd November 2019, 21:13
Because the way I'm handling things it's kinda annoying to set them. And it's not like you can ever trust them anyway...

If both timestamps and module version info is missing (it's missing very often in my experience), what else do we have? The file size will be the only thing left and that isn't very much.

ChaosKing
23rd November 2019, 23:05
We have the hash...
https://github.com/vapoursynth/vsrepo/blob/master/local/fft3dfilter.json

MonoS
26th November 2019, 21:23
I've reinstalled my whole system so i am now on a clean OS.
Installed Python 3.7.5 for all user (so it is in "C:\Program Files\Python37" ), installed Vapoursynth R48 and it gives me the same error.

I've then started debuging and the line that is failing is the PyImport_ImportModule in vapoursynth_api.h (https://github.com/vapoursynth/vapoursynth/blob/7c488b5d33991115e148da60b7afe30040da9245/include/cython/vapoursynth_api.h#L113), the module returned is NULL.
Folder "Lib\site-packages", where i would put my script, is empty, would expect to find file "vapoursynth.pth" and the folder "vapoursynth" (checked in another system with R45), probably is that that is making VSPipe fails?

I think i fixed the issue downloading the portable version of Vapoursynth and putting the file vapoursynth.cp37-win_amd64.pyd inside the site-packages folder under Python37. Hope this could help you fix the problem.

Lypheo
27th November 2019, 16:28
core.resize.Bicubic(core.std.BlankClip(format=vs.YUV444PS), format=vs.RGB24, matrix_in=1, primaries_in=1, primaries=1) #errors out (Resize error 3074: invalid colorspace definition (1/2/1 => 0/2/1). May need to specify additional colorspace parameters.)
core.resize.Bicubic(core.std.BlankClip(format=vs.YUV444PS), format=vs.RGB24, matrix_in=1, primaries_in=1, primaries=1, transfer_in=1, transfer=1) #works
core.resize.Bicubic(core.std.BlankClip(format=vs.YUV444PS), format=vs.RGB24, matrix_in=1) #works

Seems like a bug to me. vsresize/zimg seems to think it needs to do a primary conversion when in and out primaries are specified (even when equal), and thus demands that the transfer function be specified. This causes the error mentioned above when previewing clips with vsedit (which calls vsresize internally, I presume) that ffms2 attached _Primaries != 2 and _Transfer = 2 to (this is the case for files which have a primaries flag but no transfer flag).

Richard1485
29th November 2019, 21:25
http://www.vapoursynth.com/doc/installation.html#installation-via-pip-pypi says that pip install should be done only after Vapoursynth is installed. So what is it for, or what is the purpose of that PIP installation?

I was wondering the same thing.

Myrsloik
29th November 2019, 22:09
I was wondering the same thing.

It's useful if you want to install vapoursynth into multiple python environments. The normal installer only lets you choose one.

Myrsloik
4th December 2019, 15:46
core.resize.Bicubic(core.std.BlankClip(format=vs.YUV444PS), format=vs.RGB24, matrix_in=1, primaries_in=1, primaries=1) #errors out (Resize error 3074: invalid colorspace definition (1/2/1 => 0/2/1). May need to specify additional colorspace parameters.)
core.resize.Bicubic(core.std.BlankClip(format=vs.YUV444PS), format=vs.RGB24, matrix_in=1, primaries_in=1, primaries=1, transfer_in=1, transfer=1) #works
core.resize.Bicubic(core.std.BlankClip(format=vs.YUV444PS), format=vs.RGB24, matrix_in=1) #works

Seems like a bug to me. vsresize/zimg seems to think it needs to do a primary conversion when in and out primaries are specified (even when equal), and thus demands that the transfer function be specified. This causes the error mentioned above when previewing clips with vsedit (which calls vsresize internally, I presume) that ffms2 attached _Primaries != 2 and _Transfer = 2 to (this is the case for files which have a primaries flag but no transfer flag).

You always need to specify both primaries and transfer. You can't do just one. It's how it works.

Lypheo
5th December 2019, 10:58
You always need to specify both primaries and transfer. You can't do just one. It's how it works.
Yes, I know, but this is about cases where the output primaries are equal to the input primaries (so no conversion is performed). Requiring the transfer parameters to be specified as well in that situation doesn’t make a lot of sense because they’re not needed at all.
Again, this isn’t just a hypothetical case of passing these particular arguments to resize manually: When you have a YCbCR clip that has _Primaries other than 2 but _Transfer == 2 (=undefined) and try to convert to RGB (or to preview with VSEdit), vsresize will throw this error: Resize error 3074: invalid colorspace definition (1/2/1 => 0/2/1). May need to specify additional colorspace parameters.
This behaviour is likely very confusing to the unsuspecting user (as it was to me), because in theory, matrix is all the colorspace parameters that should be needed for a YUV->RGB conversion.