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 11th December 2017, 17:22   #2861  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Reporting a memory leak on ModifyFrame as I found it here earlier.

Memory will not flush after I closed preview in vs editor. Using the sample script from the document will cause the leak:
Code:
def set_frame_number(n, f):
   fout = f.copy()
   fout.props['FrameNumber'] = n
   return fout

clip = core.std.ModifyFrame(clip=clip, clips=clip, selector=set_frame_number)
lansing is offline   Reply With Quote
Old 12th December 2017, 13:22   #2862  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by lansing View Post
Reporting a memory leak on ModifyFrame as I found it here earlier.

Memory will not flush after I closed preview in vs editor. Using the sample script from the document will cause the leak:
Code:
def set_frame_number(n, f):
   fout = f.copy()
   fout.props['FrameNumber'] = n
   return fout

clip = core.std.ModifyFrame(clip=clip, clips=clip, selector=set_frame_number)
I've found 3 memory leaks so far in various places. Expect the next version to improve on things a lot. Note that all leaks more or less only happened when objects were destroyed so it'd never be discovered when using vspipe or simply encoding things.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 12th December 2017, 16:43   #2863  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
R41-test1

Some of the fixes required fairly big changes in the cython code so test as many scripts as possible. This binary should be considered alpha quality.

Code:
r41:
updated to zimg v2.7
removed dependency on the now deprecated codecvt header
fixed memory leak where modifyframe wouldn't release the function reference when done
fixed a rare memory leak that could happen if the core was freed before the last frame 
fixed a memory leak that would happen if a python videoframe object was instantiated
improved imwri's input and output format guessing, now integer and float image formats will most likely be returned in native precision
imwri now requires hdri support since it's now enabled by default
stackvertical now properly rejects compat formats instead of producing unexpected output
the default initial cache size now also depends on the number of threads used
fixed negative frame request error listing the parent node name instead of the correct name
fixed expr clamping of 9-15 bit output, previously it would clamp to 16bit
fixed corrupted output in expr when mixing int and float for input and output (pinterf)
Imwri builds will be provided separately at a later time when more testing has been done.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet

Last edited by Myrsloik; 12th December 2017 at 17:12.
Myrsloik is offline   Reply With Quote
Old 12th December 2017, 22:21   #2864  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Thank you, the leak is now gone, memory usage drops back to 30MB after preview close.

Quote:
Originally Posted by Myrsloik View Post
Quote:
Originally Posted by lansing
Can I output image file name with imwrif base on frame number in the frame property?
If you call imwri insode frameeval ypu should be able to do it.
I can't get it working, I tried various formatings but all failed.

Code:
from functools import partial

img_dir = r"F:\temp_img_w\{}.png"

def set_frame_number(n, f):
	fout = f.copy()
	fout.props.FrameNumber = n
	return fout

clip = core.std.ModifyFrame(clip=clip, clips=clip, selector=set_frame_number)

def writeimgfn(n, f, clip, path):
	num = f.props.FrameNumber
	rgb_clip = core.resize.Bicubic(clip, matrix_in_s="709", format=vs.RGB24)
	return core.imwrif.Write(rgb_clip, imgformat="PNG", filename=path.format(n))

clip = core.std.FrameEval(clip, partial(writeimgfn, clip=clip, path=img_dir), prop_src=clip)

clip.set_output()
It returns error "Write: Filename string doesn't contain a number".

Last edited by lansing; 12th December 2017 at 22:24.
lansing is offline   Reply With Quote
Old 12th December 2017, 22:40   #2865  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by lansing View Post
Thank you, the leak is now gone, memory usage drops back to 30MB after preview close.



I can't get it working, I tried various formatings but all failed.

Code:
from functools import partial

img_dir = r"F:\temp_img_w\{}.png"

def set_frame_number(n, f):
	fout = f.copy()
	fout.props.FrameNumber = n
	return fout

clip = core.std.ModifyFrame(clip=clip, clips=clip, selector=set_frame_number)

def writeimgfn(n, f, clip, path):
	num = f.props.FrameNumber
	rgb_clip = core.resize.Bicubic(clip, matrix_in_s="709", format=vs.RGB24)
	return core.imwrif.Write(rgb_clip, imgformat="PNG", filename=path.format(n))

clip = core.std.FrameEval(clip, partial(writeimgfn, clip=clip, path=img_dir), prop_src=clip)

clip.set_output()
It returns error "Write: Filename string doesn't contain a number".
Unless you have a more complex use case than this example you should simply be using vspipe and ffmpeg to write images. How does your script fail anyway?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 12th December 2017, 23:13   #2866  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by Myrsloik View Post
Unless you have a more complex use case than this example you should simply be using vspipe and ffmpeg to write images. How does your script fail anyway?
I'm working on a project to color match dragon ball z, for better color matching accuracy, I need to build a big montage for every scene and stored them as a clip, like 1 frame = 1 montage, each frame resolution varies. After that I need to output all the images to be use for the color matching program.

By tagging and saving a frame number onto each output image instead of the sequence counter will help to back track if something went wrong. For example, if one of the images gives poor matching result, I would know exactly where to look for that scene.
lansing is offline   Reply With Quote
Old 14th December 2017, 00:44   #2867  |  Link
gonca
Registered User
 
Join Date: Jul 2012
Posts: 1,213
Using Vapoursynth to try to process a UHD video
script is
Quote:
import vapoursynth as vs
core = vs.get_core()
core.avs.LoadPlugin(r'C:\Program Files (Portable)\dgdecnv\x64 Binaries\DGDecodeNV.dll')
clip = core.avs.DGSource(r'D:\#TEMP\xxxx.dgi', fieldop=0, fulldepth=True)
clip.set_output()
error report
Code:
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
Quote:
"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"
Through the command line The error is Vapoursynth failed to open input file

Any ideas?
gonca is offline   Reply With Quote
Old 14th December 2017, 14:28   #2868  |  Link
kriNon
Registered User
 
Join Date: Jul 2016
Posts: 39
I'm trying to use vapoursynth's avs.LoadPlugin(string path) to load some avisynth filters, however whenever I try to load almost any filter I will get the error:

Code:
Failed to evaluate the script:
Python exception: Avisynth Loader: failed to load module

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 1830, in vapoursynth.vpy_evaluateScript (src\cython\vapoursynth.c:36860)
File "", line 4, in 
File "src\cython\vapoursynth.pyx", line 1722, in vapoursynth.Function.__call__ (src\cython\vapoursynth.c:35000)
vapoursynth.Error: Avisynth Loader: failed to load module
Any idea what could be causing this? I'm running Vapoursynth r40 and Avisynth 2.6 x86.

Thanks!
kriNon is offline   Reply With Quote
Old 14th December 2017, 14:31   #2869  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by kriNon View Post
I'm trying to use vapoursynth's avs.LoadPlugin(string path) to load some avisynth filters, however whenever I try to load almost any filter I will get the error:

Code:
Failed to evaluate the script:
Python exception: Avisynth Loader: failed to load module

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 1830, in vapoursynth.vpy_evaluateScript (src\cython\vapoursynth.c:36860)
File "", line 4, in 
File "src\cython\vapoursynth.pyx", line 1722, in vapoursynth.Function.__call__ (src\cython\vapoursynth.c:35000)
vapoursynth.Error: Avisynth Loader: failed to load module
Any idea what could be causing this? I'm running Vapoursynth r40 and Avisynth 2.6 x86.

Thanks!
Did you escape the path properly?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 14th December 2017, 14:35   #2870  |  Link
kriNon
Registered User
 
Join Date: Jul 2016
Posts: 39
Ah sorry, forgot to post my script:
Code:
import vapoursynth as vs
core = vs.get_core()

core.avs.LoadPlugin(r"C:\Program Files (x86)\AviSynth\plugins\deen.dll")
Yeah, I did
kriNon is offline   Reply With Quote
Old 14th December 2017, 14:36   #2871  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
I believe VapourSynth may not be able to load AviSynth plugins with the ancient v2.0 or v2.5 interfaces, but require v2.6... so: Do you have a few examples which plugins load and which don't?
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old 14th December 2017, 14:51   #2872  |  Link
kriNon
Registered User
 
Join Date: Jul 2016
Posts: 39
I've only tested a few, I remember that TIVTC v1.0.5 didn't work, but v1.0.9 worked. Neither Deen or eDeen have worked for me, however I've seen that in https://github.com/vapoursynth/vapou...nth_compat.cpp there are the lines:
PREFETCHR1(deen)
PREFETCHR0(eDeen)
so I assume that there is compatibility?

Also someone used Deen in their vapoursynth script here:
https://gist.github.com/4re/bba3f65469acfe0ec08a

EDIT:
I tested a few avisynth plugins at random to see which ones worked, and can confirm that I got the same error message when trying to load Average, BlendWeight, ColorBalance, FFT3DFilter, and Vinverse.

I have recently reinstalled both Avisynth and Vapoursynth and am having the same error.

Last edited by kriNon; 14th December 2017 at 15:16.
kriNon is offline   Reply With Quote
Old 14th December 2017, 15:17   #2873  |  Link
Are_
Registered User
 
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 321
Sorry about that, I should delete it, it must not exist in current year.
Maybe you are trying to load 32bit plugins with 64bit vapoursynth or the other way around.
Are_ is offline   Reply With Quote
Old 14th December 2017, 15:20   #2874  |  Link
kriNon
Registered User
 
Join Date: Jul 2016
Posts: 39
Does 64bit vapoursynth not support 32bit plugins?
kriNon is offline   Reply With Quote
Old 14th December 2017, 16:00   #2875  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
64-bit processes can only handle 64-bit DLL's in general. That's not a restriction of specific software, but of the CPU mode and its memory addressing and register handling.

If you wanted to use a 32-bit DLL, you would have to spawn a separate 32-bit process and exchange data between both of them.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old 14th December 2017, 16:15   #2876  |  Link
kriNon
Registered User
 
Join Date: Jul 2016
Posts: 39
So I'm a little bit confused, would I need to uninstall vapoursynth and replace it with a 32-bit variant? or would I need to replace python with a 32 bit variant? or both?
kriNon is offline   Reply With Quote
Old 14th December 2017, 16:23   #2877  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
VapourSynth is a Python module. To run VapourSynth as a 32-bit process, you would have to run it in 32-bit Python.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old 14th December 2017, 16:28   #2878  |  Link
kriNon
Registered User
 
Join Date: Jul 2016
Posts: 39
Alright, Thanks for all of the help!
kriNon is offline   Reply With Quote
Old 14th December 2017, 21:45   #2879  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Just saw the new one liner call to import the core
Code:
from vapoursynth import core
Now how do we get things like vs.RGB24 without the "vs"? The document haven't update yet.

Last edited by lansing; 14th December 2017 at 23:08. Reason: typo
lansing is offline   Reply With Quote
Old 14th December 2017, 22:19   #2880  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by lansing View Post
Just saw the new one liner call to import the core
Code:
from vapoursynth import core
Now how do we get things like vs.RGB24 with the "vs"? The document haven't update yet.
Same as the old import vapoursynth as vs. You can also do things like
Code:
from vapoursynth import core, RGB24, someotherformat, ...
If you want to refer to them without the vs prefix. Python has loads of ways to import things.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik 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 16:21.


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