View Full Version : AvsPmod 2.5.1
ANGEL_SU
16th January 2012, 16:08
.. I have not saved my script IE it has the * at the top left, the file name of the screenshot has * at the start of it...
A stupid bug, fixed.
If you would try the latest code, please download this executable file (http://www.mediafire.com/?i5rbpqs17gv4508). Before running it, make sure to put it under your AvsPmod folder.
unreal666
17th January 2012, 12:48
1. If possible, please upload translation.py and options.dat for my study.
Not make sense. Error with translation.py fixed in v2.2.1.
options.dat was default.
2. IsXxx(clip), HasXxx(clip) and GetXxx(clip) will be classfied as clip properties.
GetLeftChannel & GetRightChannel return clip => they can not be properties.
You can override this behavior by modifying filterdb.dat which is a general text file indeed.
I know
ChrisW77
17th January 2012, 18:21
Great program. Is it possible to batch-script a whole directory full of images with just one single script for them all, using AvsPmod ?
For example, I have well over a thousand images of the last 10 years my family's lives, pets, mates, etc.. all taken on different devices from camera, to digital cameras, to mobile phones. They all exhibit varying levels of noise, most of it is jpeg noise, but I would just like to give them a once-over image clean with TNLMEANS, with a script similar to this.
SetMTMode(2,6)
SetMemoryMax(512)
SetMTMode(5,6)
ImageSource("D:\Camera_Pics\pic1.jpg", end = 300, use_DevIL=true)
ConvertToYV12(interlaced=false)
SetMTMode(2,6)
TNLMeans(Ax=10,Ay=10, Sx=3,Sy=3, Bx=0,By=0, a=1.0, h=1.0, sse=true)
At least 9 out of 10 pics come out really great with this simple script, some may need a slight sharpen at the end, but I'm happy with the result. So, instead of doing this task one by one, I am wondering if it's possible to use that one script on the whole directory ?
Thanks for any help.
Zarxrax
17th January 2012, 18:38
Yes, take a look at the Batch example macro in a text editor, and you should be able to see how to do it.
You can use SaveImage(filename='', framenum=None, index=None) in the macro to output to an image file. However, this does not allow you to specify any options as to image type or settings.
jmartinr
17th January 2012, 18:48
Great program. Is it possible to batch-script a whole directory full of images with just one single script for them all, using AvsPmod ?
I sometimes use for video an avisynth wrapper file like: file=GetSystemEnv("filename")
FFVideoSource(file)
etc. etc.
With a batchfile with in the midde something like:
setlocal
set filename=%%~dpnP.mp4
"C:\Program Files\x264\x264.exe" "wrapper.avs" etc.etc.
endlocal
You can find GetSystemEnv here: http://avisynth.org/stickboy/
This way each directory can have his own wrapper.avs.
ChrisW77
19th January 2012, 15:34
Thanks for the two replies. I have been out of avisynth editing for the best part of a year, and so I am a little rusty.
Yes, take a look at the Batch example macro in a text editor, and you should be able to see how to do it.
You can use SaveImage(filename='', framenum=None, index=None) in the macro to output to an image file. However, this does not allow you to specify any options as to image type or settings.
I didn't really understand this. I have looked at the batch example, but all it does is create a script for each and every file, so I would have a few thousand scripts to execute, unless I am missing something.
Is there no way of simply executing the script I posted above on a whole directory ? I am not worried about filenames, the images will be burned to DVD to be used on a home DVD upscaler so me and my family can sit back and look at them on a big HDTV. This is why they need a slight clean because when viewed upscaled they look a little grainy and noisy.
If you have the time, could you do me a simple walk through using Avspmod and my script above ? I would be most appreciated if possible, many thanks.
Zarxrax
19th January 2012, 16:52
You might want to take a look at Fritz Photo: http://forum.doom9.org/showthread.php?t=150291
I have never used it, but it is an interface for avisynth which is specifically designed for processing images.
jmartinr
19th January 2012, 19:48
You might want to take a look at Fritz Photo: http://forum.doom9.org/showthread.php?t=150291
I have never used it, but it is an interface for avisynth which is specifically designed for processing images.
What he says. I totally forgot about that possibility.
Mak0rz
19th January 2012, 20:31
Mak0rz: I made you a special build that allows putting seconds into the status bar from the customize status bar options: http://www.mediafire.com/?55slz1tg89zvs40
Thanks, It works beautifully! You are awesome. Never stop being awesome.
Do you accept donations?
Zarxrax
19th January 2012, 20:42
Do you accept donations?
No thanks, its cool :)
vdcrim
20th January 2012, 00:26
@ChrisW77
This should work:
suffix = ' new'
format = '.png'
using_jpg_quality_no_dialog_fix = False
jpg_quality = 90
# Avisynth script. Replace the input path with "in_path".
script = ur"""
SetMTMode(2,6)
SetMemoryMax(512)
SetMTMode(5,6)
ImageSource("in_path", end = 300, use_DevIL=true)
ConvertToYV12(interlaced=false)
SetMTMode(2,6)
TNLMeans(Ax=10,Ay=10, Sx=3,Sy=3, Bx=0,By=0, a=1.0, h=1.0, sse=true)
"""
from os import listdir
from os.path import splitext, basename, join
dir_path = avsp.GetDirectory(title='Select a directory')
if not dir_path:
return
avsp.NewTab()
avs = avsp.GetWindow().currentScript
progress = avsp.ProgressBox(max=1000, title='Batch processing progress')
paths = [join(dir_path, filename) for filename in filter(
lambda x: x.endswith('.jpg'), listdir(dir_path))]
for i, path in enumerate(paths):
progress.Update(i*1000.0/len(paths), basename(path))
# avsp.SetText(script.replace('in_path', path)) # converts to ascii
avs.SetText(script.replace('in_path', path))
try:
if using_jpg_quality_no_dialog_fix:
avsp.SaveImage(splitext(path)[0] + suffix + format, quality=jpg_quality)
else:
avsp.SaveImage(splitext(path)[0] + suffix + format)
except:
avsp.MsgBox('Processing failed at ' + basename(path))
break
progress.Destroy()
avsp.CloseTab()
There's a catch: the SaveImage function prompts for a quality setting if the output is jpg. I made a small modification to the related functions in AvsP.py so they also accept the quality as an argument.
UPDATE: the modification is included in AvsPmod 2.3.0. An improved version of this script is available at https://github.com/vdcrim/avsp-macros
ChrisW77
20th January 2012, 01:43
vdcrim, many thanks, will try that a bit later. Quality will be PNG, although I will see what 90% jpeg looks like, it depends on how well TNLMeans handles some of my older, low megapixel camera and phone pics. And Zarxrax, thanks for the Fritz Photo suggestion.
wOxxOm
28th January 2012, 20:45
Avisynth itself loads dlls and reports names of functions in a table, there is no parsing of dlls in AvsPmod.
And anyway there's nothing wrong in autoloading of your plugins if you use all of them in most of your scripts.
StainlessS
29th January 2012, 07:48
Tis a shame that there is no way to relate argument ranges within a plug description (Avisynth General).
vdcrim
3rd February 2012, 17:28
I was trying to find out if it was possible to add a button to search for file in a dialog box generated by the GetTextEntry macro function, and I ended up rewriting almost the whole thing. It adds some new functionality:
- New entry types in addition to simple text field.
- A single line can contain multiple entries.
- Horizontal separator between entries.
- Customizable dialog box width.
This new version of GetTextEntry is backwards compatible with the current one. It adds two new optional parameters and extend the existing ones. I'd be happy if it were to be incorporated to an eventual next AvsPmod release.
UPDATE: Added in AvsPmod 2.3.0
http://i.imgur.com/XtF7a.png
This is an example of dialog box showing the new different types of entry. It was generated with this macro demo:
title = 'Improved GetTextEntry macro function demo'
message = [
'Separator, both text and line optional',
['Regular text field 1', 'Regular text field 2'],
'Text field with browse for file button ("open" dialog)',
'Text field with browse for file button ("save" dialog)',
'Text field with browse for directory button',
'',
['Drop-down list (writable)', 'Drop-down list (read only)'],
['Spin', 'Check'],
'Slider (horizontal)',
'No type specified, defaults to regular text field '
]
default = [
200,
'default text',
'default file path 1',
('default file path 2', 'Avisynth Script (*.avs)|*.avs'),
'default directory path',
'',
[('list1 1', 'list1 2', 'list1 3', 'list1 2'), ('list2 1', 'list2 2', 'list2 3', 'list2 3')],
[(4, 0, 10, 2, 1), True],
(71, 0, 100, 25)
]
types = [
'sep',
'',
'file_open',
'file_save',
'dir',
'sep',
['list_writable', 'list_read_only'],
['spin', 'check'],
'slider_h'
]
width = 300
options = avsp.GetTextEntry(message, default, title, types, width)
if not options:
return
avsp.MsgBox((u'Field #{}: {}\n' * len(options)).format(
*[i[j] for i in zip(range(1, len(options) + 1), options) for j in range(2)]), 'Returned values')
Zarxrax
3rd February 2012, 22:54
cool, thanks vdcrim
wOxxOm
4th February 2012, 01:54
How about implementing a fullscreen video mode toggle? It'd be a killer feature.
ANGEL_SU
4th February 2012, 05:10
...
This new version of GetTextEntry is backwards compatible with the current one.
...
Nice work. If possible, please look OptionsDialog class in wxp.py and merge your code into.
Yellow_
4th February 2012, 16:03
How about implementing a fullscreen video mode toggle? It'd be a killer feature.
Also for dual monitor+ setups a way to run one instance of an external player if possible outside of that app, currently using mplayer on seperate screen but can't get it to only run one instance each time I want to run amended script in the external player it starts a new one. :-(
vdcrim
7th February 2012, 00:19
Nice work. If possible, please look OptionsDialog class in wxp.py and merge your code into.Done.
Edit: added this (http://forum.doom9.org/showthread.php?p=1552739#post1552739) too.
Edit 2: corrected small mistake.
Edit 3: cosmetics.
Edit 4: fixed error. This is the last update.
UPDATE: link removed, changes incorporated in AvsPmod 2.3.0
matfra
8th February 2012, 14:06
I have a issue with my AVSP. All the version of AVSP do this.
[Wed Feb 08 08:05:53 2012]
Traceback (most recent call last):
File "run.py", line 6, in <module>
File "AvsP.pyo", line 13863, in main
File "wx\_core.pyo", line 7981, in __init__
File "wx\_core.pyo", line 7555, in _BootstrapApp
File "AvsP.pyo", line 13853, in OnInit
File "AvsP.pyo", line 4165, in __init__
File "AvsP.pyo", line 4784, in defineFilterInfo
File "AvsP.pyo", line 5012, in getFilterInfoFromAvisynth
WindowsError: exception: access violation reading 0x00000000
I can't event start it. That the error I have in the log. Any 1 have this issue ?
LigH
8th February 2012, 14:16
Do you possibly have junk in your AviSynth plugins folder, like plugin DLLs not suitable for your CPU or outdated DLLs for different AviSynth versions?
Reino
9th February 2012, 18:11
I'd like to report a little bug:
AvsP seems to remember the image type you used last time with "Save image as..." the next time you use it (png in my case). However, there are no png-files visible. I have to select another image type and then png again to see the content of the directory.
Can anyone confirm?
naoan
9th February 2012, 18:32
I'd like to report a little bug:
AvsP seems to remember the image type you used last time with "Save image as..." the next time you use it (png in my case). However, there are no png-files visible. I have to select another image type and then png again to see the content of the directory.
Can anyone confirm?
Nope, doing fine just naming the file without selecting filetypes.
I used this build btw :
A stupid bug, fixed.
If you would try the latest code, please download this executable file (http://www.mediafire.com/?i5rbpqs17gv4508). Before running it, make sure to put it under your AvsPmod folder.
Reino
9th February 2012, 18:49
Hehe, thx for the quick reply. It works!
Mounir
22nd February 2012, 06:38
Request: Can you add a LoadVirtualdubPlugin option ? I'm tired to write it manually
Edit > insert > LoadVirtualdubPlugin would be very much appreciated, thank you
wOxxOm
23rd February 2012, 17:48
I've spotted an error in AvsP.py:
def OnMenuVideoGotoFrameNumber(self, event):
#~ bmenu = self.GetMenuBar().GetMenu(2).FindItemByPosition(1).GetSubMenu()
#~ framenum = int(bmenu.GetLabel(event.GetId()))
menuItem = self.GetMenuBar().FindItemById(event.GetId())
framenum = int(menuItem.GetLabel().split()[0])
self.ShowVideoFrame(framenum)
Under certain circumstances (thousands of bookmarks loaded) menuItem.GetLabel() returns a label of executed menu item (character-string type, naturally) and nothing happens - AvsP just shows the error
Traceback (most recent call last):
File "C:\Program Files\[video]\AvsP\lib\library.zip\AvsP.py", line 6958, in OnMenuVideoGotoFrameNumber
ValueError: invalid literal for int() with base 10: 'Bookmarks'and doesn't execute the command.
ANGEL_SU
25th February 2012, 15:11
@wOxxOm
I believe there are duplicate IDs in menu items. The following code should be better:
def OnMenuVideoGotoFrameNumber(self, event):
#~ bmenu = self.GetMenuBar().GetMenu(2).FindItemByPosition(1).GetSubMenu()
#~ framenum = int(bmenu.GetLabel(event.GetId()))
#~ menuItem = self.GetMenuBar().FindItemById(event.GetId())
menuItem = self.menuBookmark.FindItemById(event.GetId())
framenum = int(menuItem.GetLabel().split()[0])
self.ShowVideoFrame(framenum)
wOxxOm
25th February 2012, 15:57
ANGEL_SU, thanks, now it shows another error message: OnMenuVideoGotoFrameNumber, AttributeError: 'NoneType' object has no attribute 'GetLabel'
btw, here's an instantly working *pythonic* version of Bookmarks at Intervals.py:
try:
totalframes = avsp.GetVideoFramecount()
value = float(avsp.GetTextEntry(\
"Values of 1 or greater will create bookmarks at that interval. \n"\
"e.g. a value of 1000 will create a bookmark every 1000 frames. \n"\
"Values between 0 and 1 will distribute bookmarks \n"\
"at even intervals throughout the video. \n"\
"e.g. a value of 0.2 will create 5 evenly spaced bookmarks.",\
default="1000", title="Bookmark Interval"))
step=int(value) if value>1 else int(totalframes*float(value))
avsp.SetBookmark(range(0,totalframes-1,step))
except:
pass
p.s. I've got an idea - bookmarks drawing could probably be much faster if _PaintSlider would skip painting when pixelpos is within 1 or 2 px of previously drawn one.
vdcrim
26th February 2012, 05:07
This is some changes I made to be (hopefully) incorporated in AvsPmod. It's mostly minor bugfixes, but also includes a pair of things worth mention:
Added an option to not prompt to save a script if it doesn't already exist on the filesystem. This is useful when making copies of a script in tabs to compare the previews.
Make a macro run in a new thread if it contains a comment line like "# run macro in new thread" somewhere. That makes possible to wait for the end of external commands started from the macro without locking AvsPmod.
The link also contains a new library.zip if someone wants to try.
UPDATE: link removed, changes incorporated in AvsPmod 2.3.0
btw, here's an instantly working *pythonic* version of Bookmarks at Intervals.py
Oh well, I also included a new version of that macro in the archive :D. Hope you don't mind. It needs the new library.zip:
value = avsp.GetTextEntry(['Choose a frame step or a number of intervals',
'Frame step', 'Number of intervals'],
'', 'Bookmarks at Intervals',
'sep', width=100)
if any(value):
totalframes = avsp.GetVideoFramecount()
step = float(value[0]) if value[0] else totalframes / float(value[1])
def float_range(start=0, end=10, step=1):
while start < end:
yield start
start += step
avsp.SetBookmark(float_range(0, totalframes - 1, step))
Mak0rz
27th February 2012, 18:03
I have a question about frame-accuracy.
As I previously mentioned I'm processing videos on my lab computer and I have to keep track very specific times at which certain events occur. However, sometimes the lab computer is used by one of my colleagues which leaves me nothing to do. I'd like to be able to use my laptop as a backup in case this happens, but I noticed that there is an inconsistency between the two machines. When I open the exact same video in AvsPmod (same version) on both computers they report the exact same video length, but the time recordings for these events are not equivalent between them.
Zarxrax, you made a quick update for me that allows AvsPmod to report seconds (thanks for this, it's been a real time-saver!). I assume it calculates this by some sort of simple "frame/framerate" calculation, is that right? I noticed that AvsPmod reports the framerate as 59.940fps, while my laptop reports it as 60.000fps. Would this be the cause of the inconsistency? Why is that happening?
AvsPmod version 2.2.1.1
Lab computer: Windows Vista 32-bit
My computer: Windows 7 64-bit
All videos are *.m2ts files encoded with some variant of MPEG-2 I believe. I'd give you more information about the encoding, but I actually don't know how to find it out.
LigH
28th February 2012, 07:40
If you read a file via DirectShowSource (probable for an M2TS source), then the result depends on the choice and settings of the used splitter and decoder filters registered in your system. Different PCs may have a different selection of filters or different settings for them, which may result in different clips provided via DirectShowSource.
Mak0rz
28th February 2012, 22:11
If you read a file via DirectShowSource (probable for an M2TS source), then the result depends on the choice and settings of the used splitter and decoder filters registered in your system. Different PCs may have a different selection of filters or different settings for them, which may result in different clips provided via DirectShowSource.
I forgot to mention that I'm using DSS2.
LigH
29th February 2012, 08:04
This is still a source plugin based on the DirectShow filter system. Just probably using Haali's Media Splitter to be able to read Transport Streams. Still, which decoder is used depends on each system.
Mak0rz
29th February 2012, 22:39
This is still a source plugin based on the DirectShow filter system. Just probably using Haali's Media Splitter to be able to read Transport Streams. Still, which decoder is used depends on each system.
So is this something I can install myself or is it inherent in the Windows operating systems? I would like to make the two systems equivalents for my video processing.
LigH
1st March 2012, 09:19
Just one example: On one PC you may have installed Xvid and ffdshow, but set up ffdshow to leave decoding of Xvid video to the Xvid DirectShow decoder. On another PC, you may have ffdshow set up to use libav to decode Xvid videos. So even if you have the same DirectShow filters installed, you will get different video sources into AviSynth because they are not set up identically. If you have even installed a different set of DirectShow filters, the result might be even more unreliable.
This is only one reason to try to avoid using DirectShowSource (both the original and DDS2) if possible. If you remux a Transport Stream to MKV, you will probably be able to use FFmpegSource instead, via the File Muxer.
Bernardd
2nd March 2012, 12:35
Hello,
When we use a script with ConditionalFilte like below, we need a ConditionalReader file.
ConditionalFilter(clip,clip_mod, "Is_true", "==", "false", false)\
ConditionalReader ("ConditionalReader_File.txt", "Is_true")
I have modified the AVSPmod macro "Bookmarks to chapter" to get a macro "Bookmarks to ConditionalReader". So i propose this macro file in attachment (change Txt extension in Py extension for use)
I do not know Python language, i have written this macro by many test crops and test mod, so this macro is not smart written but she is ok.
She is limited because, she produce only one kind of ConditionalReader File : file with Type = bool, Default = True, only Framenumber linked to value.
Perhaps, it is possible to create one interface to choose Type and Defaut, but i do not know write a macro like this.
Thank you for AvsPmod
Bernard
Mak0rz
2nd March 2012, 18:18
Just one example: On one PC you may have installed Xvid and ffdshow, but set up ffdshow to leave decoding of Xvid video to the Xvid DirectShow decoder. On another PC, you may have ffdshow set up to use libav to decode Xvid videos. So even if you have the same DirectShow filters installed, you will get different video sources into AviSynth because they are not set up identically. If you have even installed a different set of DirectShow filters, the result might be even more unreliable.
Is there any way to check and make sure they ARE set up identically?
This is only one reason to try to avoid using DirectShowSource (both the original and DDS2) if possible. If you remux a Transport Stream to MKV, you will probably be able to use FFmpegSource instead, via the File Muxer.
I'm not sure how possible this option is. I have hundreds of hours worth of video (therefore hundreds of gigabytes of it) to process and remuxing them will be time consuming. It also requires installing yet more software on the lab computer, which is something my supervisor is probably sick of permitting by now.
Furthermore, it means inconsistency between my video data. I already have a gigantic chunk of it processed using the DSS2 method on the computer that reports 59.940fps. Whether or not it's reporting accurate times I don't even know any more (I was under the impression that it was), but changing that now will result in inconsistency, which is equally non-favorable.
This is important because it's thesis data I'm dealing with.
Zarxrax
3rd March 2012, 13:41
Is there any way to check and make sure they ARE set up identically?
One thing that you could try is use media player classic (it doesnt require install), and in the options, disable all internal filters, and then when you right click on the video while its playing, go to the filters menu, and you get see what all filters are being used.
Mak0rz
3rd March 2012, 20:19
One thing that you could try is use media player classic (it doesnt require install), and in the options, disable all internal filters, and then when you right click on the video while its playing, go to the filters menu, and you get see what all filters are being used.
Ah, Found it! The lab computer required that I install ffdshow whereas the laptop didn't (It's using a Microsoft DTV-DVD video decoder that I'm guessing Windows 7 has, but Vista doesn't).
I have ffdshow set up exactly as I do on the lab computer; same build, same codecs, same settings, you name it. The problem now is that I can't seem to get Windows 7 to use them. It still decodes the video using the DTV-DVD decoder.
Any suggestions? I'm almost there! Thanks for your help so far, Zarxrax!
vdcrim
3rd March 2012, 20:34
The problem now is that I can't seem to get Windows 7 to use them. It still decodes the video using the DTV-DVD decoder.Use Win7DSFilterTweaker (http://www.codecguide.com/windows7_preferred_filter_tweaker.htm) or any other similar solution. More info in that page.
Mak0rz
3rd March 2012, 23:12
Use Win7DSFilterTweaker (http://www.codecguide.com/windows7_preferred_filter_tweaker.htm) or any other similar solution. More info in that page.
That did the trick! Thanks everyone!
vdcrim
4th March 2012, 18:30
I have modified the AVSPmod macro "Bookmarks to chapter" to get a macro "Bookmarks to ConditionalReader".
Nice idea. I've made a more featured version, but to use it you'll need to replace the library.zip in "AvsPmod\lib" with this one, or wait for the next AvsPmod release.
UPDATE: links removed, the macro is now included in AvsPmod 2.3.0
TheoRI
5th March 2012, 06:31
Fellow users,
I have some issues with a script and I would like your assistance
The script is a modification of the script developed by videoFred for super8 restoration (http://forum.doom9.org/showthread.php?t=144271)
I have tried to modify it for use with AvsPmod to enable easier adjustment of the various options
The issues I have are:
1) When i try to preview the video it often crashes...
2) All the time I get the following message:
Exception WindowsError: 'exception: access violation reading 0x09BC772F' in <bound method PIScriptEnvironment.__del__ of <avisynth.PIScriptEnvironment instance at 0x039E69E0>> ignored
3) I also get the error popup 5-6 times " Warning: Invalid slider tag for rescaling! Accept only +,-, or an integer" What am I defining wrong?
4) How can I modify the script so the input is requested from the user with a popup that can then navigate to a file (as in explorer)
I am running this on a dual Xeon X5660 96GB machine...
The script processes fine in VirtualDub
# film restoration script by videoFred.
# version with frame interpolation
# modified 30 august 2010
# added removedirtMC() as suggested by John Meyer
# cleaning, degraining, resizing, stabilizing, sharpening, auto-levels and auto-white balance.
# Modified by Theo Doucakis 2012.
#=============================================================================================
film="e:\telecine\24 A TEST L.avi" # source clip, please specify the full path here
#PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
result= "result4" # specify the wanted output here
# Select([<"Result", 0, 9, 2>], "Result1", "Result2", "Result3","Result4","Result5","ResultS1","ResultS2","ResultS3","ResultS4") # effort to create a pick list
#"resultS4" # specify the wanted output here
# Result options
# RESULT1: AUTOLEVELS,AUTOWHITE
# RESULT2: MANUAL LEVELS, AUTOWHITE
# RESULT3: AUTOLEVELS, MANUAL COLOR CORRECTIONS
# RESULT4: MANUAL LEVELS, MANUAL COLOR CORRECTIONS
# RESULT5: SPECIAL SERVICE CLIP FOR RESULT S5
# Adding an S before the result number outputs the comparison to the original ex resultS1 is a comparison of the original to the Result 1
[<separator="Film Speed parameters">]
trim_begin=0
play_speed=[<"Source Speed", 12, 24, 18>] #trim frames and play speed (PAL: 16.6666 or 18.75)
numerator=[<"Out Speed Numerator", 1, 60000, 24 >] #numerator for the interpolator (final frame rate)
denumerator=[<"Out Speed Denominator", 1, 1001, 1 >] #denumerator example: 60000/1001= 59.94fps
[<separator="Color and Level parameters">]
#COLOR AND LEVELS PARAMATERS
#----------------------------------------------------------------------------------------------------------------------------
saturation= [<"Saturation", 0, 2, 1.3>] #for all outputs default=1
gamma= [<"Gamma", 0, 3, 1.2>] # for all outputs default = 1
blue=[<"Blue", -255, 255, -2>]
red=[<"Red",-255,255,-3 >] #manual color adjustment, when returning result3 or result4. Values can be positive or negative
black_level=[<"Black In Level", 0, 255, 0>]
white_level=[<"White In Level", 0, 255, 246>]
output_black=[<"Black Out Level", 0, 255, 0>] # default 0
output_white=[<"White Out Level", 0, 255, 200>] # manual levels, when returning result4 default 255
[<separator="Film Size parameters">]
#SIZE, CROP AND BORDERS PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
CLeft=20 CTop=20 CRight=20 CBottom=20 #crop values after Depan and before final resizing
W_target=[<"Film Width % 8", 320, 1920, 1920>]
H_target=[<"Film Hight % 8", 240, 1080, 1080>] #final size after cropping
[<separator="Stabilising parameters">]
#STABILISING PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
maxstabH= [<"Vertical Stab (pixels) % 5", 0, 100, 25>]
maxstabV=[<"Horizontal Stab (pixels) % 5", 0, 100, 25>] #maximum values for the stabiliser (in pixels) 20 is a good start value
est_left=40 est_top=40 est_right=40 est_bottom=40 est_cont=1.4 #crop and contast values for special Estimate clip
[<separator="Clean and Denoise parameters">]
#CLEANING PARAMETERS
#--------------------------------------------------------------------------------------------------------------
dirt_blur= [<"Dirt blur", -1.0, 1.58, .5>] # some blur before cleaning to avoid pixel artifacts
dirt_strength=[<"Dirt Strenght", 0, 200, 45>] # set this lower for clean films.
#DENOISING PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
denoising_strength= [<"Denoise Strength % 50", 0, 5000, 900>] #denoising level of second denoiser: MVDegrainMulti()
denoising_frames= [<"Denoise Frames",0,10,4>] #number of frames for averaging (forwards and backwards) 3 is a good start value
block_size= [<"Block size %2", 2,24,16>] #block size of MVDegrainMulti()
block_size_v= block_size
block_over= [<"Block overlap",1,16,8>] #block overlapping of MVDegrainMulti()
[<separator="4 Step Sharpening parameters">]
# FOUR STEP SHARPENING PARAMETERS
#--------------------------------------------------------------------------------------------------------------------------------
USM_sharp_ness1= [<"Sharpness 1",0,500,120>] USM_radi_us1=[<"Radius 1",0,10,4>] #first sharpening (UnsharpMask) after cleaning with removedirtMC() Original values 120 & 4
USM_sharp_ness2= [<"Sharpness 2", 0, 200, 75>] USM_radi_us2=[<"Radius 2",0,10,3>]#second harpening (UnsharpMask) after cleaning with removedirtMC() Original values 80 & 3
USM_sharp_ness3= [<"Sharpness 3",0,100,40>] USM_radi_us3=[<"Radius 3",0,10,1>] #third sharpening (UnsharpMask) after degraining with MVDegrainMulti() Original values 40 & 1
last_sharp= [<"Final Sharp",0,5,0.4>] #final sharpening step after interpolation Original value 0.4
last_blur= [<"Final Blur",0,5,0.3>] #this smooths out the heavy sharpening effects original value 0.3
#AUTO LEVELS PARAMETER
#--------------------------------------------------------------------------------------------------------------------------------
X=2 # X is a special parameter for reducing the autolevels effect on the whites
X2=2 # X2 is a special parameter for reducing the autolevels effect on the blacks
# END VARIABLES, BEGIN SCRIPT
#===================================================================================================================
SetMemoryMax(1024) #set this to 1/3 of the available memory
SetMTMode(5) #disable all MT calls if you are using a single core computer
LoadPlugin("Deflicker.dll")
Loadplugin("Depan.dll")
LoadPlugin("DepanEstimate.dll")
Loadplugin("removegrainSSE3.dll")
LoadPlugin("removedirt.dll")
LoadPlugin("MVTools.dll")
LoadPlugin("MVTools2.dll")
Loadplugin("mt_masktools.dll")
Loadplugin("warpsharp.dll")
LoadPlugin("MT.dll")
LoadPlugin("autolevels.dll")
LoadPlugin("agc.dll")
Import("03_RemoveDirtMC.avs")
source1= Avisource(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12()
SetMTMode(1,0)
#DETERMINE Original Frame size, Final Frame size and Borders
#...................................................................................................................
W_source= width(source1)
H_source= height(source1)
AR_ratio=float(W_source)/float(H_source)
H_ratio = float(H_target) / float( H_source)
W_ratio= float(W_target)/float(W_source)
Mag_ratio = min(H_ratio,W_ratio)
W= 4*(int( Mag_ratio * W_source/4))
H= 4*(int( Mag_ratio * H_source/4))
Bord_right = max(0, int( (W_target-W) /2))
Bord_left = Bord_right
Bord_top= max(0, int( (H_target - H) /2))
Bord_bot= Bord_top
#STABILIZING/CROPPING
#...................................................................................................................
stab_reference= source1.crop(est_left,est_top,-est_right,-est_bottom).tweak(cont=est_cont).MT_binarize(threshold=80).greyscale().invert()
mdata=DePanEstimate(stab_reference,trust=1.0,dxmax=maxstabH,dymax=maxstabV)
stab=DePanStabilize(source1,data=mdata,cutoff=0.5,dxmax=maxstabH,dymax=maxstabV,method=0,mirror=15).deflicker()
stab2= stab.crop(CLeft,CTop,-CRight,-CBottom)
stab3=DePanStabilize(source1,data=mdata,cutoff=0.5,dxmax=maxstabH,dymax=maxstabV,method=0,info=true)
WS= width(stab)
HS= height(stab)
stab4= stab3.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS)
stab5= Lanczos4Resize(stab2,W,H).sharpen(0.5)
#CLEANING/PRESHARPENING/RESIZING
#...................................................................................................................
noise_baseclip= stab2.levels(0,gamma,255,0,255).tweak(sat=saturation).blur(dirt_blur)
cleaned= RemoveDirtMC(noise_baseclip,dirt_strength).unsharpmask(USM_sharp_ness1,USM_radi_us1,0)\
.unsharpmask(USM_sharp_ness2,USM_radi_us2,0).Lanczos4Resize(W,H)
#DEGRAINING/SHARPENING
#.................................................................................................................................................
vectors= cleaned.MVAnalyseMulti(refframes=denoising_frames, pel=2, blksize=block_size, blksizev= block_size_v, overlap=block_over, idx=1)
denoised= cleaned.MVDegrainMulti(vectors, thSAD=denoising_strength, SadMode=1, idx=2).unsharpmask(USM_sharp_ness3,USM_radi_us3,0)
#CHANGING FRAME RATE WITH INTERPOLATION/FINALSHARPENING
#.................................................................................................................................................
super= denoised.MSuper()
backward_vec= MAnalyse(super, blksize=block_size, blksizev= block_size_v, overlap=block_over, isb=true)
forward_vec= MAnalyse(super,blksize=block_size, blksizev= block_size_v, overlap=block_over, isb= false)
interpolated= denoised.MFlowFps(super, backward_vec, forward_vec, num=numerator, den= denumerator, ml=100)\
.sharpen(last_sharp).sharpen(last_sharp).blur(last_blur)
#RESULT1: AUTOLEVELS,AUTOWHITE
#.................................................................................................................................................
result1= interpolated.coloryuv(autowhite=true).addborders(X,0,0,0,$FFFFFF).addborders(0,0,X2,0,$000000)\
.autolevels().crop(X,0,-X2,-0).addborders(bord_left, bord_top, bord_right, bord_bot)
#RESULT2: MANUAL LEVELS, AUTOWHITE
#...................................................................................................................
result2= interpolated.levels(black_level,1.0,white_level,0,255).coloryuv(autowhite=true)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
#RESULT3: AUTOLEVELS, MANUAL COLOR CORRECTIONS
#...................................................................................................................
result3= interpolated.coloryuv(off_U=blue,off_V=red).addborders(X,0,0,0,$FFFFFF)\
.addborders(0,0,X2,0,$000000).autolevels().crop(X,0,-X2,-0).addborders(bord_left, bord_top, bord_right, bord_bot)
#RESULT4: MANUAL LEVELS, MANUAL COLOR CORRECTIONS
#...................................................................................................................
result4= interpolated.coloryuv(off_U=blue,off_V=red).levels(black_level,1.0,white_level,0,255)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
#RESULT5: SPECIAL SERVICE CLIP FOR RESULT S5
#...................................................................................................................
result5= overlay(source1,stab_reference,x=est_left,y=est_top).addborders(2,2,2,2,$FFFFFF).Lanczos4Resize(WS,HS)
#PARAMETERS FOR THE COMPARISONS
#.................................................................................................................................................
W2= W+bord_left+bord_right
H2= H+bord_top+bord_bot
final_framerate= numerator/denumerator
source4= Lanczos4Resize(source1,W,H).changeFPS(final_framerate).addborders(bord_left, bord_top, bord_right, bord_bot)
# COMPARISONS: ORIGINAL VS RESULTS
#.................................................................................................................................................
resultS1= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result1,"result1: autolevels, autowhite",size=28,align=2))
resultS2= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result2,"result2: autowhite, manual levels correction",size=28,align=2))
resultS3= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result3,"result3: autolevels, manual color correction",size=28,align=2))
resultS4= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result4,"result4: manual colors and levels correction",size=28,align=2))
#SPECIAL COMPARISON CLIP FOR TESTING THE STABILIZER
#.................................................................................................................................................
resultS5= stackhorizontal(subtitle(result5,"baseclip for stabiliser -only the B/W clip is used",size=32,align=2),\
subtitle(stab4,"test stabiliser: dx=horizontal, dy=vertical",size=32,align=5))
SetMTMode(5)
Eval(result)
Bernardd
5th March 2012, 10:59
Hello vdcrim,
I have a dream, you a have made it. Thank you very much.
But mode "Ranges of frames (with interpolation)" do not ok, the second value for interpolation is missing in text file.
Because i have not understood first the way to input int, float and string values, i propose a kind of commentary like in this mod of 69 number lign of ConditionalReader script.
message=[['Type (choice)', 'Default (choice or custom)', 'Value (choice or custom)'] (mod lign)
message=[['Type', 'Default', 'Value'] (original scrip lign)
Still, thank you for you quick action and answer.
Bernard
vdcrim
5th March 2012, 14:52
mode "Ranges of frames (with interpolation)" do not ok, the second value for interpolation is missing in text file.
You can just introduce in 'Value' the two necessary ints/floats separated by a space. Maybe I should have called it 'Value(s)'...
Also, note that while 'Value' is applied to all the frames selected, singular values can be specified by adding titles to the bookmarks (Video -> Titled bookmarks -> Set titles (manual)). If you do that while using the interpolation option the two values must be introduced as the title of either the start or end frame, but not one value in each bookmark [UPDATE: not anymore]. This is for consistency with the no interpolation option (and for save me some work). I just added it as a note to the script.
Because i have not understood first the way to input int, float and string values...Probably the best would be just leave blank by default these two fields (preferences section). I don't think that comment is neccesary.
Bernardd
5th March 2012, 18:40
Hi vdcrim,
OK, apologize, with your explanations all is clear now.
Thank you for this macro script.
Bernard
Revo
9th April 2012, 20:58
Hi, when using DgDecNV for decoding, and refreshing the avspmod window, gpu memory usage keeps adding up, untill the vram is full, and i get a decoder error. And even when i use the "release all videos from memory" feature, it does not lower memory usage, its not untill i actually restart avsp, that memory is released in vram.
This is super anoying, shouldn't it continue to just use the same amount of memory after a refresh?
And shouldn't the release video from memory feature actually do it?
Are my settings wrong, or does this need fixing?
Picture illustrating the problem, each step in memory usage is a refresh:
http://i.imgur.com/LZfvN.jpg
vdcrim
9th April 2012, 23:06
Have you tried opening the avs with another program? I don't own a Nvidia GPU, but with FFT3dGPU and AMD I also notice that not all the GPU memory is released until AvsPmod finishes, and the same happens with VirtualDub and mpc-hc using 'close' and 'open' file successively. It may be Avisynth or DgDecNV related.
Guest
10th April 2012, 01:06
Hi, when using DgDecNV for decoding, and refreshing the avspmod window, gpu memory usage keeps adding up, untill the vram is full, and i get a decoder error. And even when i use the "release all videos from memory" feature, it does not lower memory usage, its not untill i actually restart avsp, that memory is released in vram. When developing DGDecNV and working with Zathor to get MEGUI to play nice with it, I used VirtualDub to test proper deinstantiation of filter instances on refresh. Load your AVS in VirtualDub and start hitting F2 to reopen the script. You should see stable memory usage. I guess that Avspmod is not properly closing scripts on refresh.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.