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 > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 16th January 2012, 16:08   #701  |  Link
ANGEL_SU
Registered User
 
Join Date: May 2007
Posts: 109
Quote:
Originally Posted by TheProfileth View Post
.. 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. Before running it, make sure to put it under your AvsPmod folder.
ANGEL_SU is offline   Reply With Quote
Old 17th January 2012, 12:48   #702  |  Link
unreal666
Registered User
 
Join Date: Sep 2006
Location: Russia
Posts: 14
Quote:
Originally Posted by ANGEL_SU View Post
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.

Quote:
Originally Posted by ANGEL_SU View Post
2. IsXxx(clip), HasXxx(clip) and GetXxx(clip) will be classfied as clip properties.
GetLeftChannel & GetRightChannel return clip => they can not be properties.
Quote:
Originally Posted by ANGEL_SU View Post
You can override this behavior by modifying filterdb.dat which is a general text file indeed.
I know
unreal666 is offline   Reply With Quote
Old 17th January 2012, 18:21   #703  |  Link
ChrisW77
Registered User
 
Join Date: Sep 2006
Posts: 72
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.
ChrisW77 is offline   Reply With Quote
Old 17th January 2012, 18:38   #704  |  Link
Zarxrax
Registered User
 
Join Date: Dec 2001
Posts: 1,169
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.
Zarxrax is offline   Reply With Quote
Old 17th January 2012, 18:48   #705  |  Link
jmartinr
Registered User
 
jmartinr's Avatar
 
Join Date: Dec 2007
Location: Enschede, NL
Posts: 286
Quote:
Originally Posted by ChrisW77 View Post
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:
Code:
file=GetSystemEnv("filename")

FFVideoSource(file)

etc. etc.
With a batchfile with in the midde something like:
Code:
		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.
__________________
Roelofs Coaching
jmartinr is offline   Reply With Quote
Old 19th January 2012, 15:34   #706  |  Link
ChrisW77
Registered User
 
Join Date: Sep 2006
Posts: 72
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.

Quote:
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.
ChrisW77 is offline   Reply With Quote
Old 19th January 2012, 16:52   #707  |  Link
Zarxrax
Registered User
 
Join Date: Dec 2001
Posts: 1,169
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.
Zarxrax is offline   Reply With Quote
Old 19th January 2012, 19:48   #708  |  Link
jmartinr
Registered User
 
jmartinr's Avatar
 
Join Date: Dec 2007
Location: Enschede, NL
Posts: 286
Quote:
Originally Posted by Zarxrax View Post
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.
__________________
Roelofs Coaching
jmartinr is offline   Reply With Quote
Old 19th January 2012, 20:31   #709  |  Link
Mak0rz
Registered User
 
Join Date: Aug 2011
Posts: 15
Quote:
Originally Posted by Zarxrax View Post
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?
Mak0rz is offline   Reply With Quote
Old 19th January 2012, 20:42   #710  |  Link
Zarxrax
Registered User
 
Join Date: Dec 2001
Posts: 1,169
Quote:
Originally Posted by Mak0rz View Post
Do you accept donations?
No thanks, its cool
Zarxrax is offline   Reply With Quote
Old 20th January 2012, 00:26   #711  |  Link
vdcrim
Registered User
 
Join Date: Dec 2011
Posts: 191
@ChrisW77

This should work:
Code:
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

Last edited by vdcrim; 9th June 2012 at 13:02. Reason: update for AvsPmod 2.3.0
vdcrim is offline   Reply With Quote
Old 20th January 2012, 01:43   #712  |  Link
ChrisW77
Registered User
 
Join Date: Sep 2006
Posts: 72
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.
ChrisW77 is offline   Reply With Quote
Old 28th January 2012, 20:45   #713  |  Link
wOxxOm
Oz of the zOo
 
Join Date: May 2005
Posts: 205
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.
wOxxOm is offline   Reply With Quote
Old 29th January 2012, 07:48   #714  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,912
Tis a shame that there is no way to relate argument ranges within a plug description (Avisynth General).
__________________
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; 29th January 2012 at 07:53.
StainlessS is online now   Reply With Quote
Old 3rd February 2012, 17:28   #715  |  Link
vdcrim
Registered User
 
Join Date: Dec 2011
Posts: 191
Improved GetTextEntry macro function

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


This is an example of dialog box showing the new different types of entry. It was generated with this macro demo:
Code:
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')

Last edited by vdcrim; 9th June 2012 at 13:35. Reason: update for AvsPmod 2.3.0
vdcrim is offline   Reply With Quote
Old 3rd February 2012, 22:54   #716  |  Link
Zarxrax
Registered User
 
Join Date: Dec 2001
Posts: 1,169
cool, thanks vdcrim
Zarxrax is offline   Reply With Quote
Old 4th February 2012, 01:54   #717  |  Link
wOxxOm
Oz of the zOo
 
Join Date: May 2005
Posts: 205
How about implementing a fullscreen video mode toggle? It'd be a killer feature.
wOxxOm is offline   Reply With Quote
Old 4th February 2012, 05:10   #718  |  Link
ANGEL_SU
Registered User
 
Join Date: May 2007
Posts: 109
Quote:
Originally Posted by vdcrim View Post
...
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.
ANGEL_SU is offline   Reply With Quote
Old 4th February 2012, 16:03   #719  |  Link
Yellow_
Registered User
 
Join Date: Sep 2009
Posts: 378
Quote:
Originally Posted by wOxxOm View Post
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. :-(
Yellow_ is offline   Reply With Quote
Old 7th February 2012, 00:19   #720  |  Link
vdcrim
Registered User
 
Join Date: Dec 2011
Posts: 191
Quote:
Originally Posted by ANGEL_SU View Post
Nice work. If possible, please look OptionsDialog class in wxp.py and merge your code into.
Done.

Edit: added this 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

Last edited by vdcrim; 9th June 2012 at 13:40. Reason: update for AvsPmod 2.3.0
vdcrim 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 18:02.


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