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 29th January 2020, 22:35   #3721  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
can I request a frame once and get the same frame multiple times? I know it sounds weird but it has something to do with temporal padding.
feisty2 is offline   Reply With Quote
Old 29th January 2020, 23:02   #3722  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by feisty2 View Post
can I request a frame once and get the same frame multiple times? I know it sounds weird but it has something to do with temporal padding.
Sure, you simply have to free all the different references you get to the frame.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 30th January 2020, 20:47   #3723  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
I just finished wrapping the video access process, the "zero" mode for temporal padding is quiet a nuisance: https://github.com/IFeelBloated/vsFi...olicies.hxx#L8 since it requires creating a new frame, which then requires a "core".
the temporal padding functions are called here: https://github.com/IFeelBloated/vsFi...r/Clip.hxx#L72 and the global "Core<Filter>" is obtained from xxxCreate(), I've tested it and it seemed to work properly, but I'm not sure, is there a potential problem here with the core stuff for zero padding at the temporal dimension?

Also can I store "frameCtx" in the video clip struct when requesting the frame so I can get rid of this useless parameter in GetFrame()? Do all frames share the same frameCtx or do I need a map to store the Ctx for each frame?

Last edited by feisty2; 30th January 2020 at 20:57.
feisty2 is offline   Reply With Quote
Old 7th February 2020, 19:20   #3724  |  Link
Jukus
Registered User
 
Join Date: Jul 2019
Location: Russia
Posts: 87
How can crop be an odd number? (but with resize to even numbers, ofс)
There is a technically interlaced DVD, but visually progressive, 2 pixels above are a black stripe, do crop top 2 and resize to 480, but a video doesn't encoded, what should I do?
Jukus is offline   Reply With Quote
Old 7th February 2020, 19:35   #3725  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by feisty2 View Post
I just finished wrapping the video access process, the "zero" mode for temporal padding is quiet a nuisance: https://github.com/IFeelBloated/vsFi...olicies.hxx#L8 since it requires creating a new frame, which then requires a "core".
the temporal padding functions are called here: https://github.com/IFeelBloated/vsFi...r/Clip.hxx#L72 and the global "Core<Filter>" is obtained from xxxCreate(), I've tested it and it seemed to work properly, but I'm not sure, is there a potential problem here with the core stuff for zero padding at the temporal dimension?

Also can I store "frameCtx" in the video clip struct when requesting the frame so I can get rid of this useless parameter in GetFrame()? Do all frames share the same frameCtx or do I need a map to store the Ctx for each frame?
The point of frameCtx is that it's unique to each frame being processed. I didn't review the rest of your code.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 7th February 2020, 19:39   #3726  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
How can crop be an odd number? (but with resize to even numbers, ofс)
Well if YV12 (420), there are half the number of chroma samples as there are luma samples (both X and Y dimension),
and you cant chop a chroma sample in half.
If Interlaced YV12, then can only crop vertical in multiples of 4. [Otherwise Interlacing destroyed]
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 7th February 2020 at 19:43.
StainlessS is offline   Reply With Quote
Old 7th February 2020, 19:52   #3727  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
in Vapoursynth you cannot crop "within" subsampling,
if you have YUV420P8 , it means you can crop only even numbers in x and y
say you have YUV411P8, then you can crop only multiples of 4 in x but odd lines in y
..etc,
you can get those multiples like this:
import vapoursynth as vs
clip = vs.core.std.BlankClip(clip, format=vs.YUV420P8)
print(1 << clip.format.subsampling_h)
print(1 << clip.format.subsampling_w)
you'd get:
>>>2
>>>2
for format=vs.YUV411P8
you'd get:
>>>1
>>>4

anyway, but do not cut some lines and resize back to the same number, that is nasty

Last edited by _Al_; 7th February 2020 at 20:04.
_Al_ is offline   Reply With Quote
Old 7th February 2020, 20:23   #3728  |  Link
Jukus
Registered User
 
Join Date: Jul 2019
Location: Russia
Posts: 87
Thanks for answers.
Quote:
Originally Posted by _Al_ View Post
anyway, but do not cut some lines and resize back to the same number, that is nasty
You mean it's a hoax?
Some people think that the resolution of the image should necessarily be multiples of 8 or even 16.
There are also hardware players that do not understand the non-standard resolution, anamorph.
Jukus is offline   Reply With Quote
Old 7th February 2020, 21:39   #3729  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
There is copping scripts, tutorials, calculators included, etc., on web since era of digital video started, especially at the beginning everyone was cropping like they'd get candy each time they did that. And those scripts and advises are still out there.
About mod, take a major HD resolution dimension 1080 that does not even qualify for mod 16.
If there is a filter that needs mod 8 or 16 you go with it otherwise there is no reason to change video to get to that mod. What I meant with those 2 pixels black strips, just leave it there (if it is an top or bottom). Maybe the best advice is going with basics for DVD, you see black stripes on sides crop them , total 16 pixels left and right, then resize to 16:9 to 854x480. At this point if those black stripes bother you, you can crop them, but that I'd do only if having letterbox, not some 2 pixels.
_Al_ is offline   Reply With Quote
Old 7th February 2020, 22:00   #3730  |  Link
Jukus
Registered User
 
Join Date: Jul 2019
Location: Russia
Posts: 87
@_AI_
Likely, people look at x264 log and see there "magic blocks of pixels"
...
[libx264 @ 0x55565ecbfd80] mb I I16..4: 10.1% 74.9% 14.9%
[libx264 @ 0x55565ecbfd80] mb P I16..4: 2.2% 9.2% 1.0% P16..4: 52.0% 17.5% 13.3% 0.5% 0.2% skip: 4.0%
[libx264 @ 0x55565ecbfd80] mb B I16..4: 0.1% 0.4% 0.0% B16..8: 42.9% 5.1% 1.0% direct: 2.7% skip:47.8% L0:36.5% L1:46.9% BI:16.6%
[libx264 @ 0x55565ecbfd80] 8x8 transform intra:73.7% inter:70.4%
...
[libx264 @ 0x55565ecbfd80] i16 v,h,dc,p: 11% 6% 3% 80%
[libx264 @ 0x55565ecbfd80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 8% 4% 9% 15% 14% 16% 13% 13%
[libx264 @ 0x55565ecbfd80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 11% 7% 3% 8% 16% 15% 15% 12% 12%
[libx264 @ 0x55565ecbfd80] i8c dc,h,v,p: 30% 25% 19% 26%

Last edited by Jukus; 7th February 2020 at 22:14.
Jukus is offline   Reply With Quote
Old 7th February 2020, 22:53   #3731  |  Link
Jukus
Registered User
 
Join Date: Jul 2019
Location: Russia
Posts: 87
How to write an analog of that code for VS?
Code:
interp = nnedi3(field=0, qual=2)
deint = YadifMod(order=0, edeint=interp)
TFM(order=0, mode=3, clip2=deint, slow=2).TDecimate(hybrid=1)
Jukus is offline   Reply With Quote
Old 8th February 2020, 01:20   #3732  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Quote:
Originally Posted by Jukus View Post
How to write an analog of that code for VS?
Code:
interp = nnedi3(field=0, qual=2)
deint = YadifMod(order=0, edeint=interp)
TFM(order=0, mode=3, clip2=deint, slow=2).TDecimate(hybrid=1)
Code:
clip = your source
interp = core.nnedi3.nnedi3(clip, field=0, qual=2)
deint = core.yadifmod.Yadifmod(clip, order=0, edeint=interp)
clip = clip.vivtc.VFM(order=0, mode=3, clip2=deint).vivtc.VDecimate()
There's no hybrid=1 parameter in VDecimate().
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 10th February 2020, 16:51   #3733  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
Hello Myrsloik, I've some questions...

Is there some documentation or sample code for DLL discovery and loading?

I've looked at the nvenc code and it is using Run-Time Dynamic Linking, I don't know if it relies on VS being in Path or if it searches the VS location in the registry and modifies the Path env var of the process.

vspipe appears to do Load-Time Dynamic Linking, discovery and manual loading is not necessary because the DLLs are located in the same directory.

Do all setup variants add VS to the Path env var and apps can rely on that?

Do all setup variants register the VS location in the registry? If so which key(s)?

I believe Load-Time Dynamic Linking is possible and preferred, I'm mostly unsure about path discovery.

Last edited by stax76; 10th February 2020 at 16:55.
stax76 is offline   Reply With Quote
Old 10th February 2020, 17:45   #3734  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Quote:
Originally Posted by stax76 View Post

Do all setup variants add VS to the Path env var and apps can rely on that?

Do all setup variants register the VS location in the registry? If so which key(s)?
Yes, see https://github.com/vapoursynth/vapou...aller.iss#L142

Since VS was split in global and user installation variants we need to check 4 reg paths:
CurrentUser / LocalMachine => "SOFTWARE\VapourSynth-32" and "SOFTWARE\VapourSynth"
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database

Last edited by ChaosKing; 10th February 2020 at 17:52.
ChaosKing is offline   Reply With Quote
Old 10th February 2020, 18:28   #3735  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
Thanks, might somebody have done this before with C++ and Win32? I'm very clumsy with that...
stax76 is offline   Reply With Quote
Old 10th February 2020, 19:01   #3736  |  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
Hello Myrsloik, I've some questions...

Is there some documentation or sample code for DLL discovery and loading?

Do all setup variants add VS to the Path env var and apps can rely on that?

Do all setup variants register the VS location in the registry? If so which key(s)?

I believe Load-Time Dynamic Linking is possible and preferred, I'm mostly unsure about path discovery.
Is there some documentation or sample code for DLL discovery and loading?
No. You read the location you need from the registry. HKLM/HKCU (depends on current user install mode) and then software\vapoursynth (or vapoursynth-32 for poor people) and the keys of interest are called VSScriptDLL and VapourSynthDLL. Simply use loadlibrary and call vsscript_getVSApi2() or getVapourSynthAPI() depending on which dll you use.

Do all setup variants add VS to the Path env var and apps can rely on that?
No. It's a user option and you can never depend on this.

Do all setup variants register the VS location in the registry? If so which key(s)?
Yes, see above. I guess portable doesn't but that's hardly a setup variant...
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 22nd February 2020, 17:19   #3737  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
Made some simple wrapper library for AviSynth and VapourSynth, it was necessary because AviSynth has no C or COM interface...

https://github.com/staxrip/staxrip/t...er/FrameServer

https://github.com/staxrip/staxrip/b...FrameServer.vb

https://github.com/staxrip/staxrip/b...deoRenderer.vb
stax76 is offline   Reply With Quote
Old 23rd February 2020, 05:00   #3738  |  Link
amichaelt
Guest
 
Posts: n/a
Quote:
Originally Posted by stax76 View Post
it was necessary because AviSynth has no C or COM interface...
What about avisynth_c.h?
  Reply With Quote
Old 23rd February 2020, 06:26   #3739  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
I don't know, maybe I should try it, sample code would help. When I started the library I didn't know a lot about C/C++ (last project more than 10 years ago) and AviSynth, after completing it I know a little more. With the AviSynth part I had few issues, no problems with VapourSynth.
stax76 is offline   Reply With Quote
Old 23rd February 2020, 14:50   #3740  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
The way you're using frame fetching in VS is inefficient. In general you have to care about async frame requests on your end, otherwise it works like a single-threaded frameserver.
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM 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 21:19.


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