Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 23rd February 2011, 01:44   #261  |  Link
Floatingshed
Registered User
 
Join Date: Nov 2008
Posts: 296
I find that I'm using Freezeframe() a lot to mask bad frames. Is it possible to configure AvsPmod shortcuts to insert the frame numbers?
i.e. if I press (say) F1 the current frame will be inserted in a new Freezeframe statement as the source frame, etc.
Thanks.
Floatingshed is offline   Reply With Quote
Old 23rd February 2011, 15:15   #262  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 597
Quote:
Originally Posted by Floatingshed View Post
I find that I'm using Freezeframe() a lot to mask bad frames. Is it possible to configure AvsPmod shortcuts to insert the frame numbers?
i.e. if I press (say) F1 the current frame will be inserted in a new Freezeframe statement as the source frame, etc.
Thanks.
Insert Frame number
Code:
#Insert current frame number.py
currentframe = avsp.GetFrameNumber()
avsp.InsertText("%i" % currentframe, pos = None)
Save this script into macros folder as "Insert frame number.py" and allocate shortcut key.

Code:
#Bookmarks to FreezeFrame.py
bmlist = avsp.GetBookmarkList()
bmlist.sort()
if len(bmlist) % 2 == 0:
    for i in xrange(0, len(bmlist), 2):
        avsp.InsertText("\nFreezeFrame(%i, %i, %i)" % (bmlist[i], bmlist[i + 1], bmlist[i]))
    avsp.ShowVideoFrame(forcerefresh = True)
else:
    avsp.MsgBox("The number of bookmarks is odd.", title = 'Error')
This macro will set FreezeFrame statement between two bookmarks.
e.g.
If you put bookmarks on 100, 200, 300, 400, 500 and 600 frame, the following lines will be inserted to the last.
FreezeFrame(100, 200, 100)
FreezeFrame(300, 400, 300)
FreezeFrame(500, 600, 500)
__________________
my repositories

Last edited by Chikuzen; 23rd February 2011 at 21:43. Reason: cosmetic
Chikuzen is offline   Reply With Quote
Old 23rd February 2011, 19:41   #263  |  Link
Floatingshed
Registered User
 
Join Date: Nov 2008
Posts: 296
Great, thanks.
Can't wait to get home to try it out.
Floatingshed is offline   Reply With Quote
Old 24th February 2011, 04:25   #264  |  Link
RiCON
Registered User
 
RiCON's Avatar
 
Join Date: Jan 2004
Posts: 69
F11 already inserts the current frame number, iirc.
RiCON is offline   Reply With Quote
Old 24th February 2011, 14:40   #265  |  Link
Floatingshed
Registered User
 
Join Date: Nov 2008
Posts: 296
This works very nicely. Except it throws this error...
MacroShowVideoFrame got an unexpected keyword argument 'Forcerefresh'
Any thoughts?

Edit: Fixed it, just removed spaces in Forcerefresh = True.

Last edited by Floatingshed; 24th February 2011 at 14:56.
Floatingshed is offline   Reply With Quote
Old 25th February 2011, 11:57   #266  |  Link
Floatingshed
Registered User
 
Join Date: Nov 2008
Posts: 296
This is my first use of macros and it has got me rather excited about possibilities. My brain doesn't seem to be able to use python very well so help would be appreciated...

I often need to repair individual frames in photoshop. Is it possible to create a macro to copy the frame out of the script and then put it back in after repair. i.e. automatically create the necessary Trim statements to re-insert? I would usually do it manually like this:


Code:
a=Trim(0, 4606)
c=Trim(4608, 71555)
b=ImageReader("\Frame4607.bmp",fps=25,end=0).converttoyv12()
a++b++c

Last edited by Floatingshed; 25th February 2011 at 14:16. Reason: clarity
Floatingshed is offline   Reply With Quote
Old 26th February 2011, 20:55   #267  |  Link
Zarxrax
Registered User
 
Join Date: Dec 2001
Posts: 1,169
Yes, it should be possible.
What you would need to do is have it create a file browser so you can select your edited file.
Then, assuming the filename contains the correct frame number, you could get the frame number out of the filename, and then use it to create the trim statements.

I don't have time to work on it for you though (but maybe later, if no one else gets around to it).
But if anyone is curious about learning some basic python for the macros, there is a really good tutorial series here: http://www.youtube.com/watch?v=4Mf0h3HphEA
Zarxrax is offline   Reply With Quote
Old 27th February 2011, 02:11   #268  |  Link
ANGEL_SU
Registered User
 
Join Date: May 2007
Posts: 109
@Floatingshed

I wrote one here.
If you want to copy out bad frames, create bookmarks or use selections in trim dialog. Run this macro and type a filename such as 'a'. It will save images using 'a%06d.bmp' pattern. If 6 digits is not enough, explictly specify your pattern - ex. 'Frame%08d'.
Once those images repaired, run this macro again and pick up any one of them. It will find others and insert relative statements into the current script.
ANGEL_SU is offline   Reply With Quote
Old 27th February 2011, 13:02   #269  |  Link
Floatingshed
Registered User
 
Join Date: Nov 2008
Posts: 296
Thanks, I'll have a play!
Floatingshed is offline   Reply With Quote
Old 28th February 2011, 00:17   #270  |  Link
Floatingshed
Registered User
 
Join Date: Nov 2008
Posts: 296
Well, I haven't been entirely happy with the few solutions around so I wrote my first macro.
Until yesterday I had never done any programming of any kind so what follows is bound to be inelegant, clumsy and far from optimal but... it works!

As you scroll through a clip and spot frames that need manual repair run this macro (I have it on an 'f' key). It will save the frame to HDD and automatically open it in whatever photo package is set to open .bmp's. It will also put the necessary trim statements in the script to re-insert the repaired frame. If anyone wants to optimise it...

Code:
#Frame repair by Floatingshed (with bits pinched from all and sundry!)

#Determine length of video

g=avsp.GetVideoFramecount(index=None)
end=str(g)

cf = avsp.GetFrameNumber()
frame=str(cf)
beforeframe=str(cf-1)
afterframe=str(cf+1)


#Save image


avsp.SaveImage(filename='D:\\images\\'+frame, framenum=cf, index=None)


#Create Trim statements


avsp.InsertText('arq'+frame)
avsp.InsertText('=Getchannel(last,1,2)\n')
avsp.InsertText("cuta"+frame+"=Trim(0,", pos=-1, index=None)
avsp.InsertText(beforeframe)
avsp.InsertText(')\n')

avsp.InsertText("cutb"+frame+"=Trim(")
avsp.InsertText(afterframe)
avsp.InsertText(",",)
avsp.InsertText(end)
avsp.InsertText(')\n')  


#Convert missing frame to video

unique="pic"+frame
avsp.InsertText(unique+"=ImageReader(\"D:\\images\\")
avsp.InsertText(frame)
avsp.InsertText('.bmp\",fps=25,end=0)\n')
avsp.InsertText('blk=Black(1)\n')
avsp.InsertText('rep'+frame)
avsp.InsertText('=Audiodub('+unique+',blk)')
avsp.InsertText('.ConvertToYV12()\n')

#Re-insert frame

avsp.InsertText('cuta'+frame)
avsp.InsertText('++rep'+frame)
avsp.InsertText('++cutb'+frame)
avsp.InsertText('\n')
avsp.InsertText('Audiodub(last,arq')
avsp.InsertText(frame+')\n')
avsp.InsertText('\n') 

#Open image for editing

import os
os.system('D:\images\\'+frame+".bmp")
As you can see I really had no idea what I was doing, especially with line returns, but hey it was fun and kept me up very late.

Last edited by Floatingshed; 28th February 2011 at 00:19.
Floatingshed is offline   Reply With Quote
Old 1st March 2011, 18:44   #271  |  Link
Zarxrax
Registered User
 
Join Date: Dec 2001
Posts: 1,169
Very big new update for AvsPmod!
Once again all thanks to Angel_Su!

Changelog
Version 2.0.7:
- Function definitions can be imported from avs/avsi files.
- Many new bookmarking features including titles and matroska importer
- Error messages can be grabbed using OCR via a macro
- more formats for saving images
- YUV->RGB menu for selecting different color matrix for preview
- several small changes and bugfixes

The download can be found in the first post.

I'll now be explaining some of the new features.

Last edited by Zarxrax; 1st March 2011 at 19:14.
Zarxrax is offline   Reply With Quote
Old 1st March 2011, 19:14   #272  |  Link
Zarxrax
Registered User
 
Join Date: Dec 2001
Posts: 1,169
About the New Features

Import user functions from avs/avsi files
Previously, if you wanted function definitions for functions that are contained in avs/avsi files, you either had to manually define the functions, or we had to include the premade definitions with avspmod.
Now, this is all unnecessary, as AvspMod can parse the avs or avsi files and automatically create definitions from them!
You can access this feature from the menu under Options > AviSynth function definition, and then clicking "Import from files".
Simply select one or more avs/avsi files, and then a menu will pop up showing all of the functions that were detected within the files. Simply put a checkmark by the ones that you would like to import, and press OK.

YUV->RGB menu
This new menu that can be found either under the Video menu, or by right-clicking on the video itself, allows you to change the RGB conversion method that is used for the preview.
YUV videos have to be converted to RGB in order to be displayed. Traditionally, the RGB conversion was always done using Rec601, but many newer videos, especially HD videos, should be converted using Rec709 if their colors are to appear correctly.
By using this menu, you can select which type of conversion should be used for displaying the output.
Please note that this ONLY affects the preview image that is displayed in AvsPmod. It does NOT effect the actual output of the AVS script.

Titled Bookmarks
AvsPmod now supports titles for your bookmarks.
Bookmarks can be imported or exported using the available macros.
For setting bookmarks manually, you can use the Ctrl+B shortcut, or right-click on the timeline marker.
Once bookmarks are set, you can either assign names to them automatically or manually, using the options found under the menu Video > Titled Bookmarks.

AvsPmod has a concept called "historic titles". When bookmarks are deleted, whether on purpose or accidentally, if you later decide that you wanted to keep that bookmark, it might be a slight hassle to have to have to find the correct frame number, and then re-type the title for the bookmark. So in order to make the process of recovering deleted bookmarks easier, AvsPmod uses "historic titles". Any titled bookmark that is deleted is kept around as a "historic title", but is hidden, and they can be restored whenever you like.
To restore a single historic titled bookmark, simply move to near the frame where the bookmark existed, and press Ctrl+M.
Ctrl+M moves the nearest titled bookmark to the current location, but if there is a historic titled bookmark in that location, it will be restored.

Custom Autocomplete keywords
You can edit the autocomplete keywords list at:
Options > Program settings > Autocomplete > customize autocomplete keyword list
Here, you can uncheck any items that you dont want to appear in the autocomplete list. Also in the right-click menu, you can select 'exclude long names', which you may find useful.

Now for instance, maybe you frequently use the "AssumeFPS" keyword. Because there are also keywords for AssumeBFF and AssumeFieldBased, then you have to at least type "AssumeFP" every time! But, if you deselect those other two, then you can autocomplete after just typing "Assu".

But you may be thinking that you might want to access those other commands at some point. Thats not a problem, because we can use the "autocomplete all" shortcut to bring up the FULL autocomplete list! Just press Alt+space, or go to the menu item at Edit>Avisynth function>autocomplete all.

User Slider values rescaling
When creating a user slider in your script (Edit > Insert > Insert User Slider), we can rescale the values to something more convenient by adding some characters in the sliders label.

As an example, lets create a slider for the Tweak filter's "hue" setting.
Tweak([<"hue +", -180, 180, -180>])
Normally, this would create a slider that goes from -180 to 180. But by adding the + symbol after the label, it will rescale it to use values from 0 to 100.
If you instead use a minus symbol, like Tweak([<"hue -", -180, 180, -180>]) , it will be rescaled to use values from -100 to 100.
This may be useful for functions that use very strange values. I wouldn't actually recommend using it for something as simple as Tweak.

Last edited by Zarxrax; 29th June 2011 at 17:47.
Zarxrax is offline   Reply With Quote
Old 1st March 2011, 21:34   #273  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 985
Hello, I must say I love avspmod, it makes me work fast.
But still there are a few things that could make it near perfect.

-Zoom (It takes time, like if reloading the script)
-An option to recover the working project when a program crashes (somewhere, not rewriting my working projects, but maybe autosaving dummies somewhere)
-Improve status bar, I have some options enabled, like position, and color in some formats. When I check these the right part where Res,AR,FPS,Color Space are, become partly hidden.
-Option to go to a frame without rendering video (just when F5), when theres no current video rendered.
-And write a framenumber (in the box) and ability to F5 (no Enter as for now 2.0.5 I use)
-When I F5 and get an error, next time I F5 the frame rendered is another one.
-Separate function call window and function highlighting (There are some filters I may not want to call but want to see they are there working and may have options to edit)

That said Im going to update to 2.0.7 right now, but a last question, if I import the functions from .avs and .avsi will they rewrite my actual function definitions? (in case it matches the function name)
Dogway is offline   Reply With Quote
Old 1st March 2011, 22:03   #274  |  Link
Zarxrax
Registered User
 
Join Date: Dec 2001
Posts: 1,169
Quote:
Originally Posted by Dogway View Post
Hello, I must say I love avspmod, it makes me work fast.
But still there are a few things that could make it near perfect.

-Zoom (It takes time, like if reloading the script)
-An option to recover the working project when a program crashes (somewhere, not rewriting my working projects, but maybe autosaving dummies somewhere)
-Improve status bar, I have some options enabled, like position, and color in some formats. When I check these the right part where Res,AR,FPS,Color Space are, become partly hidden.
-Option to go to a frame without rendering video (just when F5), when theres no current video rendered.
-And write a framenumber (in the box) and ability to F5 (no Enter as for now 2.0.5 I use)
-When I F5 and get an error, next time I F5 the frame rendered is another one.
-Separate function call window and function highlighting (There are some filters I may not want to call but want to see they are there working and may have options to edit)

That said Im going to update to 2.0.7 right now, but a last question, if I import the functions from .avs and .avsi will they rewrite my actual function definitions? (in case it matches the function name)
Thanks for you feedback. I'll try to address some of your issues:

- Yes, the zoom function does render the script again when you change the zoom level. I'm not sure if its possible to change this behavior
- The last session is automatically saved. If you launch avspmod without loading any script, the last session should be automatically restored.
- Regarding the status bar, are you working on a small screen or with a small sized window? I don't seem to have any issues when AvsPmod is maximized. If you are saying that there isn't enough room on your screen to display all of the information, how would you suggest improving this?
- Why do you want to seek to a frame but not preview that frame? I can't understand the purpose of this.
- Can you rephrase your last suggestion, so that I can understand it better?

Regarding importing function definitions, yes, I believe that existing definitions will be overwritten. However, when you import functions, it will popup a box asking you which functions you want to import. If you don't want to import certain functions, you can just deselect them.
Zarxrax is offline   Reply With Quote
Old 2nd March 2011, 02:20   #275  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 985
-Yes, autoload last session can make it. I disabled it because it forced me to close tabs before quitting program if I wanted to start clean next time. (Pretty annoying)

-It doesnt matter if windowed or full (Im on 1080p screen res), there's room in the bar but the right part information autohides when I roll my mouse over the image. I use these parameters:
Code:
Frame %F / %FC  -  (%T)(%TT)      %POS  %HEX %CLR \t\t%Z %Wx%H (%AR)  -  %FR fps  -  %CS
-For example when I want to go to a certain second, not to a certain frame. Or when I just input a framenumber to access, I make some work modification, then when I finish I wrongly hit F5, and my reference framenumber is lost. I know there is the scrap window, but hopely you get what I wanted to say.
It makes no sense to render video when you place the timer in a new location, it only makes sense if you are already previewing the video.

-for example, all the masktools functions. I want to see them highlighted, to visually place them, and probably edit them. But when writting up a mt_function I might only want for example mt_lut to appear in the box (call window ,"ctrl+space") because I use it oftenly and have a custom preset for it. But the shortcut becomes a bit of a long way while looking for the function among all of them started with "m" or "mt", or "mt_". So yeah, highlight all the functions (or those selected in the function definition options), but only make appear in my call box those I use commonly. Well, its only a suggestion.


I have avspmod heavily customised, colors, shortcuts, functions, options, macros, etc So I copied options.dat to the 2.0.7 folder, it changes color but nothing else seems to work.

Last edited by Dogway; 2nd March 2011 at 06:21.
Dogway is offline   Reply With Quote
Old 2nd March 2011, 05:08   #276  |  Link
Hockey Man
Registered User
 
Join Date: Jul 2004
Posts: 13
Associating avs files with AvsPmod worked for me in all previous versions and the original AvsP. But it only worked correctly if I did it while I was running AvsP/AvsPmod as a administrator. I'm using Windows 7 x64 Home Premium.
Hockey Man is offline   Reply With Quote
Old 2nd March 2011, 06:01   #277  |  Link
Zarxrax
Registered User
 
Join Date: Dec 2001
Posts: 1,169
Quote:
Originally Posted by Hockey Man View Post
Associating avs files with AvsPmod worked for me in all previous versions and the original AvsP. But it only worked correctly if I did it while I was running AvsP/AvsPmod as a administrator. I'm using Windows 7 x64 Home Premium.
Odd, I couldn't get it to work for me on anything besides windows xp, even running as administrator.
I was planning on making an installer which could set up the associations, but I'm having some trouble with that.
Zarxrax is offline   Reply With Quote
Old 2nd March 2011, 07:44   #278  |  Link
Hockey Man
Registered User
 
Join Date: Jul 2004
Posts: 13
I had the same problem with file associations with mpc-hc. If I tried to associate any file types it wouldn't work unless I ran the executable as an administrator. That's the only reason I tried doing it also in AvsPmod, and luckily it worked.
Hockey Man is offline   Reply With Quote
Old 2nd March 2011, 14:26   #279  |  Link
Yellow_
Registered User
 
Join Date: Sep 2009
Posts: 378
It's great to see the development of AVSPmod continue.

Just wish I could get it to work on Linux with Wine, from previous comments I'm aware it's VfW but so is Virtualdub and that runs sweet via Wine.

Some way to use SDL, ffplay or the nominated external player within AVSPMod interface would be excellent.

Other comment would be that in your New Features you've added Rec709 for HD playback, which is great but I'd query whether it it is correct to say "should" "be converted using Rec709 if their colors are to appear" "correctly."

Canon DSLR h264 is HD BT709 primaries and transfer but has a BT601 color matrix as one example.
Yellow_ is offline   Reply With Quote
Old 2nd March 2011, 15:16   #280  |  Link
RiCON
Registered User
 
RiCON's Avatar
 
Join Date: Jan 2004
Posts: 69
Can't remember if I put this here already but here is a macro that I consider very useful: Trims.py.
How to use it: For each bookmark, it creates a pair of frames in a Trim().
Ex:
Bookmarks on frames 100, 1000, 2000 and the last frame of the video is 2999.
The macro inserts the line "Trim(100,999)++Trim(1000,1999)++Trim(2000,2999)" to the end of the script.

The .avs association in AvsP also worked with me, running it as Administrator in Win7.
RiCON is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 16:32.


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