Log in

View Full Version : AvsPmod 2.5.1


Pages : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 [16] 17 18 19 20 21 22 23 24 25 26

Mounir
5th May 2012, 16:48
I have a problem today when i try to import my script:

Traceback (most recent call last):
File "AvsP.pyo", line 6495, in OnMenuFileOpen
File "AvsP.pyo", line 9354, in OpenFile
File "wx\stc.pyo", line 2934, in SetText
File "encodings\cp1252.pyo", line 15, in decode
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 6398: character maps to <undefined>

What could cause this ?

vdcrim
5th May 2012, 18:08
Does your script includes the character ? 0x81 maps to in extended ASCII but it's undefined in CP-1252 (the code used by Windows in most Western countries). Extended ASCII is not very used nowadays, you should set your editor to UTF-8 or regular ASCII.

I'd recommend you Notepad2-mod (https://code.google.com/p/notepad2-mod/). It's as fast as Window's notepad but includes syntax highlighting for a bunch of languages, AviSynth included.

Mounir
13th May 2012, 06:30
@vdcrim

Here is my full script in the hope you can find out what's wrong (i tried to encode it in UTF-8 w/o luck)
http://www.mediafire.com/?vds8jqaud2rymmt

When i try to open it avsp won't open

error returned:
Traceback (most recent call last):
File "AvsP.pyo", line 4275, in OnData
File "AvsP.pyo", line 9354, in OpenFile
File "wx\stc.pyo", line 2934, in SetText
File "encodings\cp1252.pyo", line 15, in decode
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 5928: character maps to <undefined>

vdcrim
13th May 2012, 16:38
Here is my full script in the hope you can find out what's wrong
Here is the problem:
# RGBEQ (Hue with 3 sliders, R'G'B/3 mode, #1 slider=+12, #2 slider=0 (default), #3 slider=+14 )
LoadvirtualdubPlugin("C:\Program Files (x86)\virtualdub1.9\plugins\rgbeq.vdf","rgbeq",1)
rgbeq("€Œ€€€€€€€†€€ [...] )
Are really these the characters you're seeing in the "save processing settings" file? I tried to reproduce your settings and got this:
VirtualDub.video.filters.Add("RGB Equalizer(2.2)");
VirtualDub.video.filters.instance[0].Config("20G2020G2020G2020G2020G2C20G2020G2020G2020G2020G2020G2020G2020G2020
G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G20
20G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G
2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2020G2E20G2020G2020G202
0G2020G2020G2020G2020G2020G2020G2020G2000G4100G4100G4100G4100G4100G4100G4100G4100G4100G4100H4H00G0
J00001");
All valid ASCII characters.

This reminds me:
Request: Can you add a LoadVirtualdubPlugin option ? I'm tired to write it manually
Edit > insert > LoadVirtualdubPlugin would be very much appreciated, thank you
Use this library.zip for now.
UPDATE: AvsPmod 2.3.0 released, link removed

Mounir
13th May 2012, 18:49
That's odd i see €€€€..... when i open the .vdf

What am i supposed to do with this library ?

vdcrim
13th May 2012, 19:20
That's odd i see ..... when i open the .vdf
I don't know, check that you're using the latest versions of Virtualdub and RGB Equalizer. Also try opening the vdscript file with another editor, like the one previously linked.

What am i supposed to do with this library ?

Replace the one in the "Avspmod\lib" directory. Then you can use the updated "Insert plugin" menu option to also insert VirtualDub plugins, or drag & drop the vdf file. Don't forget to change the preroll parameter if necessary.

Mounir
16th May 2012, 00:08
Which rgbeq version did you use ? I use the v2.1, i had no luck to get numbers instead of €€.. so far

vdcrim
16th May 2012, 01:42
Latest is v2.2 (http://fdump.narod.ru/equalizer.htm). I just checked v2.1 and yes, everywhere.

LigH
16th May 2012, 06:55
IIRC, binary filter data should be stored with Base64 encoding or similar...

wOxxOm
16th May 2012, 23:50
Periodic autosaving of the session would be much appreciated - dozens of times I've had to use procexp's memory dumper to recover unsaved script that crashed AvsPmod and sometimes it didn't help..
--------------------
Number-of-replacements-messagebox after ReplaceAll shouldn't steal focus from Search & Replace dialog after it's closed, instead it should report its _status_ in _statusbar_ like convenient text editors do, so instead of
dlg = wx.MessageDialog( ................. )
dlg.ShowModal()
dlg.Destroy()
def OnReplaceAllPressed(event): should have
self.app.GetStatusBar().SetStatusText(_('Replaced %(count)i times') % locals())

The same goes for def OnFindPressed(event):

Zarxrax
6th June 2012, 23:34
vdcrim has contributed lots of changes to AvsPmod, and he has also created a new Git Repository for the project: https://github.com/avspmod/avspmod

From here on out, I don't think I will be posting much more regarding AvsPmod, as things have gotten really busy for me, and I don't have the time that I used to. My own contributions are not the ones that have been pushing AvsPmod forward over the past couple of years, so hopefully things will continue to improve just as always. I will be glad to continue updating the first post with new versions and stuff, if necessary.

Version 2.3.0
- Add an option to decide based on the video resolution the coefficients used in the conversion to RGB for the video preview
- Add 'Run analysis pass' to the 'Video' menu (for two-pass filters)
- Add periodic session backup option
- Add an option to not prompt to save a script if it doesn't already exist on the filesystem
- Add original source time (%ST) and encoded frame type (%EFT) to the video status bar options (only works with ffms as source filter and no temporal filters in the script)
- VirtualDub and VFAPI plugins can be also inserted now with the 'Insert plugin...' menu option and the 'GetPluginString' macro function, and be dropped over a script
- Fix exception opening the crop editor
- The default filename in a save script dialog wasn't taken from the first source in the script in some cases
- Saving an image with an unsaved script not longer causes to include a '*' in the default output filename
- Solved single instance + restart AvsPmod + child process still running -> socket error
- The interface language can be chosen now from the options. Several translations are included.
- Add macro files to the translations
- The macro documentation can be checked now with 'help(avsp.function)' or 'help(avsp)' from a macro
- All included macros and macro functions support unicode strings now
- Add persistent storage to macros - 'Options' dictionary
- Macros can run now in its own thread by including a comment line like: # run macro in new thread
- The macro API functions are now thread-safe
- Add a new macro function 'SafeCall' for thread-safe calls in separate-thread macros and tools
- Add a new macro function 'GetPixelInfo' that waits for the user to click on the video preview and returns the coordinates and colour of that point
- Add a new macro function 'GetVar' to retrieve the contents of a specified Avisynth variable. Some limitations apply.
- Update GetTextEntry macro function with new types of entry, multiple entries per row and customizable width, backwards compatible
- Add an optional cancel button to the MsgBox macro function
- SaveImage macro function also accepts now JPEG quality as a parameter
- Fix ProgressBox macro function 'Cancel' button
- Fix SaveScript macro function 'filename' parameter
- Add new macro 'ConditionalReader file from bookmarks'
- Update some macros with the improvements in GetTextEntry
- A number of intervals can be specified directly now in the 'Bookmarks at Intervals' macro
- Set the Large Address Aware flag
- Python 2.6-2.7 is required now
- Other minor changes and fixes

SubJunk
7th June 2012, 00:58
Thanks for the update!

LigH
7th June 2012, 08:07
I just wondered how to download an end-user build from github ... when I remembered that you keep updating the start post of this thread. :o

Zarxrax
7th June 2012, 14:57
I just wondered how to download an end-user build from github ... when I remembered that you keep updating the start post of this thread. :o

There is in fact a download button on the github page as well, towards the top right.

LigH
7th June 2012, 15:26
Indeed, quite subtle...

https://github.com/AvsPmod/AvsPmod/downloads

Mounir
7th June 2012, 17:59
Nice i will try this out right now. Before you go to new horizons Zarxax try to find a successor at least ,it would be unfortunate that avspmod development is stopped in its tracks.

vdcrim
8th June 2012, 19:38
Two new macros taking advantage of the changes introduced in AvsPmod 2.3.0:

GraMaMa mask (http://www.mediafire.com/download.php?qo7p33rc8vrzkij)
Overlay a clip on top of another using a mask with a prescribed shape

Requirements:
- GraMaMa AviSynth filter <http://www.wilbertdijkhof.com/>

Instructions:
This macro uses the last assigned variable as the overlay clip and 'last'
as the overlayed. Example:

ColorBars(pixel_type="yv12")
alt=Invert()

becomes:

ColorBars(pixel_type="yv12")
alt=Invert()
Overlay(alt,mask=GraMaMa(mode=1,a=200,b=200,rad=100,rad2=100,binarize=False).Invert(),mode="blend")

where (a, b) is the center of the mask, selected by clicking on the video
preview.
Create GIF with ImageMagick (http://www.mediafire.com/download.php?0q3bde6s76ygw8r)
Create GIF with ImageMagick

Requirements:
- convert.exe from ImageMagick <http://www.imagemagick.org>

By default the executable is expected to be found in 'AvsPmod\tools'
or one of its subdirectories. A path will be asked for in the first
run otherwise.

If you only need ImageMagick for this macro then do the following:
1) download the portable static version of IM
2) extract only convert.exe
3) place it on the 'AvsPmod\tools' directory

The GIF creation may take a while for long clips.

For loading/saving other formats with ImageMagick check out Wilbert's
Immaavs AviSynth plugin <http://www.wilbertdijkhof.com>


Also, a new repository for my macros spreaded around this forum: https://github.com/vdcrim/avsp-macros

real.finder
10th June 2012, 17:13
hi vdcrim

I tried to use Create GIF with ImageMagick

But this error has occurred

http://i.imgur.com/CIuNg.png

thank you

________


1st edited:

thank you again, but both of them don't work, and the same problem above.

note: this error happens after the chosen settings of "Create GIF with ImageMagick" and press ok button.

_________

2nd edit: thank you very much, it's work now, all of them but the C one show empty CLI in the work, I wait the final stable version.

vdcrim
10th June 2012, 23:45
I don't have any error here. Try the two modified versions included in this archive [link removed] and tell me if it works for you. Please answer by editing your previous post or sending me a pm to avoid bumping this thread.

Edit 1: please try again [link removed]

Edit 2: fixed. It was some handle inheritance issue that only happens under specific circumstances.

sl1pkn07
25th June 2012, 00:03
in the middle of possibility... is posssible port this to use with avxsynth (linux)?

greetings

vdcrim
26th June 2012, 19:15
is posssible port this to use with avxsynth (linux)?
Most of the code should be already compatible. AvsP is written in Python + wxWidgets and there's a port to Unix using GTK as base. However there's some important things that would need work. This is what I can think of:

Adapt the Python AviSynth C API wrapper to also accept AvxSynth.
Possible incompatibilities between Python on Windows and Unix, and wxWidgets and wxGTK.
Video preview. While the preview could be displayed with wxPython, the perfomance would be very poor and so AvsP uses VFW direcly. Something similar would be necessary for Unix.
On Windows the AviSynth location is read from the registry.
avs files association.
Currently AvsP stores all its settings in the program's directory. Something like this would be better: if options.dat exists on the program's directory, use portable mode (as it does now). Otherwise, use the user profile / HOME.


Personally I don't have the time or will to do this, at least right now. Contributors are welcome.

Stephen R. Savage
26th June 2012, 21:56
Most of the code should be already compatible. AvsP is written in Python + wxWidgets and there's a port to Unix using GTK as base. However there's some important things that would need work. This is what I can think of:

Adapt the Python AviSynth C API wrapper to also accept AvxSynth.
Possible incompatibilities between Python on Windows and Unix, and wxWidgets and wxGTK.
Video preview. While the preview could be displayed with wxPython, the perfomance would be very poor and so AvsP uses VFW direcly. Something similar would be necessary for Unix.
On Windows the AviSynth location is read from the registry.
avs files association.
Currently AvsP stores all its settings in the program's directory. Something like this would be better: if options.dat exists on the program's directory, use portable mode (as it does now). Otherwise, use the user profile / HOME.


Personally I don't have the time or will to do this, at least right now. Contributors are welcome.

I briefly tried to port avisynth.py to Avxsynth. On the face of it, the only required change is swapping "avisynth=ctypes.windll.avisynth" for the appropriate Linux call, but I kept getting segmentation faults in Python when trying to call avs_get_var and avs_set_var, presumably because of some incompatibility in the exact types being passed.

Edit: The problem is related to 64-bit code and ctypes. It should be much simpler to port AvsPmod to 32-bit AvxSynth.

LigH
27th June 2012, 08:58
Wish:

I could use an export of the syntax-highlighted source as e.g. HTML or RichText, to format it in a word-processor and print parts of it. There are other text editors with syntax highlighter support, but their selection of known filters and functions is usually less complete.

And an own highlight class for named function parameters might be missing yet.

vdcrim
27th June 2012, 22:51
Come to think of it, there's actually not printing support in AvsPmod. A virtual printer could be used to export the styled text. I just tried applying some borrowed code and it seems to work OK. I'll take a better look at it in a few days.

lansing
29th June 2012, 14:27
bug found, when i start the crop editor and then zoom, the cropping doesn't work, or giving me random crop numbers like -199 when i jump to another frame.
When I zoomed then crop editor, it will pop a message saying can't crop with zoom.

lordsmurf
1st July 2012, 09:58
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

In my case, it was caused by having ffavisynth.avsi in the plugins folder.
What's strange is that AvsPmod had been working fine.
I moved it to a backup folder (plugins.backup) in case I need it again.

It's nice to see AvsPmod is still getting community support and updates. :thanks:

matfra
5th July 2012, 14:57
Im trying to load a virtualdubplugin into avsp. I know it was working before with older version of ASVP.
This is the line im importing.
LoadVirtualDubPlugin ("C:\Program Files (x86)\AviSynth 2.5\plugins\CCD.VDF", "CCD",0)
This is the error its giving me.
Traceback (most recent call last):
File "AvsP.pyo", line 7472, in OnMenuVideoToggle
File "AvsP.pyo", line 11313, in ShowVideoFrame
File "AvsP.pyo", line 11782, in UpdateScriptAVI
File "pyavs.pyo", line 168, in __init__
File "avisynth.pyo", line 117, in Invoke
WindowsError: exception: access violation reading 0xA6446895

vdcrim
5th July 2012, 15:24
I just checked that plugin and works fine for me. Usually "WindowsError: exception: access violation reading ..." errors are related to Avisynth plugins. Try moving the contents of your plugins directory to another place and see if the exception occurs. If not, add your plugins back in bunches to get the faulty one.

Also, if you're using SEt's 2.6 builds update to the latest one, there were some troubles with VD plugins in the past.

Stephen R. Savage
19th July 2012, 20:07
I briefly tried to port avisynth.py to Avxsynth. On the face of it, the only required change is swapping "avisynth=ctypes.windll.avisynth" for the appropriate Linux call, but I kept getting segmentation faults in Python when trying to call avs_get_var and avs_set_var, presumably because of some incompatibility in the exact types being passed.

Edit: The problem is related to 64-bit code and ctypes. It should be much simpler to port AvsPmod to 32-bit AvxSynth.

For what it's worth, these changes to avisynth.py allow it to be used with AvxSynth. The frame-drawing code is a little bit trickier to port.


--- avisynth.py.orig 2012-07-19 15:00:31.956879785 -0400
+++ avisynth.py 2012-07-19 15:03:54.632940526 -0400
@@ -1,8 +1,9 @@
import ctypes
import sys

-avidll = ctypes.windll.avisynth
-
+#avidll = ctypes.windll.avisynth
+avidll = ctypes.CDLL("libavxsynth.so")
+
#constants
PLANAR_Y=1<<0
PLANAR_U=1<<1
@@ -503,15 +504,24 @@



-GETFRAME=ctypes.WINFUNCTYPE(ctypes.POINTER(VideoFrame),
+#GETFRAME=ctypes.WINFUNCTYPE(ctypes.POINTER(VideoFrame),
+# ctypes.POINTER(FilterInfo),ctypes.c_int)
+#GETPARITY=ctypes.WINFUNCTYPE(ctypes.c_int,ctypes.POINTER(FilterInfo),
+# ctypes.c_int)
+#GETAUDIO=ctypes.WINFUNCTYPE(ctypes.c_int,ctypes.POINTER(FilterInfo),
+# ctypes.c_void_p,ctypes.c_int64,ctypes.c_int64)
+#SETCACHEHINTS=ctypes.WINFUNCTYPE(ctypes.c_int,ctypes.POINTER(FilterInfo),
+# ctypes.c_int,ctypes.c_int)
+#FREEFILTER=ctypes.WINFUNCTYPE(None,ctypes.POINTER(FilterInfo))
+GETFRAME=ctypes.CFUNCTYPE(ctypes.POINTER(VideoFrame),
ctypes.POINTER(FilterInfo),ctypes.c_int)
-GETPARITY=ctypes.WINFUNCTYPE(ctypes.c_int,ctypes.POINTER(FilterInfo),
+GETPARITY=ctypes.CFUNCTYPE(ctypes.c_int,ctypes.POINTER(FilterInfo),
ctypes.c_int)
-GETAUDIO=ctypes.WINFUNCTYPE(ctypes.c_int,ctypes.POINTER(FilterInfo),
+GETAUDIO=ctypes.CFUNCTYPE(ctypes.c_int,ctypes.POINTER(FilterInfo),
ctypes.c_void_p,ctypes.c_int64,ctypes.c_int64)
-SETCACHEHINTS=ctypes.WINFUNCTYPE(ctypes.c_int,ctypes.POINTER(FilterInfo),
+SETCACHEHINTS=ctypes.CFUNCTYPE(ctypes.c_int,ctypes.POINTER(FilterInfo),
ctypes.c_int,ctypes.c_int)
-FREEFILTER=ctypes.WINFUNCTYPE(None,ctypes.POINTER(FilterInfo))
+FREEFILTER=ctypes.CFUNCTYPE(None,ctypes.POINTER(FilterInfo))

FilterInfo._fields_=[("child",ctypes.c_void_p),
("vi",VideoInfo),
@@ -598,7 +608,9 @@
avs_vsprintf.restype = ctypes.c_char_p
avs_vsprintf.argtypes=[PIScriptEnvironment,ctypes.c_char_p,ctypes.c_void_p]

-APPLYFUNC=ctypes.WINFUNCTYPE(ctypes.POINTER(AVS_Value),PIScriptEnvironment,
+#APPLYFUNC=ctypes.WINFUNCTYPE(ctypes.POINTER(AVS_Value),PIScriptEnvironment,
+# AVS_Value,ctypes.c_void_p)
+APPLYFUNC=ctypes.CFUNCTYPE(ctypes.POINTER(AVS_Value),PIScriptEnvironment,
AVS_Value,ctypes.c_void_p)

avs_add_function=avidll.avs_add_function
@@ -638,7 +650,8 @@
ctypes.c_int,ctypes.POINTER(ctypes.c_ubyte),
ctypes.c_int,ctypes.c_int,ctypes.c_int]

-SHUTDOWNFUNC=ctypes.WINFUNCTYPE(ctypes.c_void_p,PIScriptEnvironment)
+#SHUTDOWNFUNC=ctypes.WINFUNCTYPE(ctypes.c_void_p,PIScriptEnvironment)
+SHUTDOWNFUNC=ctypes.CFUNCTYPE(ctypes.c_void_p,PIScriptEnvironment)

avs_at_exit=avidll.avs_at_exit
avs_at_exit.restype=None

FlimsyFeet
19th July 2012, 22:04
Took me ages to work out why my script wasn't workign as expected, turned out to be a strange bug in AvsPmod!

Try this script:
colorbars()
levels (0,1,255,0,255)
Press F5, then try playing with the sliders - they have no effect.

Removing the space between the "levels" and the "(" fixes the problem.

LigH
20th July 2012, 09:37
Well, the AvsP source parser is not the same as the AviSynth source parser; one is tolerant about spaces between name and parameter list of functions, the other isn't. I would not recommend spaces between them, ever, no matter if it is tolerated. But there are even more strict "style guidelines" for different languages (e.g. Python PEP#)...

vdcrim
20th July 2012, 14:09
@Stephen R. Savage - thanks

@FlimsyFeet - fixed

I won't be contributing more for a while, so expect a minor release in a few days. There's some things I'd like to do that won't make it:
- syntax highlighting rewrite
- using the crop editor while the video is zoomed or flipped
- regular expressions in the find/replace dialog

Zarxrax
26th July 2012, 16:46
vdcrim's new release is now linked in the first post, with the following changes:

Version 2.3.1
- Add detached video preview window visibility options:
- Always on top of other windows ('Options' menu)
- Always on top of the main window ('Program Settings' dialog, needs restart)
- Add printing support
- Disable showing line numbers if 'line margin width' option is 0
- Don't fail to launch AvsPmod if the option files are damaged
- Work around event ID overlapping when working with a large number of bookmarks by disabling 'Go to bookmark' submenu for more than 1000
- Add version info to the macro API
- Add draw lines option to the GetPixelInfo macro function, and fix marks position
- Rename the last executed macro return value from 'last' to 'avsp.Last'. The former is still accepted.
- Add 'Macros - Extra' section to the translation files. Strings that no longer exist are deleted from the translation files when updating to a new version. That means that translation strings added for the user for macros not bundled with AvsPmod are lost. This new section at the end is copied verbatim from the original file.
- Rename 'Bookmarks from Chapter' macro to 'Import bookmarks from file' and add support for some other file types:
- TFM log (combed, possible combed and u/v mismatches)
- x264 QP file
- XviD and SCXviD log
- Fix performance issues in the 'Bookmarks at Intervals' macro
- Other minor changes and fixes

Stephen R. Savage
27th July 2012, 17:33
I've hacked away the platform-dependent parts of AvsP.py and pyavs.py:


--- AvsP.py.orig 2012-07-22 00:03:10.000000000 -0400
+++ AvsP.py 2012-07-27 12:22:55.871314784 -0400
@@ -50,8 +50,9 @@
import StringIO
import textwrap
import ctypes
-import _winreg
-import _md5 as md5
+##import _winreg
+##import _md5 as md5
+from hashlib import md5
import __builtin__
from collections import OrderedDict, Iterable, Sequence, MutableSequence

@@ -5107,25 +5108,25 @@
self.options['version'] = self.version
# Get the avisynth directory as necessary
if not os.path.isdir(self.options['avisynthdir']):
- try:
- # Get the avisynth directory from the registry
- key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'Software\\AviSynth')
- name, value, typereg = _winreg.EnumValue(key, 0)
- if os.path.isdir(value):
- self.options['avisynthdir'] = value
- else:
- raise WindowsError
- key.Close()
- except WindowsError:
- # Get the avisynth directory from the user with a dialog box
- defaultdir = os.environ.get('PROGRAMFILES')
- if defaultdir is None:
- defaultdir = ''
- dlg = wx.DirDialog(self, 'Select the Avisynth directory', defaultdir)
- ID = dlg.ShowModal()
- if ID==wx.ID_OK:
- self.options['avisynthdir'] = dlg.GetPath()
- dlg.Destroy()
+## try:
+## # Get the avisynth directory from the registry
+## key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'Software\\AviSynth')
+## name, value, typereg = _winreg.EnumValue(key, 0)
+## if os.path.isdir(value):
+## self.options['avisynthdir'] = value
+## else:
+## raise WindowsError
+## key.Close()
+## except WindowsError:
+## # Get the avisynth directory from the user with a dialog box
+## defaultdir = os.environ.get('PROGRAMFILES')
+## if defaultdir is None:
+ defaultdir = ''
+ dlg = wx.DirDialog(self, 'Select the Avisynth directory', defaultdir)
+ ID = dlg.ShowModal()
+ if ID==wx.ID_OK:
+ self.options['avisynthdir'] = dlg.GetPath()
+ dlg.Destroy()
self.options['avisynthhelpfile'] = self.options['avisynthhelpfile'].replace('%avisynthdir%',$
# Fix recentfiles as necessary???
try:
@@ -8161,33 +8162,34 @@
s2 = _('Do you wish to continue?')
ret = wx.MessageBox('%s\n\n%s' % (s1, s2), _('Warning'), wx.YES_NO|wx.ICON_EXCLAMATION)
if ret == wx.YES:
- if hasattr(sys,'frozen'): # run in py2exe binary mode
- value = '"%s" "%%1"' % sys.executable
- else: # run in source mode
- dirname = os.path.dirname(__file__)
- basename = os.path.basename(__file__)
- if not dirname:
- dirname = os.getcwd()
- script = os.path.join(dirname, basename)
- value = '"%s" "%s" "%%1"' % (sys.executable, script)
- try:
- hkey = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, 'avsfile\\shell\\Open\\command', 0$
- _winreg.SetValue(_winreg.HKEY_CLASSES_ROOT, 'avsfile\\shell\\Open\\command', _winreg$
- _winreg.CloseKey(hkey)
- except WindowsError, e:
- print e
- try:
- hkey = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, 'Software\\Microsoft\\Windows\\Cur$
- _winreg.DeleteValue(hkey, 'Application')
- _winreg.CloseKey(hkey)
- except WindowsError, e:
- print e
- try:
- hkey = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, 'Software\\Microsoft\\Windows\\Cur$
- _winreg.DeleteKey(_winreg.HKEY_CURRENT_USER, 'Software\\Microsoft\\Windows\\CurrentV$
- _winreg.CloseKey(hkey)
- except WindowsError, e:
- print e
+ pass
+## if hasattr(sys,'frozen'): # run in py2exe binary mode
+## value = '"%s" "%%1"' % sys.executable
+## else: # run in source mode
+## dirname = os.path.dirname(__file__)
+## basename = os.path.basename(__file__)
+## if not dirname:
+## dirname = os.getcwd()
+## script = os.path.join(dirname, basename)
+## value = '"%s" "%s" "%%1"' % (sys.executable, script)
+## try:
+## hkey = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, 'avsfile\\shell\\Open\\command',$
+## _winreg.SetValue(_winreg.HKEY_CLASSES_ROOT, 'avsfile\\shell\\Open\\command', _winr$
+## _winreg.CloseKey(hkey)
+## except WindowsError, e:
+## print e
+## try:
+## hkey = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, 'Software\\Microsoft\\Windows\\C$
+## _winreg.DeleteValue(hkey, 'Application')
+## _winreg.CloseKey(hkey)
+## except WindowsError, e:
+## print e
+## try:
+## hkey = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, 'Software\\Microsoft\\Windows\\C$
+## _winreg.DeleteKey(_winreg.HKEY_CURRENT_USER, 'Software\\Microsoft\\Windows\\Curren$
+## _winreg.CloseKey(hkey)
+## except WindowsError, e:
+## print e


def OnMenuConfigureShortcuts(self, event):
@@ -10238,9 +10240,9 @@
setSavePoint = False
if crc is not None:
try:
- crc2 = md5.new(txtFromFile).digest()
+ crc2 = md5(txtFromFile).hexdigest()
except UnicodeEncodeError:
- crc2 = md5.new(txtFromFile.encode(encoding)).digest()
+ crc2 = md5(txtFromFile.encode(encoding)).hexdigest()
if crc != crc2:
self.reloadList.append((index, scriptname, txt))
self.OpenFile(filename=scriptname, scripttext=scripttext, setSavePoint=setSavePoint,$
@@ -10324,7 +10326,7 @@
f = open(scriptname, 'r')
txt = f.read()
f.close()
- crc = md5.new(txt).digest()
+ crc = md5(txt).hexdigest()
except UnicodeDecodeError:
f = codecs.open(scriptname, 'rU', encoding)
txt = f.read()
@@ -10332,7 +10334,7 @@
#~ f = codecs.open(scriptname, 'rU', encoding)
#~ txt = f.read()
#~ f.close()
- crc = md5.new(txt.encode(encoding)).digest()
+ crc = md5(txt.encode(encoding)).hexdigest()
splits = (script.lastSplitVideoPos, script.lastSplitSliderPos, script.sliderWindowSh$
scripts.append((scriptname, boolSelected, script.GetText(), crc, splits, script.last$
# Get the remaining session information, store in a dict
@@ -10409,7 +10411,7 @@
bmp = wx.EmptyBitmap(w, h)
mdc = wx.MemoryDC()
mdc.SelectObject(bmp)
- script.AVI.DrawFrame(self.currentframenum, mdc.GetHDC())
+ script.AVI.DrawFrame(self.currentframenum, mdc)
ext = os.path.splitext(filename)[1].lower()
if ext not in extlist:
ext = '.bmp'
@@ -12367,7 +12369,7 @@
dc = wx.MemoryDC()
bmp = wx.EmptyBitmap(w,h)
dc.SelectObject(bmp)
- script.AVI.DrawFrame(frame, dc.GetHDC())
+ script.AVI.DrawFrame(frame, dc)
self.PaintCropRectangles(dc, script)
self.PaintTrimSelectionMark(dc, script, frame)
try: # DoPrepareDC causes NameError in wx2.9.1 and fixed in wx2.9.2
@@ -12381,7 +12383,7 @@
self.videoWindow.DoPrepareDC(dc)
except:
self.videoWindow.PrepareDC(dc)
- script.AVI.DrawFrame(frame, dc.GetHDC())
+ script.AVI.DrawFrame(frame, dc)
else:
dc = wx.MemoryDC()
w = script.AVI.Width
@@ -12391,7 +12393,7 @@
else:
bmp = wx.EmptyBitmap(w,h)
dc.SelectObject(bmp)
- script.AVI.DrawFrame(frame, dc.GetHDC())
+ script.AVI.DrawFrame(frame, dc)
if self.flip:
img = bmp.ConvertToImage()
if 'flipvertical' in self.flip:



--- pyavs.py.orig 2012-06-23 01:31:50.000000000 -0400
+++ pyavs.py 2012-07-27 11:57:41.000000000 -0400
@@ -27,6 +27,8 @@
import ctypes
import sys
import os
+import array
+import wx

import avisynth

@@ -82,22 +84,24 @@

# Define C functions

-CreateFile = ctypes.windll.kernel32.CreateFileA
-WriteFile = ctypes.windll.kernel32.WriteFile
-CloseHandle = ctypes.windll.kernel32.CloseHandle
-
-DrawDibOpen = ctypes.windll.msvfw32.DrawDibOpen
-DrawDibClose = ctypes.windll.msvfw32.DrawDibClose
-DrawDibDraw = ctypes.windll.msvfw32.DrawDibDraw
+##CreateFile = ctypes.windll.kernel32.CreateFileA
+##WriteFile = ctypes.windll.kernel32.WriteFile
+##CloseHandle = ctypes.windll.kernel32.CloseHandle
+##
+##DrawDibOpen = ctypes.windll.msvfw32.DrawDibOpen
+##DrawDibClose = ctypes.windll.msvfw32.DrawDibClose
+##DrawDibDraw = ctypes.windll.msvfw32.DrawDibDraw
handleDib = [None]

avsfile=None

def InitRoutines():
- handleDib[0] = DrawDibOpen()
+ pass
+## handleDib[0] = DrawDibOpen()

def ExitRoutines():
- DrawDibClose(handleDib[0])
+ pass
+## DrawDibClose(handleDib[0])

class AvsClip:
def __init__(self, script, filename='', env=None, fitHeight=None, fitWidth=None, oldFramecount=2$
@@ -246,8 +250,9 @@
if keepRaw:
self.clipRaw = self.clip

+ # RGB24 makes copying memory easier.
# Initialize display-related variables
- if not self.vi.IsRGB32():
+ if not self.vi.IsRGB24():
try:
arg(self.clip)
except NameError:
@@ -273,7 +278,7 @@
arg2 = avisynth.AVS_Value(interlaced)
args = avisynth.AVS_Value([arg, arg1, arg2])
try:
- avsfile = self.env.Invoke("converttorgb32", args, 0)
+ avsfile = self.env.Invoke("converttorgb24", args, 0)
arg.Release() #release the clip
self.clip = avsfile.AsClip(self.env)
except avisynth.AvisynthError, err:
@@ -347,18 +352,32 @@
else:
return False

- def DrawFrame(self, frame, hdc=None, offset=(0,0), size=None):
+ def DrawFrame(self, frame, dc=None, offset=(0,0), size=None):
if not self._GetFrame(frame):
return
self.current_frame
- if hdc:
+ if dc:
if size is None:
w = self.Width
h = self.Height
else:
w, h = size
- DrawDibDraw(handleDib[0], hdc, offset[0], offset[1], w, h, self.pInfo, self.pBits, 0, 0,$
-
+## DrawDibDraw(handleDib[0], dc.GetHDC(), offset[0], offset[1], w, h, self.pInfo, self.pB$
+ buf = array.array('B', [0] * w * h * 3)
+ # RGB is upside-down
+ pitch = self.bmih.biWidth * self.bmih.biBitCount / 8
+ idx_start = (h - 1) * pitch
+ write_idx = 0
+ for i in range(h):
+ for j in range(w):
+ buf[write_idx + 0] = self.pBits[idx_start + j * 3 + 2] # R
+ buf[write_idx + 1] = self.pBits[idx_start + j * 3 + 1] # G
+ buf[write_idx + 2] = self.pBits[idx_start + j * 3 + 0] # B
+ write_idx += 3
+ idx_start -= pitch
+ bmp = wx.BitmapFromBuffer(w, h, buf)
+ dc.DrawBitmap(bmp, 0, 0)
+
def GetPixelYUV(self, x, y):
if self.clipRaw is not None:
if self.IsYV12:


With these changes, AvxPmod should be a reality, although in practice this is not the case due to some outstanding bugs in AvxSynth (issues recreating script environments).

The primary problem with the above diffs is that it is not possible to cast the raw VideoFrameBuffer memory into a DIB as on Windows with DrawDibDraw so a memory copy of the framebuffer needs to be performed. Another issue is that AVS uses BGR ordering but wx expects RGB bitmaps, so a long-width memory copy of each line is not possible either. I've only tested this on Windows, and performance seems to be good enough for preview, but not playback.

mastrboy
27th July 2012, 19:23
Version 2.3.1
- TFM log (combed, possible combed and u/v mismatches)


Now this one is pure gold for us who deal with a lot of anime :)
:goodpost:

vdcrim
27th July 2012, 21:50
I've hacked away the platform-dependent parts of AvsP.py and pyavs.py:

Thanks, I'm going to create an AvxSynth branch on the repository. However as I said before I won't be contributing much for now.


The primary problem with the above diffs is that it is not possible to cast the raw VideoFrameBuffer memory into a DIB as on Windows with DrawDibDraw so a memory copy of the framebuffer needs to be performed. Another issue is that AVS uses BGR ordering but wx expects RGB bitmaps, so a long-width memory copy of each line is not possible either
Yes, we can't really use wxPython for the preview. A good starting point would be to take a look at GTK+/Cairo.

It would be better to keep this development discussion on its issue (https://github.com/AvsPmod/AvsPmod/issues/7) on the GitHub repository.

On a related note I'm having troubles applying your diffs. Long lines are cut and there's also ocassional whitespace issues. I already applied them manually so don't bother this time.

Now this one is pure gold for us who deal with a lot of anime :)
:goodpost:
This one is thanks to tophf (https://github.com/AvsPmod/AvsPmod/issues/2)



Also, a new macro for AvsPmod. It will work on v2.3.0, but v2.3.1 is recommended:

Create mask with ImageMagick (http://www.mediafire.com/download.php?xuxmocny1syyor9)
Create mask with ImageMagick

Requirements:
- convert.exe from ImageMagick <http://www.imagemagick.org>

By default the executable is expected to be found in 'AvsPmod\tools'
or one of its subdirectories. A path will be asked for on the first
run otherwise.

If you only need ImageMagick for this macro then do the following:
1) download the portable static version of IM
2) extract only convert.exe
3) place it on the 'AvsPmod\tools' directory

The mask vertices are selected by clicking on the video preview. If
'apply mask to script' is selected, 'Overlay' is inserted using the
last assigned variable as the overlay clip and 'last' as the overlayed.

Example:

ColorBars()
alt = Invert()

turns into:

ColorBars()
alt = Invert()
mask = ImageSource("C:\mask\path.png")
Overlay(alt, mask=mask, mode="blend")


Latest version: https://github.com/vdcrim/avsp-macros

Zech
5th August 2012, 16:46
Weird problem, using avspmod 2.30 and 2.31 I am unable to copy/paste/drag once a video preview has been loaded and the script has been changed after updating the video preview.

Example, I am able to copy/paste upon opening a script and able to copy/paste even with video preview is open but once I change the script and click on the preview to update I am no longer able to copy and paste. I get the following error...

"Failed to put data on the clipboard (error -2147221008: coInitialize has not been called.)"

wOxxOm
5th August 2012, 17:00
"Failed to put data on the clipboard (error -2147221008: coInitialize has not been called.)"
A friend of mine has this problem as well.

LigH
8th August 2012, 09:54
Friendly bump: Do you consider RichText / HTML export and a syntax highlight class for named parameter names?

AlanHK
5th September 2012, 10:01
If I try to change any settings under "Options/Program settings", when I click "OK", I get an error popup saying "Invalid directory".

But other options I change on the "options" tab, such as "Keyboard shortcuts" are saved.

Only the options in the "Program settings" group fail.

There is an "options.dat" file in the program directory, timestamped a few minutes earlier.

Program is latest 2.3.1 installed in d:\AvsPmod and I'm running Win2k.
Everything else seems to be working okay.

vdcrim
5th September 2012, 13:51
I get an error popup saying "Invalid directory"
And is that so? Set the 'AvsP help directory' and 'AviSynth directory' fields to the correct paths, or clear them if you don't care for help files.

Do you consider RichText / HTML export and a syntax highlight class for named parameter names?
I'd like to revise the syntax highlighting, but currently I don't have the time to work on AvsP. Also, the AvxSynth port takes priority. Anyone willing to contribute is welcome.

AlanHK
5th September 2012, 14:01
And is that so? Set the 'AvsP help directory' and 'AviSynth directory' fields to the correct paths, or clear them if you don't care for help files.

They were already correct. And I couldn't change them or any other "program setting", that was the problem.

Anyway, I deleted "options.dat" and now I can set all the options, though I of course had to re-enter all my keyboard shortcuts and other customisations.

So I'm making backups of options.dat after setting all that in case it goes bad again.

vdcrim
5th September 2012, 14:36
I couldn't change them
Do you mean that clearing the field or reselecting the path with the browse button didn't work? That's weird.

AlanHK
5th September 2012, 17:56
Do you mean that clearing the field or reselecting the path with the browse button didn't work? That's weird.


I wasn't even trying to change any of the paths, they were all correct and had worked for months.

And I could change any of the settings; but when I clicked "OK" to save I got the error. None of the new settings were saved. Closing the settings and opening again, my changes were lost.

The file wasn't locked, because other changes, eg, keyboard shortcuts, were saved into it. Only those under the submenu "Program settings" didn't work.

Anyway, attached the bad options file if you want to take a look. I can see it's ASCII, but rather cryptic so manually editing without a cheat sheet wasn't an option.

If I swap that back in the same problem recurs.

vdcrim
5th September 2012, 19:32
I wasn't even trying to change any of the paths, they were all correct and had worked for months.
Yes, I was telling you to try reselecting again the directories. Did you try?

Better upload the options file to another host to avoid waiting for approval. Anyway, the 'AvsP help directory' field shows "D:\AvsPmod\help" on your system, and that folder actually exists, right?

And I could change any of the settings; but when I clicked "OK" to save I got the error. None of the new settings were saved. Closing the settings and opening again, my changes were lost.
That's how it's supposed to work. Before closing the dialog and saving the options it checks if all paths are valid.

AlanHK
6th September 2012, 03:29
Yes, I was telling you to try reselecting again the directories. Did you try?
Yes. I could change them, but not save them. Though the paths were already correct.

The paths in the "bad" version I attached earlier are the same as in the "good" one I have now after starting clean.
I attach the "good" version to this.
(I don't upload files to hosts often, so I don't know one offhand, they keep disappearing.)


the 'AvsP help directory' field shows "D:\AvsPmod\help" on your system, and that folder actually exists, right?

Yes. And all the "Help" menu items worked.
Anyway, I had never set the directories to begin with, AvsP does that itself when it first runs.

POSTSCRIPT

OK, something weird happened.
I swapped the "Bad" options file back and now it showed
"D:\AvsPmod23\help", which prevented saving the options, but after correcting it, it could be saved.

"D:\AvsPmod23" was a folder I initially installed the latest version in when I was testing it a few months ago before swapping it into the current folder.

I really don't think that was what was displayed yesterday, and you said you saw it as "D:\AvsPmod\help" which is and was correct, but without a screencap to prove that I suppose that PEBCAK is the most likely cause.

Sorry about that.

I any case, I have it working now.

vdcrim
6th September 2012, 12:47
I swapped the "Bad" options file back and now it showed "D:\AvsPmod23\help", which prevented saving the options, but after correcting it, it could be saved.

"D:\AvsPmod23" was a folder I initially installed the latest version in when I was testing it a few months ago before swapping it into the current folder.

I really don't think that was what was displayed yesterday, and you said you saw it as "D:\AvsPmod\help" which is and was correct, but without a screencap to prove that I suppose that PEBCAK is the most likely cause.
I couldn't take a look at the file back then as it was waiting for approval, but you mentioned earlier that your AvsP folder is "D:\AvsPmod", hence my suggestion of checking for "D:\AvsPmod\help" on the program settings dialog. Now that it's approved I see that the help dir path is indeed set to "D:\AvsPmod23\help", so yeah that was the problem. Incidentally, I made some changes to the paths thing a few weeks ago and now if the help dir doesn't exist but "%programdir%\help" does it gets set again to the later.

AlanHK
6th September 2012, 15:36
OK, good.
Thanks for your patience.

The reason I was not even looking really was that I never set the help directory to begin with, and I wasn't trying to change it when I got the error. So the error "Invalid directory" was entirely cryptic to me. I thought it was talking about the directory the options file was in. I can see, in hindsight, that the help directory was highlighted. It would be better to just spell it out and say "AvsP help directory invalid". Or maybe that isn't necessary after your above change; would the help directory even need to be a user setting? It should always be in that subfolder of the program directory.

But other paths might become invalid, "External player" for one. So again, the message should just say exactly which setting is bad and then it's up to the user.

What format is the "options.dat" file in anyway? When I reset it I was able to copy and paste some settings from my old file in to save some time, but I was flying blind.

vdcrim
6th September 2012, 18:08
It would be better to just spell it out and say "AvsP help directory invalid"

OK, changed.

would the help directory even need to be a user setting?
I guess not, but there's not need to remove it neither.

What format is the "options.dat" file in anyway? When I reset it I was able to copy and paste some settings from my old file in to save some time, but I was flying blind.
It's a pickle, a file format used by Python to store data, not really intended for manual editing. I don't know if some kind of GUI viewer exists for it.

StainlessS
7th September 2012, 03:45
Odd problem in AVSPmod v2.3.1.
Only used AVSPMod once or twice, but I dont think I could be doing anything wrong.
Initially had problem in ~2.2.0, so downloaded latest, still same problem.
Test script below, output via RT_Debug (writes text strings to OutputDebugview).
Running Avisynth v2.6a3, XP32


colorbars()
s=ScriptName() # should be a string

RT_Debug("S is String", String(IsString(s)))
RT_Debug("S is Int", String(IsInt(s)))
RT_Debug("S is Float", String(IsFloat(s)))
RT_Debug("S is Bool", String(IsBool(s)))
RT_Debug("S is Clip", String(IsClip(s)))
RT_Debug("S is Defined",String(Defined(s)))
RT_Debug("S is Exist", String(Exist(s)))

Subtitle(String(s)) # String() is last ditch attempt to make whatever it is a string
return last


# MediaPlayer, VDub etc

00000005 01:31:03 RT_Debug: S is String true
00000006 01:31:03 RT_Debug: S is Int false
00000007 01:31:03 RT_Debug: S is Float false
00000008 01:31:03 RT_Debug: S is Bool false
00000009 01:31:03 RT_Debug: S is Clip false
00000010 01:31:03 RT_Debug: S is Defined true
00000011 01:31:03 RT_Debug: S is Exist true # false on ScriptDir ie dir not an existing FILE.
# Subtitled OK



# From AVSPMod v2.3.1

00000122 01:32:10 RT_Debug: S is String false
00000123 01:32:10 RT_Debug: S is Int false
00000124 01:32:10 RT_Debug: S is Float false
00000125 01:32:10 RT_Debug: S is Bool false
00000126 01:32:10 RT_Debug: S is Clip false
00000127 01:32:10 RT_Debug: S is Defined false
# Exist halt with Avisynth "Invalid arguments to Function 'Exist'", message.
# Subtitle will not work if Exist line commented out
# Similar results all 2.6 Script???? funcs


Also, as error message alerts show only the Script File eg 'name.avs', so
the synthetic _ScriptName will return only the name eg 'name.avs', and _ScriptDir fn will return only the
name + line number eg 'name.avs, line 9)', dont know about synthetic _ScriptFile, did not try to find
an equivalent, but the best it could possibly do is the name only (which would be correct).

So, anyway around, all you can get in AVSPMod is the filename name node eg 'name.avs', synthetically.
There was post in 2009 that mentioned same with AVSP, so its been there a long long time (missing path).
http://forum.doom9.org/showthread.php?p=1296183#post1296183

EDIT: As it does not seem to be any kind of variable, what is it that v2.6 thinks it's returning (undefined).

:confused:

EDIT: The good news is that Import errors give the path (only), so assuming nothing has changed the import path,
you could perhaps use both import and Assert to get the path and name node in a set of synthetic funcs,
or better still, get it working properly.