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 September 2015, 13:36   #1741  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
I've now enabled the github wiki. Anyone with a github account can freely edit it. It's empty right now so suggest a good structure.

https://github.com/vapoursynth/vapoursynth/wiki
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 29th September 2015, 13:59   #1742  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
I suggests a Tools page like so:
Quote:
Editors

VapourSynth Editor

GUIs

StaxRip
Simple x264/x265 Launcher

Encoders

QSVEncC
NVEncC
VCEEncC

Misc

vspipe
VirtualDub
stax76 is offline   Reply With Quote
Old 29th September 2015, 16:53   #1743  |  Link
splinter98
Registered User
 
Join Date: Oct 2010
Posts: 36
Quote:
Originally Posted by stax76 View Post
I'm also using the github wiki for StaxRip but can't really tell how it compares to other solutions. What could also be interesting is readthedocs.org, most people here know it from the excellent x265 docs, it looks like it's built with Python so a natural fit for VapourSynth.

https://readthedocs.org

https://x265.readthedocs.org
+1 for read the docs it should be a simple case of sign up, link to the github and enable the webhook and it will build on pull updates (and should support tag based version history which is useful for people using older versions for whatever reason). (it could also be set up as a cname for docs.vapoursynth.com if desired).

The wiki still useful for user contributed items, such as example snippets.
splinter98 is offline   Reply With Quote
Old 29th September 2015, 23:29   #1744  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
Myrsloik, would you consider extending clip.format with min and max (or minval/maxval)? 2**clip.format.bits_per_sample-1 works for integer formats, though ugly, but that should be 1.0 for floats. Making it generic would be even uglier, like:
maxval=2**clip.format.bits_per_sample-1 if clip.format.sampletype==vs.INTEGER else 1.0
foxyshadis is offline   Reply With Quote
Old 29th September 2015, 23:35   #1745  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
I've made a new page for the community to list AviSynth equivalents to ease the transition to VS: https://github.com/vapoursynth/vapou...th-Equivalents

Hopefully this will keep others from banging their head as much as I did on the path to enlightenment. Also helps me, since I'm so forgetful.
foxyshadis is offline   Reply With Quote
Old 29th September 2015, 23:51   #1746  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
I guess I could add a function for it but it's actually a bit more complicated. For floating point it also depends on the plane and format. I'll think about it a bit because it definitely could be useful to have in many scripts.

And when you write about function equivalents, don't always assume Lut is faster than expr. The jit compilation in r28 gives a huge speedup.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 30th September 2015, 00:00   #1747  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
Quote:
Originally Posted by Myrsloik View Post
I guess I could add a function for it but it's actually a bit more complicated. For floating point it also depends on the plane and format. I'll think about it a bit because it definitely could be useful to have in many scripts.

And when you write about function equivalents, don't always assume Lut is faster than expr. The jit compilation in r28 gives a huge speedup.
Didn't know that, nice. Even then I was going to edit it to say that it'd only be useful for 8-bit, since memory bandwidth on most luts is likely to be a much bigger speed-killer, unless it's a very expensive expression.
foxyshadis is offline   Reply With Quote
Old 30th September 2015, 09:53   #1748  |  Link
DarkSpace
Registered User
 
Join Date: Oct 2011
Posts: 204
For the integer formats, will your min/max values handle limited/full/custom ranges, too?
DarkSpace is offline   Reply With Quote
Old 2nd October 2015, 23:25   #1749  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by DarkSpace View Post
For the integer formats, will your min/max values handle limited/full/custom ranges, too?
Don't go there. Limited/full range is a frame property so that's per frame. There's a reason I didn't add a simple function. It's not simple at all. Ever.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 2nd October 2015, 23:27   #1750  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Behold R28 RC1. No more changes planned unless a serious bug is found. Most of the performance regression relative to R27 should be fixed.

All R28 changes:
Code:
r28:
the installer will now download and install the vs2013 and vs2015 runtimes if needed
now uses python 3.5
fixed vdecimate parallel mode
pow is now accepted in expr expressions
expr now accepts up to 26 inputs (x-z, a-w)
expr now has runtime code generation on x86 cpus using jitasm
now normalizes the framerate returned from avisynth filters
it is now a fatal error to set the videoinfo of a filter to a non-normalized framerate
added a few more checks for proper api usage
get_core() can now be used in callbacks and other external functions in python
now returns an error message saying that windows needs to be updated in certain cases when plugin loading fails
fixed loop filter (nodame)
lut and lut2 can now output float as well
now accepts scripts that start with a BOM as well
fixed an image corruption bug with 9-16 bit input to rgvs when the c++ code is used
fixed division by zero issues in muldivrational in vshelper.h
blankclip can now create 0 (unknown/variable) fps clips
added float support to planedifference and planeaverage
added half support to addborders
relevant compile time options are now in the version string
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 7th October 2015, 22:42   #1751  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Look at me! I'm multitasking! I can argue on the interweb and release stuff at once! R28 is ready. Prepare to have FATAL ERRORS IN YOUR NIGHTMARES!

The usual summary blog of interesting changes. Full changelog in the first post as usual.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 12th October 2015, 13:09   #1752  |  Link
mawen1250
Registered User
 
Join Date: Aug 2011
Posts: 103
core.resize in R28 returns "Warning: data is not aligned! This can lead to a speedloss" in command line.
mawen1250 is offline   Reply With Quote
Old 12th October 2015, 13:23   #1753  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Quote:
Originally Posted by mawen1250 View Post
core.resize in R28 returns "Warning: data is not aligned! This can lead to a speedloss" in command line.
It always (?) does that. You shouldn't use it anyway. zimg now has a drop-in replacement all-in-one filter.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 12th October 2015, 14:55   #1754  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by mawen1250 View Post
core.resize in R28 returns "Warning: data is not aligned! This can lead to a speedloss" in command line.
That's very odd. All buffers should be aligned. I'll have to figure out why that happens.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 12th October 2015, 17:00   #1755  |  Link
NailBomber
Registered User
 
Join Date: May 2015
Location: Russia
Posts: 17
Save frame as an image file?

Is there currently a way to get frame data out of video and write it into an image? Something like using clip.get_frame() then writing it with opencv?
NailBomber is offline   Reply With Quote
Old 12th October 2015, 17:02   #1756  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by NailBomber View Post
Is there currently a way to get frame data out of video and write it into an image? Something like using clip.get_frame() then writing it with opencv?
If you want it written as text you can simply use FrameProps to print the relevant ones.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 12th October 2015, 18:21   #1757  |  Link
TurboPascal7
Registered User
 
TurboPascal7's Avatar
 
Join Date: Jan 2010
Posts: 270
Quote:
Originally Posted by NailBomber View Post
Is there currently a way to get frame data out of video and write it into an image? Something like using clip.get_frame() then writing it with opencv?
Code:
src = core.ffms2.Source(...)
src = core.resize.Bicubic(src, format=vs.RGB24)

planes_count = src.format.num_planes
for x in range(10):
    frame = src.get_frame(x)
    image = cv2.merge([np.array(frame.get_read_array(i), copy=False) for i in reversed(range(planes_count))])
    cv2.imshow("", image)  # or something like cv2.imwrite("{0}.png".format(x), image) if you want it saved
    cv2.waitKey(0)
Something like this works for now (converted to rgb because working with subsampled formats in opencv is all kinds of painful). Basically you use get_read_array to get the raw bytes, convert them to numpy arrays and then do whatever you want with them.
__________________
Me on GitHub | AviSynth+ - the (dead) future of AviSynth
TurboPascal7 is offline   Reply With Quote
Old 12th October 2015, 20:07   #1758  |  Link
NailBomber
Registered User
 
Join Date: May 2015
Location: Russia
Posts: 17
Myrsloik, sorry, I meant the frame itself.

Thank you, TurboPascal7.
NailBomber is offline   Reply With Quote
Old 12th October 2015, 22:36   #1759  |  Link
splinter98
Registered User
 
Join Date: Oct 2010
Posts: 36
Quote:
Originally Posted by TurboPascal7 View Post
Code:
src = core.ffms2.Source(...)
src = core.resize.Bicubic(src, format=vs.RGB24)

planes_count = src.format.num_planes
for x in range(10):
    frame = src.get_frame(x)
    image = cv2.merge([np.array(frame.get_read_array(i), copy=False) for i in reversed(range(planes_count))])
    cv2.imshow("", image)  # or something like cv2.imwrite("{0}.png".format(x), image) if you want it saved
    cv2.waitKey(0)
Something like this works for now (converted to rgb because working with subsampled formats in opencv is all kinds of painful). Basically you use get_read_array to get the raw bytes, convert them to numpy arrays and then do whatever you want with them.
Don't forget if you just want to write out the video as a series of images, then imwri is likley to be faster. (If you want to then go on and do some other processing then yes the way TurboPascal7 has suggested is the way to go about it.)

Also if you then want to go about editing the images, you need to do:

Code:
src = core.ffms2.Source(...)
src = core.resize.Bicubic(src, format=vs.RGB24)

planes_count = src.format.num_planes
for x in range(10):
    frame = src.get_frame(x)
    image = cv2.merge([np.array(frame.copy().get_write_array(i), copy=False) for i in reversed(range(planes_count))])
    cv2.imshow("", image)  # or something like cv2.imwrite("{0}.png".format(x), image) if you want it saved
    cv2.waitKey(0)

Last edited by splinter98; 12th October 2015 at 22:40.
splinter98 is offline   Reply With Quote
Old 14th October 2015, 17:15   #1760  |  Link
mawen1250
Registered User
 
Join Date: Aug 2011
Posts: 103
For GRAY and YUV mask (haven't tested RGB), with first_plane=True, std.MaskedMerge will unexpectedly change the color. Probably because it clamps the UV mask to limited range.
I found this issue when trying to use AssVapour since the clipa and clipb are very different under this case.
mawen1250 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 15:09.


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