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

vdcrim
7th September 2012, 13:37
AvsP uses Invoke("Eval", [script_text, script_filename]) to pass the script to AviSynth. AviSynth doesn't actually open the file by itself and can't know where is located. That's why ScriptName etc. return undefined [edit: void]. This info is stored as global variables, I'll try to set it on AvsPmod before the script is evaluated.

Edit: I haven't managed to make SetGlobalVar work properly with strings.

error message alerts show only the Script File eg 'name.avs'
What the error message shows is the script title (second parameter of eval()). I'll change it to the fullname.

mastrboy
7th September 2012, 21:13
Any chance one of you avspmod devs are looking at vapoursynth and making that work with avspmod?
Considering vapoursynth has native python bindings it should be "easy" to integrate, right? ;)

Keiyakusha
7th September 2012, 21:26
Yeah, very easy, considering that the only thing it can do is to output y4m in stdout (and even that is buggy) ^__^
But I support the idea.

StainlessS
7th September 2012, 23:22
Thank you vdcrim for your attention.

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.

See Here:
http://forum.doom9.org/showthread.php?p=1590402#post1590402

vdcrim
8th September 2012, 18:41
Any chance one of you avspmod devs are looking at vapoursynth and making that work with avspmod?
Not me, because I don't have the time, but I'm highly interested on this.

Considering vapoursynth has native python bindings it should be "easy" to integrate, right? ;)
The bindings are for Python 3, so it'll need to be adapted to Python 2. I think integrating VS would be more tedious that difficult, if you don't count adding support for new features like metadata.

Edit: on second thought, adapting VapourSynth to Python 2 would be a bad idea. Complex (Python 3) scripts would break trying to run them as Python 2 in AvsP, which pretty much defeats the advantage of Python vs AviSynth script language.
Yeah, very easy, considering that the only thing it can do is to output y4m in stdout
AviSynth can't stdout anything by itself at all ;). GetFrame is what AvsP needs and is already implemented.


_GetWorkingDir()

This won't work for applications that load the script with Invoke("Eval", ...) unless the application also used SetWorkingDir() before creating the script to change the working directory to the one containing it. Thing that would be advisable and AvsP does.

Still trying to figure out how to use SetGlobalVar + SaveString on Python.

Keiyakusha
8th September 2012, 18:48
AviSynth can't stdout anything by itself at all ;). GetFrame is what AvsP needs and is already implemented.
Uhh. What I mean is Vapoursynth outputs things in stdout. Well not counting writing to file.

vdcrim
8th September 2012, 19:10
What I mean is Vapoursynth outputs things in stdout. Well not counting writing to file.
I didn't actually try it, but:
class VideoNode(builtins.object)
| Methods defined here:
|
| get_frame(...)
|
| output(...)

active1
10th September 2012, 08:29
does AvsPmod works under linux without using wine?

LigH
10th September 2012, 09:24
When it uses avxSynth, it probably will... (IMHO)

vdcrim
10th September 2012, 12:53
There's an AvxSynth branch on development. AvxSynth support seems to work OK (thanks primarily to the work of Stephen R. Savage) but there's some important issues with the interface that need to be solved. For the adventurous:


AvxSynth setup (https://github.com/avxsynth/avxsynth/wiki/System-Setup)
Latest AvsPmod code is always at https://github.com/AvsPmod/AvsPmod/zipball/avxsynth. Be sure to save the files to a directory with write access
Requirements: Python 2.6-2.7, wxPython
List of known bugs and limitations (https://github.com/AvsPmod/AvsPmod/issues/7#issuecomment-8028701)
Note that Microsoft's TrueType core fonts are still used by default

zerowalker
10th September 2012, 15:54
Is it just me that canīt Stop the Avs2Avi with the Stop button?
i have to use task manager.

vdcrim
10th September 2012, 16:17
It seems that button has never ever worked :eek:

Fixed

Edit: a new build is not needed, just add 'import ctypes' at the start of 'AvsPmod\tools\avs2avi_gui.py'

mastrboy
11th September 2012, 00:19
Having a little trouble writing a macro, could someone explain what i'm doing wrong with the "previous_bookmark" variable asignment?
I just get the following: "local variable 'previous_bookmark' referenced before assignment (ApplyRange.py, line 23)"
First time writing something more than oneliners in python, and it's kind of hard getting used to the syntax and indent stuff....


# define current and last frame possible to search
max_frames = avsp.GetVideoFramecount(index=None)
current_frame = avsp.GetFrameNumber()

# set bookmarks as a list
bookmarks = avsp.GetBookmarkList(title=False)
bookmarks = list(set(bookmarks))
bookmarks.sort()

# search for next bookmark
for nframe in range(int(current_frame),int(max_frames)):
if nframe in bookmarks:
next_bookmark = nframe
break

# search for previous bookmark
for pframe in reversed(range(int(current_frame))):
if pframe in bookmarks:
previous_bookmark = pframe
break

# insert applyrange
avsp.InsertText('\nApplyRange(%i,%i,"test")' % (previous_bookmark,next_bookmark))

wOxxOm
11th September 2012, 00:24
mastrboy, I use another way of finding prev and next bookmarks (so called 'half-interval search' which takes log2(N) iterations and is much faster when there are lots of bookmarks, like 1000 or more), the result is placed in fnum1 and fnum2:
curframe,lastframe = avsp.GetFrameNumber(), avsp.GetVideoFramecount()-1
bm = sorted(avsp.GetBookmarkList())
a,b = 0, len(bm)-1
while a+1<b:
c = (a+b)/2
a,b =(c,b) if bm[c]<curframe else (a,c)
fnum1,fnum2 = (bm[b],bm[b+1] if b+1<len(bm) else lastframe) if curframe==bm[b] \
else (bm[a],bm[a+1]) if curframe<bm[b] \
else (bm[b],lastframe)

mastrboy
11th September 2012, 00:28
That reply was a lot faster than expected :)
Though I think I'll have to read those few lines a couple of times to understand it. I'll try to use your method instead, thanks.

wOxxOm
11th September 2012, 00:36
Actually this one is better (no need to sort first):
curframe,lastframe = avsp.GetFrameNumber(), avsp.GetVideoFramecount()
bm = [0]+avsp.GetBookmarkList(title=False)+[lastframe-1]
prev = max(bm,key=lambda x: x-curframe if x<=curframe else -lastframe)
next = min(bm,key=lambda x: x-curframe if x>curframe else lastframe)

active1
11th September 2012, 01:32
There's an AvxSynth branch on development. AvxSynth support seems to work OK (thanks primarily to the work of Stephen R. Savage) but there's some important issues with the interface that need to be solved. For the adventurous:


AvxSynth setup (https://github.com/avxsynth/avxsynth/wiki/System-Setup)
Latest AvsPmod code is always at https://github.com/AvsPmod/AvsPmod/zipball/avxsynth. Be sure to save the files to a directory with write access
Requirements: Python 2.6-2.7, wxPython
List of known bugs and limitations (https://github.com/AvsPmod/AvsPmod/issues/7#issuecomment-8028701)
Note that Microsoft's TrueType core fonts are still used by default


oh, so it works on linux, great!
should i build it? or run it with python like any other script?

vdcrim
11th September 2012, 01:44
oh, so it works on linux, great!
should i build it? or run it with python like any other script?
There's still not build script for linux, so just run run.py or AvsP.py. The avs file association menu option should work and it also registers AvsPmod on your desktop environment's menu (I hope, only tried on Gnome).

But I must warn you that there's sometimes problems with closing tabs. And don't try to reorder them for now.
UPDATE: tab issues are fixed now

active1
11th September 2012, 02:46
There's still not build script for linux, so just run run.py or AvsP.py. The avs file association menu option should work and it also registers AvsPmod on your desktop environment's menu (I hope, only tried on Gnome).

But I must warn you that there's sometimes problems with closing tabs. And don't try to reorder them for now.

i ran it with python 2.6.6, and this error occurs:
File "AvsP.py", line 5672
translation_list = {'eng'}
^
SyntaxError: invalid syntax

vdcrim
11th September 2012, 03:08
It's a Python 2.6 compatibility issue, I'll fix it tomorrow.

Edit: should work now

mastrboy
11th September 2012, 11:27
Actually this one is better (no need to sort first):
curframe,lastframe = avsp.GetFrameNumber(), avsp.GetVideoFramecount()
bm = [0]+avsp.GetBookmarkList(title=False)+[lastframe-1]
prev = max(bm,key=lambda x: x-curframe if x<=curframe else -lastframe)
next = min(bm,key=lambda x: x-curframe if x>curframe else lastframe)

Thanks, this worked great. I only had to do a slight modification to get the correct frame when using bookmarks imported from SCXvid log files: next = min(bm,key=lambda x: x-curframe if x>curframe else lastframe)-1

This is going to save me a lot of time :D

wOxxOm
11th September 2012, 11:34
mastrboy, ah I forgot about -1, but then the 2nd line should be as follows to fix handling of the very last scene:bm = [0]+avsp.GetBookmarkList(title=False)+[lastframe]

mastrboy
11th September 2012, 11:54
Off course, else the last frame would be -2. Thanks again.

zerowalker
14th September 2012, 23:28
It seems that button has never ever worked :eek:

Fixed

Edit: a new build is not needed, just add 'import ctypes' at the start of 'AvsPmod\tools\avs2avi_gui.py'

Thanks, works perfect:)

george84
31st October 2012, 11:09
I use V2.3.1 on Windows XP. Opening a avs gives a fatal error. In WordPad or Editor it opens normally. Seems to be Unicode problem. The file contains Hindi characters. It plays well in VDub. It would be useful to generate a special character instead of a crash, because in Subtitles any 8-bit value is allowed.

Traceback (most recent call last):
File "AvsP.pyo", line 7082, in OnMenuFileRecentFile
File "AvsP.pyo", line 2607, in wrapper
File "AvsP.pyo", line 2589, in TimeToRun
File "AvsP.pyo", line 9827, 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 0x8d in position 1161771: character maps to <undefined>

vdcrim
31st October 2012, 16:43
I use V2.3.1 on Windows XP. Opening a avs gives a fatal error. In WordPad or Editor it opens normally. Seems to be Unicode problem. The file contains Hindi characters. It plays well in VDub. It would be useful to generate a special character instead of a crash, because in Subtitles any 8-bit value is allowed.

So you mean that the Hindi characters are only in subtitles and VirtualDub can open the file but replaces/ignores those characters?

Opening Unicode files is already 'fixed' for the next release, as in it will work as good as it can, because AviSynth uses the filesystem's encoding (see http://forum.doom9.org/showthread.php?t=110467 for discussion).

Try this development build.

george84
2nd November 2012, 16:16
Try this development build.

Thank you. This fixed my problem and I can now open my file. I also checked, that after saving the file everything is correct.:thanks:

Chikuzen
2nd November 2012, 21:18
Hi, I send a pull request.

https://github.com/AvsPmod/AvsPmod/pull/10

StainlessS
2nd November 2012, 22:15
@Everybody
Although the site url auto linking is broken at the moment, the 'Insert Link' icon in the quick reply message box works fine.
Easy to copy and paste on desktop, not so easy if on a tablet (have not figured mine out yet, maybe I should read the manual).

gnol009
3rd November 2012, 10:45
Avspmod can create a sample mkv file?

FFvideosource(...)
Crop(...)
Spline36Resize(...)

Sorry for my english.

vdcrim
4th November 2012, 19:32
Here's a new macro, originated from a discussion in another thread (http://forum.doom9.org/showthread.php?p=1598231#post1598231).

Pipe RGB to ImageMagick (https://github.com/vdcrim/AvsP-macros/blob/master/Pipe RGB to ImageMagick.py)
Pipe the script in the current tab to ImageMagick as RGB24 or RGB48

To send RGB48 the script must return a fake YV12 clip containing the RGB
data (see the Dither package docs for more info).

To send RGB24 the clip must be already RGB24. BGR24 in fact, as that is
the order AviSynth/AvxSynth uses. This macro reorders the data as RGB on
its own.


Video range

By default all the frames in the clip are sent. Bookmarks can be used
to delimit specific frame ranges if the corresponding option is checked.
The first and last frame of each range must be added as bookmarks.

A warning is shown if the number of bookmarks is uneven. If the user
accepts then the last range goes till the end of the clip. If the 'only
bookmarks' option is checked but there's none all the video range is
piped.

If the 'save every range to a subdirectory' is checked then the bookmark
title of the starting frame of each range is used as the directory name,
a generic name if it's not set. The titles can be introduced in the Video
menu -> Titled bookmarks -> Set title (manual).


Splitting

Process all the image data in one go can be very memory/filesystem space
expensive. Instead the frames can be sent in batches. There's various
dividing choices:

- Specify a frame step
- Specify a time step
- Specify a number of intervals

To create a single file for each batch (e.g. single TIFF output) be sure
to uncheck the 'Add the padded frame number as suffix' option. To create
GIFs better use this other macro:
https://github.com/vdcrim/AvsP-macros/blob/master/Create GIF with ImageMagick.py


Requirements:

- 'convert' executable from ImageMagick <http://www.imagemagick.org>

By default the executable is expected to be found in 'AvsPmod\tools' or
one of its subdirectories. On *nix it can also be in PATH (there's already
a 'convert' executable on Windows). A path will be asked for in the first
run otherwise.

Windows note:

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




AvsPmod can create a sample mkv file?
AvsPmod doesn't ship with encoders. However you can use the (video only) tools 'Save to AVI' (that uses the VFW encoders installed in your system) or 'Save to MP4' (you need to download x264 CLI for this) and later mux (http://www.bunkus.org/videotools/mkvtoolnix/) the video and audio to Matroska.

Not sure if that was your question.

fvisagie
5th November 2012, 14:22
vdcrim's new release is now linked in the first post, with the following changes:

Version 2.3.1
...


Thanks for the great work you guys are doing continuing the AvsP legacy!

If I may report an annoying but hopefully minor niggle, it's that the keyboard shortcut for Switch video/text focus does not switch back from video to text when video is in a separate preview window.

So far this happens regardless of which valid shortcut key was assigned. The Switch video/text focus menu and context menu commands both still work.

vdcrim
5th November 2012, 18:36
After trying different shortcuts it only won't work for me for escape without modifiers (the default). However it does work when using the wxPython 2.9 development series so I guess it was a bug or limitation on their part and they already fixed it.

fvisagie
6th November 2012, 07:44
Thanks, I should have checked beyond Escape and now it works OK with Ctrl+F1.

Just BTW, Shift+Esc doesn't work here but according to you it should?

fvisagie
6th November 2012, 07:52
With Load session set to its default shortcut Alt+O the Options menu can't be opened from the keyboard. This is quite easily fixed by setting the shortcut to e.g. Alt+L, though.

Perhaps this could be done by default for the next release?

vdcrim
6th November 2012, 16:37
Shift+Esc doesn't work hereOh, didn't try that one.

With Load session set to its default shortcut Alt+O the Options menu can't be opened from the keyboard
You're supposed to Alt, release, O.

fvisagie
7th November 2012, 08:12
You're supposed to Alt, release, O.

Thanks :).

Yellow_
7th November 2012, 08:20
vdcrim, many many thanks, the piping to IM works a treat. :-)

Hundreds of small batches to IM ( in my case writing 16bit tifs) works great.

Thank you, its made what was a manual process so much faster.

Yellow_
10th November 2012, 10:45
Hi again

I'd like to write to OpenEXR format with the RGB pipe script from AVSPmod, now I understand this is not necessarily your knowledge with Linux + Wine but could you make an educated guess on the following.

I'm using AVSPmod + Wine on Linux and all works well using a IM Windows binary wrting to 16bit tif, the IM build I'm using is Q16 but no builds seem to be hdri which is required for EXR format. I know IM 7 will be compiled with hdri formats support as standard but can not find any IM 7 testing builds so far.

So if I use an avs script with AVS2yuv or pipemod with Wine on Linux, I can pipe to a Linux IM binary which is hdri from Windows AVSPmod.

But with your RGB pipe script from AVSPmod I get an error trying to use a Linux IM binary by setting the path to 'convert' in /usr/bin/. I expected it to fail but thought I'd try. The error AVSPmod throws after asking me to browse for the convert.exe, the path is in windows speak rather than /usr/bin/ of coarse as I'm doing all this under Wine so the file browsing and paths is windows 'format', the error is 'invalid arguement in line 385' and AVSP's error console says:

Exception WindowsError: (6, 'Invalid handle') in <bound method Popen.__del__ of <subprocess.Popen object at 0x23972A10>> ignored after 'ok'ing the error message.

Any ideas other than me compiling a Windows binary with MingW or hunting for a hdri build of IM 6 / 7?

vdcrim
10th November 2012, 17:00
I don't think that's possible. You'd need a inverse Wine-like application to pipe to and I don't think that it exists. It would be a bigger hassle than compile ImageMagick anyway. AvsPmod runs natively on *nix now but you won't find something like the Dither package for AvxSynth.

Yellow_
10th November 2012, 22:33
Thanks, yes I had a go with Avxsynth on it's initial availability and look forward to more plugins being ported.

AVS2yuv, a windows binary under Wine successfully pipes to my Linux hdri build of IM but not so via python / AVSPmod, no problem though luckily now found hdri Windows builds of IM 6 to resolve the problem.

http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=22247

Although much prefer native Linux versions where ever possible.

Thanks again.

Yellow_
13th November 2012, 09:41
The RGB pipe script is working great, how difficult would it be to add a create new folder of sequencial number ie: Scene_01 etc at each bookmark and batch convert at intervals between bookmarks.

vdcrim
14th November 2012, 19:54
Try now.

Yellow_
16th November 2012, 21:43
Wicked. :-) Excellent addition. :-)

Although not quite there, unless I'm doing it wrong.

As a test I chose to take a 8000 ish short video, set bookmarks at every 25 frames to test scene folders (although in reality I'd scoot through and set bookmarks at scene changes) and chose 10 frame intervals to stay safely within available memory.

Ticked the "Include only the range between bookmarks" and "when using bookmarks save to sub folders"

So anticipated sub folders every 25 frames and frame numbers ending 0 to 24 for scene 01, then frame numbers ending 25 to 50 for scene 02 folder.

Hope I'm using it correctly, as output was numbers ending 0 to 25 ie: 26 frames for scene 01 folder, then scene 02 folder numbers started at 50 rather than 25.

Many thanks for a great addition to the macro.

vdcrim
16th November 2012, 22:33
You have to set a bookmark for both the first and last frame of every scene, in your example 0, 24, 25, 49, 50, 74... That way you can skip parts of the video. Imagine you want to save scene 1 (100,199) and scene 2 (400,599), you can just set bookmarks then on 100, 199, 400, 599 instead of adding Trim(100,199)+Trim(400,599) and placing a bookmark on the first frame and in the scene change. Read also the macro description for setting a custom directory name.

fvisagie
20th November 2012, 19:02
Hi All,

I can't get tabs to work on different timelines even though Shared timeline is unchecked. AvsPmod 2.3.1.

I've closed the video preview, Release all videos from memory, closed and re-opened the tabs, closed and re-opened the application, but nothing so far works.

Is there any other way of getting tabs to work on independent timelines?

Thanks,
Francois

vdcrim
20th November 2012, 19:28
Funny, I just fixed that two days ago. There's going to be a new AvsPmod release in a few days, so this is the time to report bugs.

fvisagie
21st November 2012, 10:51
Great, thanks.

Here's another I found just this morning. Although it's quite obscure in the sense that it doesn't easily happen, when it does the consequences can be disastrous. When autocomplete is active but the text selection is moved elsewhere, AvsPmod deletes everything in between once the autocomplete is accepted.

How to reproduce:
1. Ensure Show autocomplete with variables is enabled
2. Start off with this text and move the cursor to the top
source
2
3
input
5
6
7
8
9
10
11
12
input
14
15
16
17
18

3. Press Ctrl-F, type 'input' without the quotes and press Enter
4. Move the focus to the tab (dismiss the Find dialog or click on the title bar). 'input' in line 4 is now highlighted and Find is now preloaded with 'input'.
5. Type 'source' without the quotes. 'source' autocomplete appears. Do not press Enter.
6. Press F3 to move the selection to 'input' on line 13
7. Press Enter in the mistaken belief that autocomplete will be applied to line 13
8. Everything between the two Find occurrences including the last one itself is deleted

Good luck with the release, I'm looking forward to it.

fvisagie
21st November 2012, 17:30
When toggling between videos with Zoom set to Fit inside window, the cursor position and value disappear off the status bar. Those can be displayed again by moving the cursor, but this kind of defeats the purpose of trying to compare values in different videos.

If you want that display size, a work-around is to use Zoom > Fill window instead.

vdcrim
22nd November 2012, 03:03
Both are fixed now.