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 27th December 2019, 16:25   #3661  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
I wish Visual Studio project files were included in the source, so I can use 'Go to document' and 'Go to definition' in order to understand the code. Right now I'm looking at vsvfw.cpp and want to know which header declares IUnknown. Maybe I have to try creating a project file.
stax76 is offline   Reply With Quote
Old 27th December 2019, 16:33   #3662  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by stax76 View Post
I wish Visual Studio project files were included in the source, so I can use 'Go to document' and 'Go to definition' in order to understand the code. Right now I'm looking at vsvfw.cpp and want to know which header declares IUnknown. Maybe I have to try creating a project file.
They are included: msvc_project/vapoursynth.sln

IUnknown is obviously from a system COM header.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 27th December 2019, 16:41   #3663  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
Sorry, I overlooked it. I'm not very good in C++ right now, first C++ project after over ten years.

Last edited by stax76; 27th December 2019 at 17:41.
stax76 is offline   Reply With Quote
Old 28th December 2019, 21:49   #3664  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Audio support is almost done
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 28th December 2019, 22:10   #3665  |  Link
yoon
Registered User
 
Join Date: Feb 2018
Posts: 5
Quote:
Originally Posted by _Al_ View Post
Not sure if I understand, do you want to encode each cropped clip separately?
You can use vspipe --outputindex to specify what output to process
Code:
import vapoursynth as vs
from vapoursynth import core

clip = core.lsmas.LWLibavSource(source=r'clip.mkv')
clip = core.std.Trim(clip, 0, 59)
clip = core.resize.Bicubic(clip, 600,340)

new_resolution = (clip.width/2, clip.height/2)

clip1 = core.std.CropAbs(clip, *new_resolution, top=0, left=0,          )             #Top Left
clip2 = core.std.CropAbs(clip, *new_resolution, top=0, left=clip.width/2)             #Top Right
clip3 = core.std.CropAbs(clip, *new_resolution, top=clip.height/2, left=0)            #Bottom Left
clip4 = core.std.CropAbs(clip, *new_resolution, top=clip.height/2, left=clip.width/2) #Bottom Right

clip1.set_output(1)
clip2.set_output(2)
clip3.set_output(3)
clip4.set_output(4)

clip = clip1 + clip2 + clip3 + clip4
clip.set_output() #if not stated , default is zero: clip.set_output(0)
and when using command line:
vspipe --y4m your_script.vpy - | ffmpeg -f yuv4mpegpipe .. ....default is output zero
vspipe --outputindex 1 --y4m your_script.vpy - | ffmpeg -f yuv4mpegpipe ....... for clip1
vspipe --outputindex 2 --y4m your_script.vpy - | ffmpeg -f yuv4mpegpipe ....... etc for each output

odd video dimensions cannot be used here, it has to be at least even, (mod 2). In Vapoursynth it depends on video subsampling.
Thank you for your answer, I didn't know that outputindex option existed. That's great. Will try it this way.
yoon is offline   Reply With Quote
Old 29th December 2019, 10:57   #3666  |  Link
jmartinr
Registered User
 
jmartinr's Avatar
 
Join Date: Dec 2007
Location: Enschede, NL
Posts: 301
__________________
Roelofs Coaching
jmartinr is offline   Reply With Quote
Old 29th December 2019, 13:10   #3667  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
Quote:
Audio support is almost done
Nice, hoping to view the wave front of an input file to find the audio delay of some files.
Thanks!

Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 29th December 2019, 13:53   #3668  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by Selur View Post
Nice, hoping to view the wave front of an input file to find the audio delay of some files.
Thanks!

Cu Selur
Only trim, splice and raw pcm output from vspipe is planned for the first test version. There's however one little problem...

All existing audio sources suck so I'll probably have to improve FFMS2 first.

Feel free to start implementing audio plugins using the doodle1 branch. The API is conceptually stable (but tweaks will definitely be made).
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 29th December 2019, 14:37   #3669  |  Link
Jukus
Registered User
 
Join Date: Jul 2019
Location: Russia
Posts: 87
@Myrsloik
What about variable fps?
Jukus is offline   Reply With Quote
Old 29th December 2019, 15:04   #3670  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by Jukus View Post
@Myrsloik
What about variable fps?
What about you asking a complete question?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 30th December 2019, 05:19   #3671  |  Link
Jukus
Registered User
 
Join Date: Jul 2019
Location: Russia
Posts: 87
Quote:
Originally Posted by Myrsloik View Post
What about you asking a complete question?
VS does not support variable FPS for output, will it be implemented?

Last edited by Jukus; 30th December 2019 at 05:30.
Jukus is offline   Reply With Quote
Old 30th December 2019, 08:22   #3672  |  Link
Lypheo
Registered User
 
Join Date: Sep 2018
Posts: 14
Quote:
Originally Posted by Jukus View Post
VS does not support variable FPS for output, will it be implemented?
It does, though? Just have vspipe write the timestamp file with --timecodes and mux it in (or pass it to x264 or whatever).

Quote:
Only trim, splice and raw pcm output from vspipe is planned for the first test version. There's however one little problem...

All existing audio sources suck so I'll probably have to improve FFMS2 first.

Feel free to start implementing audio plugins using the doodle1 branch. The API is conceptually stable (but tweaks will definitely be made).
Can we expect a test build soon or not until you’re done fixing ffms2?
Lypheo is offline   Reply With Quote
Old 30th December 2019, 09:50   #3673  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by Lypheo View Post
It does, though? Just have vspipe write the timestamp file with --timecodes and mux it in (or pass it to x264 or whatever).



Can we expect a test build soon or not until you’re done fixing ffms2?
There needs to be at least one decent source filter for audio or there won't be much to test really...
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 1st January 2020, 01:30   #3674  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
I can't figure this out on Windows 10.

1. I installed Python using Anaconda (e:\anaconda3)
2. Installed Vapoursynth (all users) (e:\vapoursynth)

python myscript.vpy works fine!
Code:
import vapoursynth as vs
from vapoursynth import core

print(core.version())
clip = core.std.BlankClip(format=vs.RGB24, color=[0, 0, 0])
clip.set_output()
vspipe and vsedit don't work.

vspipe --info myscript.vpy -

Setting PythonPath in registry to "e:\anaconda3" gives:

Failed to initialize VapourSynth environment

Setting PythonPath to "" gives:

Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00008fdc (most recent call first):


Registry entries:
Code:
Key Name:          HKEY_LOCAL_MACHINE\SOFTWARE\VapourSynth
Class Name:        <NO CLASS>
Last Write Time:   12/31/2019 - 4:26 PM
Value 0
  Name:            Version
  Type:            REG_SZ
  Data:            48

Value 1
  Name:            Path
  Type:            REG_SZ
  Data:            e:\vapoursynth

Value 2
  Name:            CorePlugins
  Type:            REG_SZ
  Data:            e:\vapoursynth\core\plugins

Value 3
  Name:            Plugins
  Type:            REG_SZ
  Data:            e:\vapoursynth\plugins

Value 4
  Name:            VapourSynthDLL
  Type:            REG_SZ
  Data:            e:\vapoursynth\core\vapoursynth.dll

Value 5
  Name:            VSScriptDLL
  Type:            REG_SZ
  Data:            e:\vapoursynth\core\vsscript.dll

Value 6
  Name:            VSPipeEXE
  Type:            REG_SZ
  Data:            e:\vapoursynth\core\vspipe.exe

Value 7
  Name:            VSRepoPY
  Type:            REG_SZ
  Data:            e:\vapoursynth\vsrepo\vsrepo.py

Value 8
  Name:            PythonPath
  Type:            REG_SZ
  Data:            e:\anaconda3
Created a batch file clearing all environment variables except for path, systemdrive and systemroot.
No change, same problem.

Last edited by Cary Knoop; 1st January 2020 at 01:33.
Cary Knoop is offline   Reply With Quote
Old 5th January 2020, 19:54   #3675  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
I wrote some syntactic sugar stuff for the C++ API here: https://github.com/IFeelBloated/vapo...ster/sugar.hpp
C++2a support is required (I'm 100% sure C++17 aint cuttin' it), it compiles with "-std=c++2a" for GCC10

you can use
Code:
auto MakePlane(auto Pointer, auto Width, auto Height, auto PaddingPolicy)
to access the plane in a 2-dimensional style, out-of-bound access (automatic padding) is allowed for the source plane, but not allowed for the destination plane.

I'll give you a concrete example, to write a 3x3 box blur, you would do the following:
Code:
auto srcp = reinterpret_cast<const float *>(srcp8);
auto dstp = reinterpret_cast<float *>(dstp8);

auto padded_src = reinterpret_cast<float *>(malloc((width+2) * (height+2) * sizeof(float)));
for (auto y : Range{ height })
     std::memcpy(padded_src + (y+1) * (width+2) + 1, srcp + y * width, width * sizeof(float));

// lots of code here to deal with padding for "padded_src"

auto gc_addr = padded_src;
padded_src += (width + 2) + 1;

for (auto y : Range{ height })
     for (auto x : Range{ width }) {
             auto above = padded_src - (width + 2);
             auto below = padded_src + (width + 2);
             dstp[x] = (above[x-1] + above[x] + above[x+1] + padded_src[x-1] + padded_src[x] + padded_src[x+1] + below[x-1] + below[x] + below[x+1]) / 9;
             dstp += width;
             padded_src += width + 2;
     }

free(gc_addr);
with "sugar.hpp", that huge pile of nuisance is equivalent to simply
Code:
auto srcp = MakePlane<const float>(srcp8, width, height, Repeat);
auto dstp = MakePlane<float>(dstp8, width, height, Zero);

for (auto y : Range{ height })
     for (auto x : Range{ width })
             dstp[y][x] = (srcp[y-1][x-1] + srcp[y-1][x] + srcp[y-1][x+1] + srcp[y][x-1] + srcp[y][x] + srcp[y][x+1] + srcp[y+1][x-1] + srcp[y+1][x] + srcp[y+1][x+1]) / 9;
             // possible out-of-bound access like "srcp[y-1][x-1]" is automatically handled here with the given padding policy, you got nothing to worry about
The header includes 3 pre-defined padding policies
Code:
Zero
Repeat (or simply called "pad" on this forum)
Reflect
however, you can also define your own padding policy by completing the following function and pass it to "MakePlane()"
Code:
auto PaddingFunction = [](auto Canvas, auto Width, auto Height, auto y, auto x) {
      ...
};
note that the "PaddingPolicy" argument has no effect on "dstp" as no padding is applied here.

you are welcome to leave a comment if you have any suggestions or ideas to further improve this.

Last edited by feisty2; 6th January 2020 at 11:45.
feisty2 is offline   Reply With Quote
Old 5th January 2020, 20:05   #3676  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
simple live demonstration: https://godbolt.org/z/MHebt8
feisty2 is offline   Reply With Quote
Old 8th January 2020, 15:50   #3677  |  Link
Jukus
Registered User
 
Join Date: Jul 2019
Location: Russia
Posts: 87
How to properly process the video where 3 progressive frames, 2 interlaced and it turns out that every 5 frame is a duplicate?
Jukus is offline   Reply With Quote
Old 8th January 2020, 18:50   #3678  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,718
Quote:
Originally Posted by Jukus View Post
How to properly process the video where 3 progressive frames, 2 interlaced and it turns out that every 5 frame is a duplicate?
Standard IVTC? VFM to match fields followed by VDecimate to drop the dupes.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 11th January 2020, 17:18   #3679  |  Link
PlazzTT
Registered User
 
PlazzTT's Avatar
 
Join Date: Jan 2002
Location: -
Posts: 115
I'm getting this error when compiling Vapoursynth on Linux (Mint 19.3)

I installed cython through pip.

"which cython" gives "/home/me/.local/bin/cython"

Quote:
...
CXXLD libremovegrain.la
CC src/filters/vinverse/libvinverse_la-vinverse.lo
CCLD libvinverse.la
CC src/filters/vivtc/libvivtc_la-vivtc.lo
CCLD libvivtc.la
CYTHON src/cython/vapoursynth.c
/bin/bash: cython: command not found
Makefile:2217: recipe for target 'src/cython/vapoursynth.c' failed
make: *** [src/cython/vapoursynth.c] Error 127
Any ideas how to fix this?

Last edited by PlazzTT; 11th January 2020 at 17:24.
PlazzTT is offline   Reply With Quote
Old 11th January 2020, 20:53   #3680  |  Link
Jukus
Registered User
 
Join Date: Jul 2019
Location: Russia
Posts: 87
By the way, to the page:
http://www.vapoursynth.com/doc/insta...-from-packages
May be added that there is a ready-made solution for Debian:
https://www.deb-multimedia.org/

And, apparently, remove the link to packages for Ubuntu.

Last edited by Jukus; 11th January 2020 at 20:58.
Jukus 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 11:53.


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