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

bidmead
8th January 2011, 10:46
I'm wondering if anyone here (Zarxrax?) knows the core AvsP code well enough to make the following mod. It may well be fairly trivial.

Instead of the Trim Editor writing out a cut as:

Trim(w,x) ++ Trim(y,z)

...could it be set (perhaps a user option switch) to do:

Dissolve(Trim(w,x), Trim(y,z), 0)

At a minimum we might have a discussion here about the feasibility and/or value of this mod.

--
Chris

Gavino
8th January 2011, 12:03
...could it be set (perhaps a user option switch) to do:

Dissolve(Trim(w,x), Trim(y,z), 0)
Possibly a useful feature, but not with overlap=0 in the Dissolve, which would make it exactly the same as the original Splice.

bidmead
8th January 2011, 14:17
Well spotted, Gavino... :-)

Yes, that was rather the point.

The function is identical to a splice, but easily editable into a dissolve.

--
Chris

Gavino
8th January 2011, 15:16
Ah, sorry Chris, I wondered about that after I posted.

But if the feature is to be an option, the overlap parameter should be chosen by the user and inserted by AvsP, not edited manually afterwards.

bidmead
8th January 2011, 17:05
Well, whatever. This might be the place for a slider variable, but that's not the way I tend to work.

When I first set a splice I know the exact amount I want to cut, but not what the best dissolve overlap, if any, might be. I want to play the cut first, and then decide.

So after the Trim Editor has delivered, say:

Trim(0, 700) ++ Trim(1112, 5649)

I'll convert this to:

Dissolve(Trim(0, 700) , Trim(1112, 5649), 0)

(qwerpoi wrote me a macro to do this years ago...)

...then add my own inspection Trim around the splice using another macro:

Trim(501,901) #Inspection Trim

... so that I can encode and run that section to see how it looks and sounds. (The system I use doesn't have enough processor power to play an Avisynth dissolve in real-time).

This tells me enough to know whether to leave this as a cut or what depth of dissolve is going to work best, and I just edit the overlap parameter by hand. Then optionally re-encode the inspection selection for a final check before removing the inspection trim and moving on to the next splice.

So I'm generally going to start with 0 as the overlap parameter so that I can see what a straight cut is going to look and sound like ("Never dissolve when you can cut..."). Not much point, then, in adding more flourishes to the GUI just to collect this parameter.

But it might make sense for the preferred parameter (0, 25 or whatever) to be set alongside the preference switch that decides whether the Trim Editor is going to deliver a cut or a dissolve. That might be a later refinement, but my inclination at the start is to keep it simple.

--
Chris

Zarxrax
8th January 2011, 17:32
I was thinking this could work as a macro, then I saw you mention that qwerpoi wrote you one.
Was the macro insufficient for what you need?

bidmead
8th January 2011, 18:49
The macro requires you to copy the original line and paste it into a text box. It'd be much simpler for the Trim editor optionally just to write out the splice as a zero-frame dissolve. If -- as I'm supposing -- the mod to the core code is fairly trivial.

2Dissolve.py
entry = avsp.GetTextEntry('Select and copy the trim commands here:')
splitentry = entry.split('++')
if len(splitentry) == 2:
newString = 'Dissolve(%s, %s, 25)' % (splitentry[0], splitentry[1])
avsp.InsertText(newString, pos=None)
avsp.SaveScript()

As you can see, this has a 25-frame dissolve parameter hard-coded into it.

--
Chris

Zarxrax
8th January 2011, 19:57
Alright, well I'll take a look into that a little bit later.

jmac698
9th January 2011, 06:17
Btw, there is a small bug; the status line will print off the screen if you add some parameters. There's two parts, one should be left justified and the other should be right justified.
They are just put together as a string now with an arbitrary space between them, meaning the left part can make the right part go off the edge.

Kripsy
9th January 2011, 11:28
Feature request: A way to copy the time code given by the frame number and fps to clipboard.

bidmead
9th January 2011, 12:42
I've been wading through qwerpoi's Python code, appreciating the huge amount of work he's done on this, but simultaneously also realising that my early forays into Pascal in the 80's really haven't left me equipped to understand this newfangled OO stuff.

Clearly I must do more work on this. In the meantime, is anyone here able to point me in the direction, however vague, of the Trim Editor code, and in particular, of course, the stanza currently responsible for writing out a splice as "Trim(w,x) ++ Trim(y,z)"?

--
Chris

Gavino
9th January 2011, 13:38
is anyone here able to point me in the direction, however vague, of the Trim Editor code, and in particular, of course, the stanza currently responsible for writing out a splice as "Trim(w,x) ++ Trim(y,z)"?
I don't have AvsPmod, but in the original AvsP, it's function InsertSelectionTrims in source file AvsP.py.

bidmead
9th January 2011, 15:50
Thanks, Gavino. No idea why I didn't spot that myself, sorry.

So it looks to me as if the assignment to trimText is what needs changing.

trimText = ' ++ '.join(['Trim(%i, %i)' % (start, stop) for start, stop in selections])

I take it that "selections" is an array holding the in and out points, so we'd need something along the lines of (I don't know Python at all):

temptrimText = ' , '.join(['Trim(%i, %i)' % (start, stop) for start, stop in selections])
# gives us "Trim(w,x) , Trim(y,z)"
# then add the Dissolve wrapper
trimText = ''.join('Dissolve(' , temptrimText, ',0)'


Might this work?

--
Chris

bidmead
9th January 2011, 16:20
Perhaps I should explain the importance (to me at least) of this:

I use AvsP (and now AvsPmod) mostly for rescuing movies from the ravages of the broadcasters. The main assault comes from ad-insertion. It's great that the Avisynth/AvsP combo offers true frame-accurate cutting, but very often this isn't enough if your aim is to remove the ad and leave no suggestion it was ever there in the first place. A straight cut rarely suffices -- there'll be an awkward visual segue, or the sound will be prematurely faded, or whatever.

Avisynth offers a whole bundle of tools to fix this, but but for ad-removal mostly you just want a quick fix that gives a decent result. The all-purpose simple solution is the dissolve, particularly as you have control over the length of the dissolve. A three-frame dissolve, virtually indistinguishable from a cut, to smooth out a sound jump; a 25-frame dissolve to mask an awkward visual transition; a leisurely 75-frame dissolve, where the narrative justifies it, to cover some of the nastier problems.

So more often than not I want the Trim Editor to deliver a dissolve. As a straight splice is just the special case of a dissolve where overlap=0, that's how I'd prefer the Trim Editor to write out the cut.

--
Chris

Zarxrax
9th January 2011, 17:48
bigmead: that change looks to me like it would work. Have you tried running it? I actually don't even have python installed right now so I can't try building it.
If you want to test it yourself (im guessing you don't know how, since you asked if the code would work), you simply need to install python 2.5.4 and wxpython 2.8 for python 2.5.
http://www.python.org/download/releases/2.5.4/
http://www.wxpython.org/download.php#stable

Then you can simply run the modified AvsP.py

ANGEL_SU
9th January 2011, 17:50
Might this work?


Chris

Yes, I try to add 5 lines to source code and it seems to work!

1: At function 'createTrimDialog()', add one more choice:
'_(At script end (use Dissolve))'

2: At beginning of function 'InsertSelectionTrims()', add:
useDissolve = insertMode / 3
insertMode %= 3

3: Just right after the statement 'trimText = ...', add:
if useDissolve:
trimText = 'Dissolve(%s, 0)' % trimText.replace('++', ',')

bidmead
11th January 2011, 06:32
OK, finally got round to installing python as Zarxrax suggested. And immediately discovered that I wasn't kidding about not knowing Python at all. I'm grateful to you all that my suggested amendment wasn't howled down. In the first place it's missing a bracket at the end (you don't need to know Python to realise that), and in the second place the join function only takes a single argument, not the three I was trying to pile into it.

Angel_Su, you are the hero. :-) I haven't yet implemented the optional switch you propose (but I shall), but the rewrite of trimText you suggest works exactly as I would wish.

Many thanks. Should we offer this as an official patch?

--
Chris

bidmead
11th January 2011, 07:02
Angel_Su, did you mean:

radioBoxTrim = wx.RadioBox(
dlg, wx.ID_ANY, _('Selection options'),
choices=(
_('Keep selected regions'),
_('Keep unselected regions'),
_('At script end (use Dissolve)')
),

...because this doesn't seem to work for me. It creates a third radio button, which of course means that the other two buttons are unselected.

The "Use Dissolve" switch needs to go elsewhere, doesn't it?

--
Chris

Zarxrax
11th January 2011, 18:30
Many thanks. Should we offer this as an official patch?

Well it seems kind of such a specific thing, I'm not really sure if any others would need this functionality.
Opinions?

ANGEL_SU
11th January 2011, 18:47
@bidmead
search 'choiceBoxInsert':

...
# Create the choice box for insertion options
choiceBoxInsert = wx.Choice(
dlg, wx.ID_ANY,
choices=(
_('At script end'),
_('At script cursor'),
_('Copy to clipboard'),
_('At script end (use Dissolve)'), #add from here
_('At script cursor (use Dissolve)'),
_('Copy to clipboard (use Dissolve)')
)
)
...

bidmead
11th January 2011, 20:01
@Angel_Su Wouldn't the natural place for the switch be on a level with "Mark video frames inside/outside selection" and physically immediately under this in the dialog panel?

@Zarxrax Actually it's a _less_ specific thing -- a generalisation of the splice, recognising that a splice is just a special case of a dissolve where overlap = 0. Good program designers are always looking for ways like this to expand functionality without piling in new features. :-)

--
Chris

ANGEL_SU
11th January 2011, 23:37
@Angel_Su Wouldn't the natural place for the switch be on a level with "Mark video frames inside/outside selection" and physically immediately under this in the dialog panel?

Yes, it would be better. See this. (http://pastebin.com/bW2dBmym)

bidmead
14th January 2011, 06:43
That does look great -- many thanks, Angel_Su. I'm going to have to remind myself after many years how to apply patches. And I have to confess that although thanks to Zarxrax I have the python run-time working reliably on my system here (a Win XP virtual machine running on Mac OS X) I haven't been able to achieve a successful compilation, although I've faithfully (I think) followed qwerpoi's instructions.

--
Chris

bidmead
19th January 2011, 21:19
OK, I seem to have applied the Angel_Su patch correctly, and can run the modded code in the Python environment. But I'm unable to compile it for some reason I don't understand.

To cut the problem down to its basics I'm ignoring the patch and have tried recompiling the existing unmodified AvsPmod source fresh from a new download. I don't seem to be able to do that either.

I've installed Python 2.5.4 in its default directory, C:\python25 and within that directory I've installed upx version 3.07 in its own C:\Python25\upx directory. I've checked that these paths concur with the paths in AvsP_build.py and AvsP_i18n.py and that I don't need to modify them.

I run AvsP_build.py against Python. The run begins with a bunch of minor objections to the code:

*** AvsP.py:55: Seen unexpected token "s"
*** AvsP.py:62: Seen unexpected token "s"
*** wxp.py:70: Seen unexpected token "s"
*** pyavs_avifile.py:50: Seen unexpected token "s"

Subsequently the compilation throws up one red error message:

upx: dist\lib\select.pyd: NotCompressibleException

(I need to pause the run with ^S to see these messages, as apparently no permanent log is written)

I end up with a pair of new directories, build and dist, but neither of them contains the final zipped executable.

The whole experiment is easily repeatable. Once the Python and upx directories have been installed as described above, simply copy the downloaded AvsPmod 2.0.5.zip into a temporary file, temp, unzip it to create the AvsPmod 2.0.5 directory inside temp. Move down into the src directory, right click on AvsP_build.py and choose Open With python. The compilation runs. At the end of any failed run it's easy enough to go back up to the temp directory, delete the whole AvsPmod 2.0.5 directory and start afresh by unzipping the AvsPmod 2.0.5.zip file again.

Can anyone give me a clue about what's going wrong here?

--
Chris

Zarxrax
19th January 2011, 21:42
I remember having some sort of similar issues when I first started trying to compile it. I can't remember what I did to fix right now. But I will try to check into this soon, I have just been so busy lately.
But by the way, you don't need to compile it to run. You can just execute AvsP.py directly.

bidmead
20th January 2011, 11:12
Thanks, Zarxrax. Any tips would be invaluable.

> But by the way, you don't need to compile it to run. You can just execute AvsP.py directly.

Yes, as I say, I can run this in the Python environment. But I have to move the tools and macros directories down into the src directory, and with all the separate libraries it gets a bit messy.

--
Chris

ANGEL_SU
20th January 2011, 13:42
@bidmead
upx is not necessary, that is, if it began to run, the distribution should have been finished. Check directory 'dist' to see if files are really generated there.

Zarxrax
20th January 2011, 18:30
bidmead: i believe the problem is that you may be lacking py2exe
I have uploaded it here: http://www.megaupload.com/?d=DXS6TYOY
This version works with python 2.5

(well, maybe not, but you get similar errors if you lack py2exe. The unexpected token stuff just seems to come up regardless)

Could someone help compile one for python 2.7 for me?

ANGEL_SU
20th January 2011, 19:53
Could someone help compile one for python 2.7 for me?
Just built one, download from here (http://www.mediafire.com/?4vx2zborlczcgu2).

bidmead
20th January 2011, 20:53
> i believe the problem is that you may be lacking py2ex

Thanks, I was looking for that. I notice that the src directory includes a log for it, but somehow omits the executable.

Any suggestion about the best place to put it? As it doesn't seem to be mentioned in the setup code I assume it just needs to accessible somewhere in $PATH. But for tidiness sake, it really should be in AvsP_build.py, shouldn't it?

--
Chris

bidmead
20th January 2011, 21:08
Just built one, download from here (http://www.mediafire.com/?4vx2zborlczcgu2).

Very fine, thanks, Angel_Su. And your code (like the patch you offered earlier) makes the distinction between a single trim and a double trim (a splice), which I'd been too lazy to discuss here.

The variable overlap parameter is a nice touch too. Unforch it doesn't seem to offer 0 as an option, and overrides a manually entered 0. Is this an oversight, or am I missing something?

--
Chris

ANGEL_SU
20th January 2011, 23:46
@bidmead
1. See this diff (http://pastebin.com/zazEvh9T). Now, the minimum overlap is zero(default) and the maximum is 999.

2. My distribution(at #230) also contains modified source code. Could you directly run AsvP.py to see if it is backward-compatible? I never test it under py25+wx26.

Zarxrax
21st January 2011, 01:07
Just built one, download from here (http://www.mediafire.com/?4vx2zborlczcgu2).

Thanks, but I was referring to py2exe.
The builds that they have on their sourceforge page are really old and contain some bugs that have been fixed in the source.

In any case, your build seems to work well. When I build it here (with your patch to make it compatible with python 2.7), it just crashes when I run it. I think this has something to do with some required dll files. I'll look through your build and try to figure it out.

ANGEL_SU
21st January 2011, 01:55
Thanks, but I was referring to py2exe.
The builds that they have on their sourceforge page are really old and contain some bugs that have been fixed in the source.
I don't know how to compile py2exe from source. I just installed pre-build binary 'py2exe-0.6.9.win32-py2.7.exe' and it was downloaded from SourceForge...

PS: Ok, I build the latest py2exe 0.6.10dev for python 2.7, you can download from here (http://www.mediafire.com/?vjv1ybkz184512o)

bidmead
21st January 2011, 10:14
I've tried putting py2exe in c:\Windows\system32 (ie, in $PATH) and also in C:\Python25. I'm still getting the same "upx: dist\lib\select.pyd: NotCompressibleException" error (which seems reasonable, as it doesn't relate to py2exe).

The ../dist and ../build directories are being created, and ../dist ends up filled with a bunch of .dlls. But no final zip file.

It seems clear that the compilation instructions bequeathed to us by qwertoi aren't complete. Would anyone care to clean these up (py2exe at least needs to be documented)? And I'd love to know where py2exe is supposed to be installed.

--
Chris

ANGEL_SU
21st January 2011, 10:55
I've tried putting py2exe in c:\Windows\system32 ...
py2exe is a python module, not a commandline tool. The executable file what you got should be an installer, just double-click to run it firstly.

Zarxrax
21st January 2011, 14:47
In AvsP_build.py you could try commenting out the lines related to UPX.

Angel_Su, thanks for the py2exe :)

bidmead
23rd January 2011, 16:21
Compilation of ../src
=============

I'm finding early signs of my frustration with this, so let's see if we can be scientific about it.

1) It's clear that the ../src stuff in the avsp and avspmod distros is messed up in some way that makes it impossible to run a compilation "out of the box".

2) Some of us in this forum have run successful compilations.

3) Therefore some of us in this forum have locally fixed the ../src mess in one or both of the distros.

Is there something wrong with these premises? Or the logic?

If not, the question then arises: do we want to make an easily compilable ../src generally available? Or is it more fun to leave individual contributors to this forum to discover by trial and error for themselves how to fix this? This certainly affords -- as I can testify -- many hours of harmless amusement, and is probably very character-forming. So I can see arguments on both sides.

What does the team think?

--
Chris

Zarxrax
23rd January 2011, 18:42
First of all you need to make sure python and wxpython and py2exe are installed. Also have upx somewhere. I have it in my python directory.
In the /src/ folder there are several files that have to be modified because they contain paths to various things, and the paths will probably be different on your system. I know the following files may need modification, but there might be others:
AvsP_build.py
AvsP_i18n.py
AvsP_setup.py

Next, various files like readme.txt and filter.db might need to be copied into the src folder. I'm not sure about this step. When compiling it will give an error message saying it cant find a file. If it says that, move the file into the src folder.

Some dlls like msvcp71.dll might need to be in your python directory. Again, I'm not sure about this step.

bidmead
23rd January 2011, 20:19
Thanks, Zarxrax, but can we get this pinned down? It seems qwerpoi's notes.txt needs a rewrite. And py2exe (or at least a link to it) needs to be included in ../src.

If I had a working ../src I'd be very happy to write this all up accurately so that making the compilation work is no longer black magic. But I don't, so it kind of falls to those who have got this working to straighten out the facts.

Does AvsP_setup.py need to be fixed up to match local file locations? It's not on qwerpoi's list, but if it should be, let's put it on there. Are there other files that have to be fixed up? Let's find out and add them too.

It does seem that filterdb.dat (not filter.db) needs to be copied into ../src. And, as you suggest, there may be others. Can we find out what they are, and actually put them in the right place, so that the AvsPmod distro, of which I'm sure we're all very appreciative, stays alive to carry on qwerpoi's work.

There seems to be a fair bit of Python expertise here in the forum. Do we need any outside help with this? If so, let's get it.



--
Chris

Zarxrax
23rd January 2011, 21:10
I will write up some better compilation instructions once I release the next version. Due to Angel_Su's patch to get it working in python 2.7, it will change things a bit. I've already migrated all my stuff to 2.7 now, so Its not really worth it for me to go back to the 2.5 stuff and mess around with it anymore.
Right now I'm going through bits of code and stuff that people have contributed over the past several months. Hopefully I can find the time to push out the new version (mainly just some bugfixes and stuff) in the next week or two.

ANGEL_SU
24th January 2011, 03:29
@bidmead
Yes, the old script is not good enough. You need copy somthing into src folder, otherwise you will encounter some error. The information related is all in Avsp_setup.py. To handle it, you need to learn a little more Python.

For distributing without trouble, I have a new build here. (http://www.mediafire.com/?572hy4flh2yz4if) Just directly double-click AvsP_bulid.py to see if it can work correctly.


Due to Angel_Su's patch to get it working in python 2.7, it will change things a bit. I've already migrated all my stuff to 2.7 now, so Its not really worth it for me to go back to the 2.5 stuff and mess around with it anymore.
The purpose of my patch is just for compatibility. It is convenient for developers not to setup another new environment. Try my new build above. Both main code and distributing code still work under python 2.5 + wxpython 2.6 and also run under latest python 2.7 + wxpython2.9.

Floatingshed
27th January 2011, 18:50
I am having problems with defining my own user functions. I can create them and they save but if I attempt to edit one I'm told that renaming is not allowed. So I deleted it and recreated it with a different name but the old one (resizews) seems still to be referenced somewhere and causes this error:

Traceback (most recent call last):
File "AvsP.pyo", line 5965, in OnMenuOptionsFilters
File "AvsP.pyo", line 8621, in ShowFunctionDefinitionDialog
File "AvsP.pyo", line 1950, in __init__
File "AvsP.pyo", line 2002, in CreateWindowElements
KeyError: u'resizews'

Now I can't get into the functions dialogue at all... Please help. (This is version 2.0.5).

Gavino
27th January 2011, 19:52
Try editing the file filterdb.dat (from the AvsP program folder) in a text editor.

Best to make a backup first in case something goes wrong.

Edit: Some info might be stored in options.dat - see this thread.

Floatingshed
27th January 2011, 22:05
filterdb.dat seems to contain the default filter parameters, my modified ones seem to be in options.dat.
I carefully removed all mentions of my filter from options.dat and AvsPmod simply wouldn't start! Glad I backed it up.
Any more thoughts chaps?

ANGEL_SU
28th January 2011, 08:41
Operating options.dat in a text editor is dangerous. Try
this tool (http://www.mediafire.com/?rdnp074vdew6mxl). It should be much safter.

Floatingshed
28th January 2011, 10:57
OK. Thanks, I'll give it a try.

RedDwarf1
3rd February 2011, 20:13
A useful feature would be the ability to stop video decoding or updates by pressing a key such as ESC. When running a heavy script and stepping through it, AvsP/mod can take a great deal of time before it will respond. If it was possible to flush the video to get control back to AvsP it would be helpful.

Yellow_
8th February 2011, 23:31
Trying to run this on Linux + Wine, works great except can't get a video preview inside AVSP only via external player which creates a new instance every refresh.

I get a lilac coloured box as video preview and when I adjust levels the box lilac box brightens just don't get the video preview. Loading image sequences like jpg's gives me a black preview.

Any ideas what player is used internally?

Zarxrax
9th February 2011, 00:30
Trying to run this on Linux + Wine, works great except can't get a video preview inside AVSP only via external player which creates a new instance every refresh.

I get a lilac coloured box as video preview and when I adjust levels the box lilac box brightens just don't get the video preview. Loading image sequences like jpg's gives me a black preview.

Any ideas what player is used internally?

I'm pretty sure it just uses windows functions for displaying the video, not an actual player.