W A R N I N G !


W A R N I N G !

This page is full of non-facts and bullsh!t, (just like the internet and especially forums and other blogs), please do not believe entirely without exercising your intellect. Any resemblance to real things in reality is purely coincidental. You are free to interpret/misinterpret the content however you like, most likely for entertainment, but in no case is the text written on this blog the absolute truth. The blog owner and Blogger are not responsible for any misunderstanding of ASCII characters as facts. *cough* As I was saying, you are free to interpret however you like. *cough*

Tuesday, January 1, 2008

AVISynthesizer - making .avs scripts that allow your programs to accept whatever file format, in a jiffy

Summary:

Not much to summarize this time. Just download AVISynth and AVISynthesizer and follow the guide.

Whenever people ask for help on converting from a not-so-friendly format like WMV, MKV, RM to AVI/MP4, there's usually 2 answers:

1) Convert it to some other format like AVI first with another converter that can read (insert format here), at the great cost of twice the encoding (or half the speed) and reduced video quality).

or

2) The more experienced will suggest making AVISynth scripts, or .avs script/files, that will allow any program to read that file.

Actually the solution is called frameserving, and AVISynth is a frameserver. There are other frameservers out there e.g. VirtualDub, but (aside from VirtualDub that has easier-access to tools functions) AVISynth is by far the best. Best speed, lots of tweaking, best compatibility, and easiest to make, plus the invisible way of working.

Now why do I say it's easiest to make, when by default you have to write the .avs script yourself (and hence making it hell for non-programmers)?

Enter AVISynthesizer.

This program, when installed, creates something under the menu "send-to" when you right click on a file. The gif file below will show how it works:


Click to view it bigger.

The first frame shows what happens when you right-click and send to. Click AVISynthesizer.

The second frame shows what you should select. When freshly installed you only have the bottom 3 options, you can add others yourself later on (which is why this program is very versatile).

The third frame shows the .avs file created under the same directory, and its contents.

The forth frame means "simply drag the file into your encoder and it will work", if you haven't realized that already.

Pretty neat isn't it? Instead of finding another (most likely crappy) program that might work with the file format (through 2-step transcoding or have limited output formats/functions), this allows much more programs to read the file. And done in less than ten seconds.

Part two: one step further

Basically this thing works with templates and creates .avs scripts based on the templates. So we can use different templates to create .avs files that does the changes we want, all in just a few clicks. After setting up that is.

Go to C:\Program Files\ASynther\template (if you installed in the default directory)

Find simple-directshow.avst

Open with Notepad, and you see

#ASYNTHER Simple DirectShow reader
[DirectShowSource("%f")]

(You might see it in just one line instead of two, but it became two when I cut-and-pasted. Also, the generated .avs files have two lines, so I think there's some kind of character in that space that means "enter""line break" or something that my computer can't show. When making your own template it's better to have seperate lines too.)

Now you have the basic template, you can do whatever you like with it from here on. Remember to save as a different .avst file!

Oh the "Simple DirectShow reader" after the #ASYNTHER is the name that will show in the menu. Type anything you want so you can identify your own template later on.

And also, the templates are listed by FILE NAME (not menu name), so if you want a template to be first have 1 in front of the file name etc.

1. Resizing

I know some (kok) encoders do not have built-in resize function. Anyway AVISynth's Lanczosresize works better than the usual bilinear resize so it's better to use it nonetheless.

Add this line below:

Lanczosresize(480,272)

This is for PSP. Replace 480 and 272 with the respective x and y values of the resolution you want.

2. Frame rate conversion

Already covered in a previous article, but the short answer:

Add ", fps=23.976, convertfps=true" after the file name and before the close bracket, without the inverted commas.

Replace 23.976 with the frame rate you desire.

3. Padding, warpsharp, etc

There are a lot more things you can do with AVISynth, just experiment!

1 comment:

yanli said...

A nice guide - proyb2