View Full Version : Vapoursynth
dipje
10th January 2018, 12:18
maybe asking is faster than trying it later tonight:
Is the 'b64a' packing of RGB64 now also working with alpha? Or is it a dummy alpha, the same is in the compatbgr32 mode?
Myrsloik
10th January 2018, 12:23
maybe asking is faster than trying it later tonight:
Is the 'b64a' packing of RGB64 now also working with alpha? Or is it a dummy alpha, the same is in the compatbgr32 mode?
No, as I wrote it's only in vspipe for now. So only planar output like GBRAPX and YUVAPX will work. If enough people request it I guess I could extend it to avfs and vfw too. The compat formats will be removed some day when I make a major api revision so don't expect improvements to those ever.
Oh an one more quirk, far from all the common FOURCCs even have alpha so in those case setting an alpha output clip would have inconsistent results. And then there's v210 with 2 bits of alpha...
poisondeathray
10th January 2018, 16:27
It works like you guessed. If you check the info output from vspipe it also says "alpha: yes" or something similar.
This is the official R41 x64 ; vspipe --info reports no alpha (but clip[0] and clip[1] are valid separately)
Width: 1280
Height: 720
Frames: 90
FPS: 24/1 (24.000 fps)
Format Name: RGB24
Color Family: RGB
Sample Type: Integer
Bits: 8
SubSampling W: 0
SubSampling H: 0
Myrsloik
10th January 2018, 16:54
This is the official R41 x64 ; vspipe --info reports no alpha (but clip[0] and clip[1] are valid separately)
Width: 1280
Height: 720
Frames: 90
FPS: 24/1 (24.000 fps)
Format Name: RGB24
Color Family: RGB
Sample Type: Integer
Bits: 8
SubSampling W: 0
SubSampling H: 0
You're using an old vspipe. Maybe old other stuff too. R41 always has a line with Alpha: yes/no
poisondeathray
10th January 2018, 17:41
You're using an old vspipe. Maybe old other stuff too. R41 always has a line with Alpha: yes/no
I know stuff is moving fast, but it's from yesterday :)
Dated 2018-01-09
R41 from official
https://github.com/vapoursynth/vapoursynth/releases
, or should I go back to RC ?
EDIT: you are right . I messed up vspipe versions, called the wrong one
So if it passes to the alpha, how do you use it with something like ffmpeg ? can I pipe rawvideo and specify the arguments in ffmpeg (since yuv4mpegpipe won't work)
Myrsloik
10th January 2018, 17:45
I know stuff is moving fast, but it's from yesterday :)
Dated 2018-01-09
R41 from official
https://github.com/vapoursynth/vapoursynth/releases
, or should I go back to RC ?
Just delete all copies of vspipe.exe and reinstall. I checked again and you're definitely using an older exe.
poisondeathray
10th January 2018, 17:53
^ Yes, you're right .I edited my post. Can you answer the 2nd question please ?
What -pix_fmt in ffmpeg ? Or can you show a usage example ?
poisondeathray
10th January 2018, 17:56
Ok , it's -pix_fmt gbrap ; apparently GBRAP (caps) doesn't work
Everything working now
Usage example for piping 8bit RGB with alpha to ffmpeg to write out a PNG sequence (in case other ppl get stuck)
#clip[0].set_output(alpha=clip[1]) #alpha clip specified in script
#since it's a rawvideo pipe, you need to specify dimensions, frame rate (I guess not for image sequence, but left it in for completeness in case you're writing an RGBA video), pixel format
vspipe script.vpy - | ffmpeg -f rawvideo -pix_fmt gbrap -s 1280x720 -r 24 -i - -c:v png -an -start_number 0 output%03d.png
dipje
10th January 2018, 18:13
I compiled r41 on Mac osx . I have a weird thing I didn't have with r40: vspipe keeps 'hanging' at the end of a video.
Instead of exiting and letting ffmpeg (I'm piping y4m yuv444p10 and plain rgb30 into ffmpeg) finish graceful, it just sits there doing nothing.
In vsedit when I try (benchmark) the script, it gives warnings at the end that it can't read all the frames.
But it did this in r40 as well and didn't have try hanging vspipe issue.
Source is a .webm from YouTube with ffms2000. I tried pulling the latest master from the ffms2000 branch and compiled it, but no luck.
Am I the only one ? If so, I'll dig a bit deeper if it's vapoursynth, the Mac, the source filter or the source :).
poisondeathray
10th January 2018, 18:49
I compiled r41 on Mac osx . I have a weird thing I didn't have with r40: vspipe keeps 'hanging' at the end of a video.
Instead of exiting and letting ffmpeg (I'm piping y4m yuv444p10 and plain rgb30 into ffmpeg) finish graceful, it just sits there doing nothing.
In vsedit when I try (benchmark) the script, it gives warnings at the end that it can't read all the frames.
But it did this in r40 as well and didn't have try hanging vspipe issue.
Source is a .webm from YouTube with ffms2000. I tried pulling the latest master from the ffms2000 branch and compiled it, but no luck.
Am I the only one ? If so, I'll dig a bit deeper if it's vapoursynth, the Mac, the source filter or the source :).
This works for me OK to completion on a random YT VP9 webm . Upscaled to format=vs.YUV444P10. ffms2000 test8 . Win8 x64. R41
Did you try another webm? maybe problem with that specific one ?
hydra3333
13th January 2018, 23:13
R41 released. The usual post about it (http://www.vapoursynth.com/2018/01/r41-less-leaking/). Have fun with {} alpha support.
Thank you.
hydra3333
13th January 2018, 23:14
Using Vapoursynth to try to process a UHD video
script is
error report
Error Video encoding using NVEnc 3.23 (1.7.0.4)
Video encoding using NVEnc 3.23 failed with exit code: -1073741819 (0xC0000005)
The exit code might be a system error code: The instruction at 0xp referenced memory at 0xp. The memory could not be s.
------------------- Video encoding using NVEnc 3.23 -------------------
"C:\Program Files (Portable)\StaxRip\Apps\NVEnc\NVEncC64.exe" --vbrhq 38400 --codec h265 --preset quality --level 5.1 --output-depth 10 --weightp --ref 5 --gop-len 24 --lookahead 32 --qp-init 1 --max-bitrate 38400 --vbr-quality 25 --aq --cuda-schedule auto --colormatrix bt2020nc --colorprim bt2020 --transfer smpte2084 --mv-precision q-pel --cabac -i "W:\TEMP\KONG SKULL ISLAND_temp\KONG SKULL ISLAND.vpy" -o "W:\TEMP\KONG SKULL ISLAND_temp\KONG SKULL ISLAND_out.h265"
StaxRip.ErrorAbortException: Video encoding using NVEnc 3.23 failed with exit code: -1073741819 (0xC0000005)
The exit code might be a system error code: The instruction at 0xp referenced memory at 0xp. The memory could not be s.
------------------- Video encoding using NVEnc 3.23 -------------------
"C:\Program Files (Portable)\StaxRip\Apps\NVEnc\NVEncC64.exe" --vbrhq 38400 --codec h265 --preset quality --level 5.1 --output-depth 10 --weightp --ref 5 --gop-len 24 --lookahead 32 --qp-init 1 --max-bitrate 38400 --vbr-quality 25 --aq --cuda-schedule auto --colormatrix bt2020nc --colorprim bt2020 --transfer smpte2084 --mv-precision q-pel --cabac -i "W:\TEMP\KONG SKULL ISLAND_temp\KONG SKULL ISLAND.vpy" -o "W:\TEMP\KONG SKULL ISLAND_temp\KONG SKULL ISLAND_out.h265"
at StaxRip.Proc.Start() in D:\Projekte\VS\VB\StaxRip\General\Proc.vb:line 338
at StaxRip.NVEnc.Encode() in D:\Projekte\VS\VB\StaxRip\Encoding\NVEnc.vb:line 82
at StaxRip.GlobalClass.ProcessVideo() in D:\Projekte\VS\VB\StaxRip\General\GlobalClass.vb:line 225
at System.Threading.Tasks.Parallel.<>c__DisplayClass4_0.<Invoke>b__0()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at StaxRip.GlobalClass.ProcessJob(String jobPath) in D:\Projekte\VS\VB\StaxRip\General\GlobalClass.vb:line 137
If I run
Through the command line The error is Vapoursynth failed to open input file
Any ideas?
No, not me :) I wonder, does it work under r41 ?
gonca
14th January 2018, 00:16
No, not me :) I wonder, does it work under r41 ?
Version of NVEncC was the problem
Versions after the one I was using work fine
hydra3333
14th January 2018, 00:44
OK, thank gonca. Not a Vs related issue then.
Myrsloik
14th January 2018, 19:05
R42 RC1 (https://www.dropbox.com/s/s5cfxesyd2hat0j/VapourSynth-R42-RC1.exe?dl=1)
R42 RC1 this soon because of a regression that makes player integration like mpv fail. Report if it works or not.
r42:
updated to zimg v2.7.1
vapoursynth.dll is now simply symlinked into the python directory, makes it less confusing to replace the dll since there's only one real copy
fixed regression introduced in r41 that would make setting a node using vsscript_setvariable silently fail
resize no longer pointlessly copies frames when no processing is needed (that dude)
optimized transpose filter even more (that dude)
Myrsloik
15th January 2018, 19:59
R42 released. No changes from RC1.
AzraelNewtype
17th January 2018, 00:19
Since somebody still hasn't pointed this out, there's also a R42.1, which most certainly has changed from RC1.
no1d
18th January 2018, 17:41
Is get_output returns two nodes now?
Myrsloik
18th January 2018, 18:22
Is get_output returns two nodes now?
Yes, it returns a tuple of main video and alpha
Myrsloik
21st January 2018, 14:10
R43 RC1 (https://www.dropbox.com/s/y5bgk59jmrqwktw/VapourSynth-R43-RC1.exe?dl=1)
r43:
updated to zimg v2.7.2
fixed a possible hang on error in vspipe, regression introduced with the alpha support in r41
Go test it. Not much changed but should fix all serious issues reported.
kolak
25th January 2018, 13:19
It does work better now.
hydra3333
26th January 2018, 04:03
Thank you Myrsloik, for your great work.
Myrsloik
26th January 2018, 13:14
R43-RC2 (https://www.dropbox.com/s/hlg298urritog5j/VapourSynth-R43-RC2.exe?dl=1)
r43:
updated to zimg v2.7.2
a tuple is now only returned from get_output in python when alpha actually exist, this undoes the python syntax change in r41
fixed a possible hang on error in vspipe, regression introduced with the alpha support in r41
Second and probably final RC. Should restore the final stuff broken in R41. Go test it.
feisty2
26th January 2018, 15:05
I wanna remove useless samples in my training set, the ones that don't have enough high frequency components
lemme rephrase that, after I extracted the high frequency components from each frame, I wanna remove frames whose standard deviation is below a certain threshold, and record which frames were removed in a log file, then read the log file and remove the same frames in another sequence, how do I do that?
WolframRhodium
26th January 2018, 16:20
remove frames whose standard deviation is below a certain threshold, and record which frames were removed in a log file, then read the log file and remove the same frames in another sequence
The following method is 2-pass:
1st pass:
mvf.PlaneStatistics (https://github.com/HomeOfVapourSynthEvolution/mvsfunc/blob/master/mvsfunc.py#L1200-L1318) shows the method of calculating the std.
A Python list can be created outside the runtime function, then once the std of each frame inside the runtime function is calculated, the list is used to store the label.
The std of the whole video can be calculated via vspipe or simply vsedit's benchmark.
And then the list is stored in the disk.
2nd pass:
core.std.DeleteFrames (http://www.vapoursynth.com/doc/functions/deleteframes.html) can be used to delete those frames after reading the list.
lansing
26th January 2018, 18:14
I wanna remove useless samples in my training set, the ones that don't have enough high frequency components
lemme rephrase that, after I extracted the high frequency components from each frame, I wanna remove frames whose standard deviation is below a certain threshold, and record which frames were removed in a log file, then read the log file and remove the same frames in another sequence, how do I do that?
Are you doing the write and read log in one script.
poisondeathray
26th January 2018, 18:19
how are you extracting / measuring / distinguishing between what is a "high frequency component" ?
feisty2
26th January 2018, 18:31
The following method is 2-pass:
1st pass:
mvf.PlaneStatistics (https://github.com/HomeOfVapourSynthEvolution/mvsfunc/blob/master/mvsfunc.py#L1200-L1318) shows the method of calculating the std.
A Python list can be created outside the runtime function, then once the std of each frame inside the runtime function is calculated, the list is used to store the label.
The std of the whole video can be calculated via vspipe or simply vsedit's benchmark.
And then the list is stored in the disk.
2nd pass:
core.std.DeleteFrames (http://www.vapoursynth.com/doc/functions/deleteframes.html) can be used to delete those frames after reading the list.
seems like a lot of trouble but... gonna try it
I hate coding
feisty2
26th January 2018, 18:32
Are you doing the write and read log in one script.
one script or separate scripts, either way works for me long as its simple enough
feisty2
26th January 2018, 18:41
how are you extracting / measuring / distinguishing between what is a "high frequency component" ?
u run a high pass filter (low pass filter + make dif) on ur clip and extract the high frequency components, it doesn't have to be extra accurate, I'm just removing useless image blocks from my super resolution neural net training set, image blocks without clear edges or fine details or textures are obviously garbage data to super resolution, they are doing nothing but wasting my training time, after u extracted the high frequencies, u calculate the standard deviation or the absolute or squared sum of the high frequencies to determine if a certain sample has enough amount of high frequencies for super resolution or not
lansing
26th January 2018, 19:58
Don't post attachment, admins are all dead, nobody will approve it.
LigH
26th January 2018, 21:28
If it is short, use the CODE bbCode block; if it is longer, use any pastebin service (many have syntax highlighting for programming languages).
I am sure Wikipedia once had a comparison chart of such services, but it seems to be gone.
lansing
27th January 2018, 00:40
A Python list can be created outside the runtime function, then once the std of each frame inside the runtime function is calculated, the list is used to store the label.
Looping through every frame of the video to store the frame property into a list has a huge time issue.
filter_list = [] # list to store hi freq frame numbers
for frame in clip.frames():
frame_std = frame.props['PlaneSTD']
frame_num = frame.props['FrameNum']
if frame_std > 0.0031: # std threshold
if frame_num not in filter_list:
filter_list.append(frame_num)
My loop here took about 5 minutes to instantiate on a 720p 24 minutes video.
WolframRhodium
27th January 2018, 01:39
Looping through every frame of the video to store the frame property into a list has a huge time issue.
filter_list = [] # list to store hi freq frame numbers
for frame in clip.frames():
frame_std = frame.props['PlaneSTD']
frame_num = frame.props['FrameNum']
if frame_std > 0.0031: # std threshold
if frame_num not in filter_list:
filter_list.append(frame_num)
My loop here took about 5 minutes to instantiate on a 720p 24 minutes video.
Try the runtime function
filter_list = []
def _PlaneStd(n, f, clip):
frame_std = frame.props['PlaneSTD']
if frame_std > 0.0031:
filter_list.append(str(n))
if n == clip.num_frames - 1:
outFile = open('a.txt', 'w+')
outFile.write('{}'.format("".join(filter_list)))
return clip
clip = core.std.FrameEval(clip functools.partial(_PlaneStd, clip=clip), prop_src=clip)
or maybe the bottleneck is at file reading?
Myrsloik
27th January 2018, 01:43
I'm not sure that script will always work properly. Frames can be (and commonly are) processed out of order. Just saying...
Since we're on the subject I'm planning to add support for writing frame properties to a file in vspipe. Unfortunately for you I didn't get around to implementing it yet. Also, using get_frame() in python is always slow, it basically forces single threading.
lansing
27th January 2018, 03:01
Try the runtime function
filter_list = []
def _PlaneStd(n, f, clip):
frame_std = frame.props['PlaneSTD']
if frame_std > 0.0031:
filter_list.append(str(n))
if n == clip.num_frames - 1:
outFile = open('a.txt', 'w+')
outFile.write('{}'.format("".join(filter_list)))
return clip
clip = core.std.FrameEval(clip functools.partial(_PlaneStd, clip=clip), prop_src=clip)
or maybe the bottleneck is at file reading?
I thought it was a bad practice to mutate data that was outside the scope of a standalone function.
feisty2
28th January 2018, 04:38
well thank u all, I got it worked out alright now
Myrsloik
29th January 2018, 20:43
R43 RC4 (https://www.dropbox.com/s/k62zsj96ndqq1cz/VapourSynth-R43-RC4.exe?dl=1)
One final RC (for real this time) since many small nitpicky things were discovered.
r43:
updated to zimg v2.7.2
all vsscript functions are now internally guarded by a mutex to make them threadsafe
changed boxblur defaults to hradius and vradius=1, this makes more sense than having it throw an error with default arguments
added xyz as an alias for st428 in resize
add vsscript_getvsapi2 function which takes the required vapoursynth api version into account
a tuple is now only returned from get_output in python when alpha actually exist, this undoes the python syntax change in r41
fixed a possible hang on error in vspipe, regression introduced with the alpha support in r41
monohouse
31st January 2018, 11:33
hi I just installed (on windows) vapor R42.1 with python but no matter how I do it I always get the error:
c:\Program Files (x86)\Python36-32>VSPipe.exe --info G:\test.vpy -
Failed to initialize VapourSynth environment
python is installed, I had both 32 and 64, I also tried to use the portable vapor - it give the same error
Myrsloik
31st January 2018, 11:34
hi I just installed (on windows) vapor R42.1 with python but no matter how I do it I always get the error:
c:\Program Files (x86)\Python36-32>VSPipe.exe --info G:\test.vpy -
Failed to initialize VapourSynth environment
python is installed, I had both 32 and 64, I also tried to use the portable vapor - it give the same error
Let me guess, you didn't install all windows updates...
monohouse
31st January 2018, 11:37
it windows 7 SP1
Myrsloik
31st January 2018, 11:38
it windows 7 SP1
With all updates installed?
monohouse
31st January 2018, 11:50
with none updates installed :x no wait...platform update installed and directx11 update also installed, manually
but to what update are you refering ? I can dunlawd him and install him manually
KB976932 ?
Myrsloik
31st January 2018, 20:58
with none updates installed :x no wait...platform update installed and directx11 update also installed, manually
but to what update are you refering ? I can dunlawd him and install him manually
KB976932 ?
I don't remember exactly. Unpatched windows 7 isn't supported, it's that simple.
Myrsloik
31st January 2018, 20:58
R43 released (http://www.vapoursynth.com/2018/01/r43-cleaning-up-the-remaining-mess-from-r41/).
monohouse
1st February 2018, 15:44
ok I floted this bote :)
but still need some help, what's this meens ?
C:\VapourSynth\core64>vspipe.exe --info W:\test.vpy -
Failed to retrieve output node. Invalid index specified?
Myrsloik
1st February 2018, 15:49
ok I floted this bote :)
but still need some help, what's this meens ?
C:\VapourSynth\core64>vspipe.exe --info W:\test.vpy -
Failed to retrieve output node. Invalid index specified?
You probably forgot set_output() in your test script.
monohouse
1st February 2018, 17:04
I got it all working :)
thank for fast reply
thank for help
most important: thank for vaporsynth :)
hydra3333
2nd February 2018, 03:59
R43 released (http://www.vapoursynth.com/2018/01/r43-cleaning-up-the-remaining-mess-from-r41/).
By reading the handy instructions, I got a successfully completed build using the latest vs2017 with latest python and avisynth from git and zimg from git and vapoursynth from git with a small mod to AvsCompat (although it somewhere mentioned "RC2" as a version, so I hope I haven't stuffed it up).
Thank you for your great work.
monohouse
2nd February 2018, 11:16
if I wanne load into vapor raw YV12 file, I use avisource to do it ?
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.