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

groucho86
18th December 2019, 21:02
invalid colorspace definition (1/2/1 => 0/2/1)

What is the order of these numbers? Transfer / Matrix / Primaries ?

I'm getting the error as well, even though I'm not explicitly using the resize function:
File "script.py", line 329, in write_img
print(clip.get_frame(0).props)
File "src/cython/vapoursynth.pyx", line 1244, in vapoursynth.VideoNode.get_frame
vapoursynth.Error: Resize error: Resize error 3074: invalid colorspace definition (1/2/1 => 0/2/1). May need to specify additional colorspace parameters.

Pat357
23rd December 2019, 01:10
Are you converting YUV -> RGB somewhere ? Like writing frames from a YUV-clip to RGB-images using "write_img" ?
You're not running vspipe or any other piping and do not use clip.set_output, are you ?
Just plain python.. ? correct ?

I guess it's Matrix /Transfer / Primaries.
I guess VS is complaining because you're going from matrix=1 (=709) to matrix=0 (=RGB) with undef for Transfer, but 1 for primaries.
It would have been no problem if the primaries were also undef (2), but now you 've to specify the other colorspace info as wel.

Please correct me if I'm wrong with this.

groucho86
23rd December 2019, 15:28
Are you converting YUV -> RGB somewhere ? Like writing frames from a YUV-clip to RGB-images using "write_img" ?
You're not running vspipe or any other piping and do not use clip.set_output, are you ?
Just plain python.. ? correct ?

I guess it's Matrix /Transfer / Primaries.
I guess VS is complaining because you're going from matrix=1 (=709) to matrix=0 (=RGB) with undef for Transfer, but 1 for primaries.
It would have been no problem if the primaries were also undef (2), but now you 've to specify the other colorspace info as wel.

Please correct me if I'm wrong with this.

Hi Pat357, you're correct - pure python, no vspipe. Going from YUV to RGB, but also potentially staying in YUV. Here's an H.264 sample rendered out of Resolve (.mov ProRes and DNxHD react the same way):
https://www.mediafire.com/file/gzacc9ges2yk0cm/bars_h264.mov/file

Reproduced the issue in vsedit. This fails:
import vapoursynth as vs
core = vs.get_core()

clip = core.ffms2.Source(source='bars_h264.mov')

clip = core.text.FrameProps(clip)

clip.set_output()

My workaround for now:
import vapoursynth as vs
core = vs.get_core()

clip = core.ffms2.Source(source='bars_h264.mov')

clip = core.text.FrameProps(clip)

if clip.get_frame(0).props['_Transfer'] == 2:
clip = core.std.SetFrameProp(clip, prop="_Transfer", intval=1)

clip.set_output()

Same behavior with LibavSMASHSource. Is there a more elegant way of dealing with it?

Lypheo
23rd December 2019, 15:53
Seems like this is the exact issue I talked about a earlier (or rather a consequence of it), namely zimg requiring the transfer func to be specified too when the primaries are given (even implicitly as frame properties) despite it not being needed at all for the conversion.

yoon
23rd December 2019, 18:06
Hi,

I want to crop a video into four parts and separate each part into its own video. It would be like:

clip.mkv -> Crop Top Left -> clip1.mkv
clip.mkv -> Crop Top Right -> clip2.mkv
clip.mkv -> Crop Bottom Left -> clip3.mkv
...

So far, the cropping seems to be fine, but I don't know how to cut the frames and output multiple files, instead of one.

This is my script:

import vapoursynth as vs

core = vs.get_core()

clip = core.lsmas.LWLibavSource(source=r'clip.mkv')

clip = core.std.Trim(clip, 0, 59)

clip = core.fmtc.resample(clip, w=600, h=338, css="444", kernel="spline36")
clip = core.fmtc.bitdepth(clip, bits=8)

h = clip.height

h_n = h // 2

clip1 = core.std.CropAbs(clip, x=0, y=0, width=299, height=h_n-0.5) #Top Left
clip2 = core.std.CropAbs(clip, x=300, y=0, width=299, height=h_n-0.5) #Top Right
clip3 = core.std.CropAbs(clip, x=0, y=h_n+0.5, width=299, height=h_n-0.5) #Bottom Left
clip4 = core.std.CropAbs(clip, x=300, y=h_n+0.5, width=299, height=h_n-0.5) #Bottom Right

clip = clip1 + clip2 + clip3 + clip4

clip.set_output()
Is there a simple way to do this?

Pat357
23rd December 2019, 18:52
https://www.mediafire.com/file/gzacc9ges2yk0cm/bars_h264.mov/file

Reproduced the issue in vsedit. This fails:
import vapoursynth as vs
core = vs.get_core()

clip = core.ffms2.Source(source='bars_h264.mov')

clip = core.text.FrameProps(clip)

clip.set_output()


Same behavior with LibavSMASHSource. Is there a more elegant way of dealing with it?

Yes, maybe you shouldn't use VSEdit to view the VPY files. ;-) For viewing with VSEdit, a conversion from YUV to RGB is needed.
Without your workaround, you can still open the .VPY file in anything that understands YUV : VirtualDub, or any mediaplayer like MPC-HC, MPV, FFplay, ...
Also encoding works without the work-around as all encoders understand YUV.

poisondeathray
24th December 2019, 20:06
Here's an H.264 sample rendered out of Resolve (.mov ProRes and DNxHD react the same way



Another approach would be to tag all 3 matrix/transfer/primaries .

Note that was a change in Resolve 16.x behavior from previous . Older versions tagged all 3 by default. There is some discussion about this on the Resolve forum, and you can see it tags differently depending on the timeline settings
https://forum.blackmagicdesign.com/viewtopic.php?f=21&t=101253


Or you can also do it afterwards , for AVC, HEVC, or Prores with ffmpeg bitstream filters without re-encoding . But there isn't one for DNxHD/DNxHR

https://ffmpeg.org/ffmpeg-bitstream-filters.html#h264_005fmetadata
https://ffmpeg.org/ffmpeg-bitstream-filters.html#hevc_005fmetadata
https://ffmpeg.org/ffmpeg-bitstream-filters.html#prores_005fmetadata

groucho86
24th December 2019, 21:11
Another approach would be to tag all 3 matrix/transfer/primaries .

Note that was a change in Resolve 16.x behavior from previous . Older versions tagged all 3 by default.

Aha, that explains it! I'm now on Resolve 16.1.2 and was on 15.3.1 for quite a while. Thanks for the explanation!

I've occasionally used BBC's tool as well:
https://github.com/bbc/qtff-parameter-editor

Selur
26th December 2019, 07:34
Can someone with MSVC 2017 or 2019 compile a static version of https://github.com/sekrit-twc/EdgeFixer which does not rely on tons of dlls like the currently linked version in the release section?
-> Problem solved: seems like something with my Windows installation was 'off'

_Al_
26th December 2019, 19:26
Is there a simple way to do this?
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
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.

stax76
27th December 2019, 16:25
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.

Myrsloik
27th December 2019, 16:33
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.

stax76
27th December 2019, 16:41
Sorry, I overlooked it. I'm not very good in C++ right now, first C++ project after over ten years. :)

Myrsloik
28th December 2019, 21:49
Audio support is almost done:cool:

yoon
28th December 2019, 22:10
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
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.

jmartinr
29th December 2019, 10:57
:thanks:

Selur
29th December 2019, 13:10
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

Myrsloik
29th December 2019, 13:53
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).

Jukus
29th December 2019, 14:37
@Myrsloik
What about variable fps?

Myrsloik
29th December 2019, 15:04
@Myrsloik
What about variable fps?

What about you asking a complete question?

Jukus
30th December 2019, 05:19
What about you asking a complete question?
VS does not support variable FPS for output, will it be implemented?

Lypheo
30th December 2019, 08:22
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).

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?

Myrsloik
30th December 2019, 09:50
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...

Cary Knoop
1st January 2020, 01:30
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!
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:
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.

feisty2
5th January 2020, 19:54
I wrote some syntactic sugar stuff for the C++ API here: https://github.com/IFeelBloated/vaporsynth-syntactic-sugar/blob/master/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

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:

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

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

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()"

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.

feisty2
5th January 2020, 20:05
simple live demonstration: https://godbolt.org/z/MHebt8

Jukus
8th January 2020, 15:50
How to properly process the video where 3 progressive frames, 2 interlaced and it turns out that every 5 frame is a duplicate?

Boulder
8th January 2020, 18:50
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.

PlazzTT
11th January 2020, 17:18
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"


...
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?

Jukus
11th January 2020, 20:53
By the way, to the page:
http://www.vapoursynth.com/doc/installation.html#linux-installation-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.

outhud
12th January 2020, 20:50
Where should Vapoursynth plugins (.so) be placed by default on Linux (Ubuntu) so that they are auto-loaded?

Is there a way to print the autoload folder?

I've tried /usr/local/lib/ and /usr/lib/x86_64-linux-gnu/vapoursynth/ but it seems the modules are not being found.

Richard1485
12th January 2020, 20:56
I installed cython through pip.


Did you install it with pip3?


pip3 install cython

Are_
12th January 2020, 21:02
Where should Vapoursynth plugins (.so) be placed by default on Linux (Ubuntu) so that they are auto-loaded?

Is there a way to print the autoload folder?

I've tried /usr/local/lib/ and /usr/lib/x86_64-linux-gnu/vapoursynth/ but it seems the modules are not being found.

http://www.vapoursynth.com/doc/autoloading.html

Most probably in /usr/local/lib/vapoursynth in your case.

Myrsloik
14th January 2020, 14:46
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).

Audio update:
A a best but slow audio source has been created so that's no longer a major problem (will still get some usefulness improvements over time).

Testing and debugging everything else is however taking longer than expected but audio will be fully supported by AVFS and VFW as well from the start and vspipe will be able to output wave64 headers.

Richard1485
14th January 2020, 17:07
^ Excellent news! Down the line, I hope that it might be possible to have an equivalent to AviSynth's Dissolve(), which affects video and audio.

stax76
18th January 2020, 12:43
I'm not sure what's the focus of this thread because my question is about vs host application development.

There is a weird exception happening here:


case WM_DESTROY:
DiscardGraphicsResources();
SafeRelease(&g_D2D_Factory);

g_vsapi->freeNode(g_vsnode);
vsscript_freeScript(g_vsscript);
vsscript_finalize();

PostQuitMessage(0);
return 0;


Exception thrown at 0x00007FFAFC5B448D (vapoursynth.cp37-win_amd64.pyd) in VapourSynth Direct2D Rendering.exe: 0xC0000005: Access violation writing location 0x0000000000000000.

Weird thing is it crashes only inside WM_DESTROY and not when this code is executed before WM_DESTROY !

How can this issue be debugged?

Myrsloik
18th January 2020, 12:54
I'm not sure what's the focus of this thread because my question is about vs host application development.

There is a weird exception happening here:


case WM_DESTROY:
DiscardGraphicsResources();
SafeRelease(&g_D2D_Factory);

g_vsapi->freeNode(g_vsnode);
vsscript_freeScript(g_vsscript);
vsscript_finalize();

PostQuitMessage(0);
return 0;


Exception thrown at 0x00007FFAFC5B448D (vapoursynth.cp37-win_amd64.pyd) in VapourSynth Direct2D Rendering.exe: 0xC0000005: Access violation writing location 0x0000000000000000.

Weird thing is it crashes only inside WM_DESTROY and not when this code is executed before WM_DESTROY !

How can this issue be debugged?

It's with a trivial script (BlankClip only)?

Are there any restrictions on what you're allowed to do when handling a WM_DESTROY message? If not then I'd simply see what the call stack is in a debugger. Maybe there's a hint in there.

stax76
18th January 2020, 13:06
I don't have debug symbols so on my side call stack don't help.


vapoursynth.cp37-win_amd64.pyd!00007ffb10a9448d()
vapoursynth.cp37-win_amd64.pyd!00007ffb10a97529()
vsscript.dll!00007ffb4d0a25c1()
VapourSynth Direct2D Rendering.exe!WndProc(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 197
at D:\Projekte\CPP\VapourSynth Direct2D Rendering\main.cpp(197)
[External Code]
VapourSynth Direct2D Rendering.exe!WndProc(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 244
at D:\Projekte\CPP\VapourSynth Direct2D Rendering\main.cpp(244)
[External Code]
VapourSynth Direct2D Rendering.exe!WndProc(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 244
at D:\Projekte\CPP\VapourSynth Direct2D Rendering\main.cpp(244)
[External Code]
VapourSynth Direct2D Rendering.exe!WndProc(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 244
at D:\Projekte\CPP\VapourSynth Direct2D Rendering\main.cpp(244)
[External Code]
VapourSynth Direct2D Rendering.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 164
at D:\Projekte\CPP\VapourSynth Direct2D Rendering\main.cpp(164)
[External Code]


I can try to compile VS to get debug symbols or maybe you can have a look if I upload the source code.

The script is very simple and works in any other application.

import os, sys
import vapoursynth as vs
core = vs.get_core()
sys.path.append(r'D:\Projekte\VB\staxrip\bin\Apps\Plugins\VS\Scripts')
core.std.LoadPlugin(r"D:\Projekte\VB\staxrip\bin\Apps\Plugins\both\ffms2\ffms2.dll")
clip = core.ffms2.Source(r'D:\Samples\test.mkv', cachefile=r'D:\Samples\test_temp\test.ffindex')
#clip = core.std.AssumeFPS(clip, None, 25, 1)

clip = core.std.FlipVertical(clip)

if clip.format.id == vs.RGB24:
_matrix_in_s = 'rgb'
else:
if clip.height > 576:
_matrix_in_s = '709'
else:
_matrix_in_s = '470bg'

clip = clip.resize.Bicubic(matrix_in_s = _matrix_in_s, format = vs.COMPATBGR32)
clip.set_output()

Are there any restrictions on what you're allowed to do when handling a WM_DESTROY message?

It's a simple C++ classic Win32 GUI application, I'm not a expert in that and don't know about restrictions.

Myrsloik
18th January 2020, 13:18
Send me the code and I'll take look at it then.

Btw, debug symbols for vapoursynth.dll are included in the installer (look for vapoursynth.pdb). VSScript.dll has no code of interest at all and is pointless to bother with. If anything you need to compile the python module with debug symbols which I've never done so don't ask me how.

stax76
18th January 2020, 13:55
Thanks for the help! I hope it's easy to find and fix.

http://www.mediafire.com/file/xgfjzt3jxhs489s/VapourSynth_Direct2D_Rendering.zip

Jukus
19th January 2020, 19:06
Is it possible to read somewhere how to do detelecine using VS? I know there is documentation http://www.vapoursynth.com/doc/plugins/vivtc.html but still nothing is clear.

Myrsloik
19th January 2020, 22:16
Thanks for the help! I hope it's easy to find and fix.

http://www.mediafire.com/file/xgfjzt3jxhs489s/VapourSynth_Direct2D_Rendering.zip

Still looking at your code. Still not sure why it happens.

Boulder
20th January 2020, 12:22
Is it possible to read somewhere how to do detelecine using VS? I know there is documentation http://www.vapoursynth.com/doc/plugins/vivtc.html but still nothing is clear.

It's basically the same procedure compared to Avisynth's TFM and TDecimate. You just have to use the VapourSynth syntax. IIRC the settings are pretty much the same for a regular IVTC operation.

Jukus
20th January 2020, 12:48
It's basically the same procedure compared to Avisynth's TFM and TDecimate. You just have to use the VapourSynth syntax. IIRC the settings are pretty much the same for a regular IVTC operation.
I have never used AviSynth.
Or tell me an analog of this code for VS
AnimeIVTC(2, bbob=5, extbob=MC_A_bob, mode22=false, aa=0)

Boulder
20th January 2020, 13:01
AnimeIVTC is a custom function, it's far from a normal IVTC. I don't know if there is an alternative one in VS.

Jukus
20th January 2020, 13:31
AnimeIVTC is a custom function, it's far from a normal IVTC. I don't know if there is an alternative one in VS.
How to make detelecine in general? I even have a poor idea of what telecine is, what scripts and their settings should do to fix it.

Boulder
20th January 2020, 13:48
How to make detelecine in general? I even have a poor idea of what telecine is, what scripts and their settings should do to fix it.A simple IVTC happens for example with
clp = core.vivtc.VFM(clp, order=1)
clp = core.vivtc.VDecimate(clp)

You really need to learn the syntax and do some studying. Avisynth is probably easier to start with than VS.

Jukus
20th January 2020, 19:16
A simple IVTC happens for example with
clp = core.vivtc.VFM(clp, order=1)
clp = core.vivtc.VDecimate(clp)

You really need to learn the syntax and do some studying. Avisynth is probably easier to start with than VS.
Everything is much worse and more complicated.
For some reason, I can’t unload the sample.
I tried to apply this code for my case, but just got an interlaced video.
The best result is obtained in this way:
clip = haf.QTGMC(clip, Preset='Very Slow', Sharpness=0.3, FPSDivisor=2, TFF=True)
clip = core.vivtc.VDecimate(clip, cycle=5)
At the same time, many frames with blends and even there is no consistency, that is 4 good frames, the next with blend, then 8 good frames, the next with blend, about 2 frames with blends in a row.
Srestore doesn't help.
I have no more ideas on what can be done and what is happening in this video.

Reading the documentation is useless without understanding what is going on in the video. And there is nothing to read about what types of videos exist and what can be done or not done with it. Even there are several types of telecine: HardTelecine, DoubleHardTelecine and I don’t know what else.

AviSynth is Windows only, I use Linux. Maybe I should use AviSynth with WIne, I don't know.

Boulder
20th January 2020, 19:27
If your source is anime, I can only wish you good luck with that. They are notoriously hard, or even impossible to restore without intense manual labour.

Jukus
20th January 2020, 19:51
If your source is anime, I can only wish you good luck with that. They are notoriously hard, or even impossible to restore without intense manual labour.
No, it's a low-budget film from 2001-2004.