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 August 2020, 18:44   #1  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Some guidelines on Vapoursynth memory management

I just finished a very large script with VideoNodes being put into lists. Even running this with a single list entry the script runs about 60GB. Now, I have plenty of memory and the script runs fine but I suspect nodes are deep copied on certain operations.

VideoNodes are never assigned to new variables however they are returned by functions and added to lists using the append() function.

Any recommendations handling clips in lists and clips being returned from functions and other general considerations?

Last edited by Cary Knoop; 11th August 2020 at 20:05.
Cary Knoop is offline   Reply With Quote
Old 11th August 2020, 19:21   #2  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 164
I do not know Python to the last bit as others but something:
using ModifyFrame, FrameEval as much as possible,
clips you need locally and it is a tool, just use in a function, then it should be garbage collected,
like clips that are needed to assemble other clips and if not in function, then deleting them,
making clips only if they are needed using generator, so yield could be used in functions instead of return (but I never actually tried this),inspiration from here,
so quick attempt:
Code:
def make_clip(colors):
    index = 0
    while index<3:
        yield core.std.BlankClip(format=vs.RGB24, color=colors[index])
        index +=1
clips = make_clip([(255,0,0), (0,255,0), (0,0,255)])
clip1 = next(clips)
#do something else
del clip1
clip2 = next(clips)
#do something else
clip3 = next(clips)
#do something else
del clip3
_Al_ is offline   Reply With Quote
Old 11th August 2020, 19:28   #3  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,250
What _Al_ said. You can also try the audio test builds since they have a more aggressive cache clearing strategy which most likely will improve things.

If you post the script or at least the general idea we can suggest better strategies.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Reply

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 06:43.


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