Jump to content
Media Servers Online: EmuMovies Sync | Launchbox Sync | EmuMovies FTP ×

AviSynth Script Generator


Recommended Posts

Okay this was part of the EmuMovies WorkFlow Tool Chain but is now independently developed...given it's the only part seeing any action. Circo himself has started putting an earlier build to use...finding that it saved him about 8 hours of work per every 100 video's he does.

Now for what it's used for...well at present it mimic's Circo's method of adding cross-fades between game play & title clips along with fading in from black and out to black at the start and end, via AviSynth...hence the naming of this application.

If you review the source code you'll notice the primary function is named after Circo, this is because the original method was what I preferred...but for the sake of uniformity Circo's method is the one recommended to be used. I may at some point add mine back in...but even then Circo's should be the one used for sets distributed here.

Anyways to use this you'll need AviSynth installed along with the latest DirectShowSource plugin (found on SourceForge with AviSynth), which should be extracted into the Plugins folder under AviSynth, next you'll need to install Haali Media Splitter once installed you'll need to copy out of it's installation folder "avss.dll" into the Plugins folder under AviSynth. If you are using AME (Adobe Media Encoder) you may need this Plugin which should be placed something like ".\Program Files\Adobe\Common\Plug-ins\CS4\MediaCore\IM-Avisynth.prm" this of course varies depending on your installation.

Next you'll need to extract the attached or linked archive somewhere on your system, and double click the executable and direct it to the folder that houses the videos you with to create scripts for. Click OK and give it about a second...and your new AVS scripts are now created. These AVS scripts can be used by nearly every encoder out there, and most media players. For example if you want to preview whats been created you can open the script with WMP or MPC. VLC on the other hand...doesn't like them at present. :(

Anyways the scripts will be placed in sub folders under the folder that you selected which at present look like so:

.\_AVS ### Circo Flip\
.\_AVS ### Circo Standard\
.\_AVS RGB Circo Flip\
.\_AVS RGB Circo Standard\
.\_AVS YUV Circo Flip\
.\_AVS YUV Circo Standard\

Now the ones marked with three hash symbols do not alter color space...and these should be tried first, as changing color space does induce some damage, however it is not visible unless you change color space three or more times. If you have to change color space please use YUV if possible, as this will be the faster of the current two options...as it only uses half the memory that RGB does.

Now you'll notice that at present there are two other tags....Standard & Flip...Flip as you likely guessed flips the orientation of the video...this maybe required for certain codec's.

Oh shoot nearly forgot...the naming of the videos is semi important...it should look like so:

<Game Name><Space>T.<Extension>

<Game Name><Space>G<Value>.<Extension>

Example 1:

Pac Man T.avi

Pac Man G1.avi

Pac Man G2.avi

Pac Man G3.avi

Example 2:

Pac Man T.avi

Pac Man GA.avi

Pac Man GB.avi

Pac Man GC.avi

Now the Title has to be in the same folder as the Game Play video(s). Now you can have Game video's in sub folders...or all in the same folder.

Example 1:

.\Videos\Donkey Kong\Donkey Kong T.avi

.\Videos\Donkey Kong\Donkey Kong G1.avi

.\Videos\Donkey Kong\Donkey Kong G2.avi

.\Videos\Donkey Kong\Donkey Kong G3.avi

.\Videos\Pac Man\Pac Man T.avi

.\Videos\Pac Man\Pac Man G1.avi

.\Videos\Pac Man\Pac Man G2.avi

.\Videos\Pac Man\Pac Man G3.avi

Example 2:

.\Videos\Donkey Kong T.avi

.\Videos\Donkey Kong G1.avi

.\Videos\Donkey Kong G2.avi

.\Videos\Donkey Kong G3.avi

.\Videos\Pac Man T.avi

.\Videos\Pac Man G1.avi

.\Videos\Pac Man G2.avi

.\Videos\Pac Man G3.avi

Sub Folder depth is irrelevant...as the script will recurse through everything under the folder you selected...only effect is that it will take longer to generate the scripts the deeper your sub folders are under the main folder.

Source File Extensions supported are (avi, flv, mkv, mp4) others can be added...but most source files should be in AVI presently.

I'll likely be updating this script more in the future, like adding 4x & 8x resizers for use with certain encoders.

Now since I'm distributing the Source Code with this...users are welcome to make improvements or to disable certain features. This means if you find all you need are the scripts tagged ### you can simply go into the source code and comment out the function call that generates the other scripts by placing a semi-colon at the start of the line.

Example Before:

	; No Resize Encodes Fade In & Out To Black Standard
_AVS_Circo( '\_AVS ### Circo Standard\' , '' , '' )

; No Resize Encodes Fade In & Out To Black Flip
_AVS_Circo( '\_AVS ### Circo Flip\' , '' , '.FlipVertical()' )

; No Resize Encodes Fade In & Out To Black Standard RGB
_AVS_Circo( '\_AVS RGB Circo Standard\' , '.ConvertToRGB()' , '' )

; No Resize Encodes Fade In & Out To Black Flip RGB
_AVS_Circo( '\_AVS RGB Circo Flip\' , '.ConvertToRGB()' , '.FlipVertical()' )

; No Resize Encodes Fade In & Out To Black Standard YUV
_AVS_Circo( '\_AVS YUV Circo Standard\' , '.ConvertToYUY2()' , '' )

; No Resize Encodes Fade In & Out To Black Flip YUV
_AVS_Circo( '\_AVS YUV Circo Flip\' , '.ConvertToYUY2()' , '.FlipVertical()' )

Example After:

	; No Resize Encodes Fade In & Out To Black Standard
_AVS_Circo( '\_AVS ### Circo Standard\' , '' , '' )

; No Resize Encodes Fade In & Out To Black Flip
_AVS_Circo( '\_AVS ### Circo Flip\' , '' , '.FlipVertical()' )

; No Resize Encodes Fade In & Out To Black Standard RGB
; _AVS_Circo( '\_AVS RGB Circo Standard\' , '.ConvertToRGB()' , '' )

; No Resize Encodes Fade In & Out To Black Flip RGB
; _AVS_Circo( '\_AVS RGB Circo Flip\' , '.ConvertToRGB()' , '.FlipVertical()' )

; No Resize Encodes Fade In & Out To Black Standard YUV
; _AVS_Circo( '\_AVS YUV Circo Standard\' , '.ConvertToYUY2()' , '' )

; No Resize Encodes Fade In & Out To Black Flip YUV
; _AVS_Circo( '\_AVS YUV Circo Flip\' , '.ConvertToYUY2()' , '.FlipVertical()' )

Simply recompile and away you go. :)

AviSynth.rar

Link to comment
Share on other sites

I've been testing this yesterday and I can only say it works great, pretty simple and you can really win some time with this. Great work.

If you want to generate final avis file with the transitions added you can do it as a batch on virtualdub with this command line:

virtualdub.exe /s"tscc.vcf" /b"path_to_avs_dir","path_to_dest_dir" /r /x

Where tscc.vcf is just a vdub script file generated automatically by vdub by saving the processing settings after you set the video compression the way you want.

Like Nologic said you can also encode the avs files directly to flv on Adobe Media Encoder if you have Haali Media Splitter installed. Just one note, if you use CS5 the plugin folder is located in C:\Program Files\Adobe\Adobe Media Encoder CS5\Plug-ins\common.

Once again thanks for sharing this mate, nice job.

Link to comment
Share on other sites

This really sounds great and all, but is there a way to do exactly this and keep the format as TSCC lossless AND keep the 60fps on videos? That's what I'd like to keep for these lower end systems since files should be pretty small for the most part.

Link to comment
Share on other sites

Okay well first off I think one should hold onto the original independent clips (title, gameplay1, gameplay2,....) rather than have merged. Since not only could encoding practices change...but transitions as well...but what I think is more likely is that you or someone else will produce ether better game play examples or more game play examples...so that viewers can get a better feel for the game being displayed.

If the clips are merged then new clips can't simply be added...where if the clips are independent...then adding a new clip to the bunch is trivial...since creating a new AviSynth script is just seconds away that will utilize the new clip.

The purpose for these scripts is mainly for final encode rather than something to do for storage.

That said...yup you certainly can keep things encoded in TSCC & PCM if you like; just have VDub or whatever you are using set to use TSCC to encode with, and to do a direct stream copy for audio to stay in PCM.

Keeping 60fps you'll have to do ether one of two things...both of which require editing the AutoIt script.

Firstly edit what is now line 84...(this very likely will change in future versions) from:

	FileWriteLine( $File , 'ChangeFPS( FX_1 , 30 , true )' & $Flip )

To:

	FileWriteLine( $File , 'ChangeFPS( FX_1 , 60 , true )' & $Flip )

This will force a framerate of 60fps...so if the source files are already 60fps they will be unchanged...if the source is less than 60fps then frames will be inserted...however this will not improve quality under these conditions. Source of course over 60fps will then be limited to 60fps.

However what would likely be the better path would be to delete line 83 & 84 and edit line 82 from:

	FileWriteLine( $File , 'FX_1 = Dissolve( ' & $Dissolve_Game & 'Mux_Title , Round( FPS * 1.5 ) ).FadeIn2( Round( FPS ) ).FadeIO2( Round( FPS ) )' )

To:

	FileWriteLine( $File , 'Dissolve( ' &  $Dissolve_Game & 'Mux_Title , Round( FPS * 1.5 ) ).FadeIn2( Round(  FPS ) ).FadeIO2( Round( FPS ) )' )

Which changes from storing the muxed video in a variable to actually returning the muxed video. Doing things this way will will allow the source files to keep whatever their original FPS is.

Again I still think the better method of storing assets is in their original clips...rather than merged. Matter fact the clips are likely to take slightly less space on your system than the merged ones. You just have far more flexibility as clips...and we can do a lot with these AviSynth scripts...which just take a few seconds to create.

I'll likely do up versions of the CRC-32 Renamer & MameRenSet to keep clip names current...as they would be small edits and could save a ton of work for those looking to follow this path.

Anyways I hope I answered your question well enough...if not let me know...along with any other questions you might have. :)

Link to comment
Share on other sites

  • 1 month later...

I'll take a look and see if I can figure out what issue you might be hitting or what bug maybe present. The next version has been going through a lot of changes. Ideally by the end of the day I should have everything worked out...so maybe tomorrow you can test the newer build out and let me know if you are hitting the same issue or not.

Thanks for getting back to me about this.

Link to comment
Share on other sites

I'll take a look and see if I can figure out what issue you might be hitting or what bug maybe present. The next version has been going through a lot of changes. Ideally by the end of the day I should have everything worked out...so maybe tomorrow you can test the newer build out and let me know if you are hitting the same issue or not.

Thanks for getting back to me about this.

sounds great ;)

yea im at the pc the whole day..

so yes, if you release a new version of the genrator at evening or tomorrow, then i will test it for sure :)

btw. isnt this just a avisynth script i can use in Vdub?

if yes.. would you mind to post that too.

+ would it be possible to add an .flv encoding to the script?

because im working with Hyperspin.

edit:

i have made my own script with avisynth, would you suggest anything?

a = AVISource("H:\fraps\videos\PC G1.avi").ChangeFPS(29.97).Normalize(0.98)
b = AVISource("H:\fraps\videos\PC G2.avi").BicubicResize(640, 480).Normalize(0.98)
c = AVISource("H:\fraps\videos\PC G3.avi").BicubicResize(640, 480).Normalize(0.98)
d = AVISource("H:\fraps\videos\PC G4.avi").BicubicResize(640, 480).Normalize(0.98)
e = AVISource("H:\fraps\videos\PC G5.avi").BicubicResize(640, 480).Normalize(0.98)
f = AVISource("H:\fraps\videos\PC G6.avi").BicubicResize(640, 480).Normalize(0.98)
Dissolve(a, b, c, d, e, f, 30)

its very simple, and i think it could be made easier with some definitions

im just not sure how..

Link to comment
Share on other sites

Okay new release is out.

Should be a lot faster in some area's

Added support for more containers

Now supports watermarks

Converts mono audio into pseudo stereo

No longer fails if no audio streams present

Now supports no title clips

...there might be a few other things that I've forgotten.

Watermarks must be named the same as the one given in the archive...and must be in the root of your OS drive. At present to use a different size watermark you'll have to edit the AutoIt source and recompile to adjust for the size difference. I'll likely try and make this dynamic later on.

@ CandyFace

Okay looking at your example I now know why it failed prior...you are lacking a Title clip and the prior version was dependent on that...that is no longer the case so you should have no issue in that regard now.

Now looking at your script I take it (A) is one size and the others another? If they are all one size...and you need to resize you should do it in one instance...same with normalizing...also changing the FPS should be one call on all of them.

So if all things are the same...then I'd write the script like so:

a = AVISource("H:\fraps\videos\PC G1.avi")
b = AVISource("H:\fraps\videos\PC G2.avi")
c = AVISource("H:\fraps\videos\PC G3.avi")
d = AVISource("H:\fraps\videos\PC G4.avi")
e = AVISource("H:\fraps\videos\PC G5.avi")
f = AVISource("H:\fraps\videos\PC G6.avi")
Dissolve(a, b, c, d, e, f, 30).BicubicResize(640, 480).Normalize(0.98).ChangeFPS(29.97)

That way there is less overhead...course there isn't much anyways given the type of work being done here. :)

Now Circo typically has a fade in & out to black as well...so if you wanted to mimic him (advised) then you would append the following to your Dissolve line:

.FadeIn( 30 ).FadeOut( 30 )

Yeah it can be used with VirtualDub...and a lot of other app's as well.

FLV encoding is beyond the scope of AVISynth...however the AVS file can be used to create an FLV. I'm actually working on a way to batch encode all the AVS files...which would result in MP4 & FLV container files. This work will hopefully be done today.

Question how well does Normalize through AviSynth compare to using something like AVIGain?

Link to comment
Share on other sites

Okay new release is out.

Should be a lot faster in some area's

Added support for more containers

Now supports watermarks

Converts mono audio into pseudo stereo

No longer fails if no audio streams present

Now supports no title clips

...there might be a few other things that I've forgotten.

Watermarks must be named the same as the one given in the archive...and must be in the root of your OS drive. At present to use a different size watermark you'll have to edit the AutoIt source and recompile to adjust for the size difference. I'll likely try and make this dynamic later on.

@ CandyFace

Okay looking at your example I now know why it failed prior...you are lacking a Title clip and the prior version was dependent on that...that is no longer the case so you should have no issue in that regard now.

Now looking at your script I take it (A) is one size and the others another? If they are all one size...and you need to resize you should do it in one instance...same with normalizing...also changing the FPS should be one call on all of them.

So if all things are the same...then I'd write the script like so:

a = AVISource("H:\fraps\videos\PC G1.avi")
b = AVISource("H:\fraps\videos\PC G2.avi")
c = AVISource("H:\fraps\videos\PC G3.avi")
d = AVISource("H:\fraps\videos\PC G4.avi")
e = AVISource("H:\fraps\videos\PC G5.avi")
f = AVISource("H:\fraps\videos\PC G6.avi")
Dissolve(a, b, c, d, e, f, 30).BicubicResize(640, 480).Normalize(0.98).ChangeFPS(29.97)

That way there is less overhead...course there isn't much anyways given the type of work being done here. :)

Now Circo typically has a fade in & out to black as well...so if you wanted to mimic him (advised) then you would append the following to your Dissolve line:

.FadeIn( 30 ).FadeOut( 30 )

Yeah it can be used with VirtualDub...and a lot of other app's as well.

FLV encoding is beyond the scope of AVISynth...however the AVS file can be used to create an FLV. I'm actually working on a way to batch encode all the AVS files...which would result in MP4 & FLV container files. This work will hopefully be done today.

Question how well does Normalize through AviSynth compare to using something like AVIGain?

GREAT!

well but this evening have i maked a bat file, which convert my avi to flv, by using x264 and ffmpeg

yea i knew i could do something like that with my scriot.. :) thanks

i use this script to do my convertion

ffmpeg -i \VDub\convert.avs -strict experimental -vcodec libx264 -preset fast -crf 30 -acodec aac -ab 192k final.flv

and that works fantastic :D

and it takes no time, isnt that almost the same that your generator does?

BTW.. the program works now, and i can see the different folders with the avs scripts

so that should be good now.

Link to comment
Share on other sites

Okay for straight FFMpeg encodes I'd recommend using the build from here now it can load an external dll for better AAC encoding which is also linked to on the page.

An example of what your commandline would look like using the above mentioned dll:

ffmpeg -i \VDub\convert.avs -strict experimental -vcodec libx264 -preset fast -crf 30 -acodec libfaac -ab 192k final.flv

Since the example I provided prior failed...maybe give this a try...grouped processes

a = AVISource("H:\fraps\videos\PC G1.avi")
b = AVISource("H:\fraps\videos\PC G2.avi")
c = AVISource("H:\fraps\videos\PC G3.avi")
d = AVISource("H:\fraps\videos\PC G4.avi")
e = AVISource("H:\fraps\videos\PC G5.avi")
f = AVISource("H:\fraps\videos\PC G6.avi")
Group = Dissolve(a, b, c, d, e, f, 30)
RSize = BicubicResize(Group, 640, 480)
CFPS = ChangeFPS(RSize, 29.97)

Normalize(CFPS, 0.98)

Link to comment
Share on other sites

As a side note, since I see a few Basic members in this thread, any of our users that contribute media to the project ie sets for a system we don't have yet etc send me a message. Content Contributors get lifetime accounts at emumovies gratis, free, no charge, ever. It's probably good to throw this out there every once in awhile ;)

Link to comment
Share on other sites

Okay for straight FFMpeg encodes I'd recommend using the build from here now it can load an external dll for better AAC encoding which is also linked to on the page.

An example of what your commandline would look like using the above mentioned dll:

ffmpeg -i \VDub\convert.avs -strict experimental -vcodec libx264 -preset fast -crf 30 -acodec libfaac -ab 192k final.flv

Since the example I provided prior failed...maybe give this a try...grouped processes

a = AVISource("H:\fraps\videos\PC G1.avi")
b = AVISource("H:\fraps\videos\PC G2.avi")
c = AVISource("H:\fraps\videos\PC G3.avi")
d = AVISource("H:\fraps\videos\PC G4.avi")
e = AVISource("H:\fraps\videos\PC G5.avi")
f = AVISource("H:\fraps\videos\PC G6.avi")
Group = Dissolve(a, b, c, d, e, f, 30)
RSize = BicubicResize(Group, 640, 480)
CFPS = ChangeFPS(RSize, 29.97)

Normalize(CFPS, 0.98)

hmm thats strange...

still doesnt work, only my own script works.

it still complains about line 7, but it looks ok to me..

says that frame sizes dont match.

Link to comment
Share on other sites

NoLogic, looking forward to test this new version.

I do have one request for you, not sure if you now have any GUI showing up before actually starting generating the avs files. I think the creation of the avs files without a title clip present should be enabled/disabled though a checkbox (or at least some config file). I find it great that no avs is generated if you don't have the title file, why you may ask? :)

Well, suppose you are batch generating 100 avs files and somehow you name one of the title files wrongly, it's easy to find out where's the problem since the avs for that particular game won't be generated, now if you generate them regardless an avs file would be generated only with the game video clip and it would pass right under your nose unnoticed. Please do it in a way that's optional.

Link to comment
Share on other sites

@ brolly

How about a script that audit's your video's clips?

Displays Name, Title Count, Game Count.

@ CandyFace

a = AVISource("H:\fraps\videos\PC G1.avi")
b = AVISource("H:\fraps\videos\PC G2.avi").BicubicResize(640, 480)
c = AVISource("H:\fraps\videos\PC G3.avi").BicubicResize(640, 480)
d = AVISource("H:\fraps\videos\PC G4.avi").BicubicResize(640, 480)
e = AVISource("H:\fraps\videos\PC G5.avi").BicubicResize(640, 480)
f = AVISource("H:\fraps\videos\PC G6.avi").BicubicResize(640, 480)
Dissolve(a, b, c, d, e, f, 30).Normalize(0.98).ChangeFPS(29.97)

Link to comment
Share on other sites

@ CandyFace

a = AVISource("H:\fraps\videos\PC G1.avi")
b = AVISource("H:\fraps\videos\PC G2.avi").BicubicResize(640, 480)
c = AVISource("H:\fraps\videos\PC G3.avi").BicubicResize(640, 480)
d = AVISource("H:\fraps\videos\PC G4.avi").BicubicResize(640, 480)
e = AVISource("H:\fraps\videos\PC G5.avi").BicubicResize(640, 480)
f = AVISource("H:\fraps\videos\PC G6.avi").BicubicResize(640, 480)
Dissolve(a, b, c, d, e, f, 30).Normalize(0.98).ChangeFPS(29.97)

Yeah!

that did it, and i see the bug...

i had to resize my files to get a frame size match, thats why there is .BicubicResize(blablba) behind almost every .avi

but it helped :)

Link to comment
Share on other sites

The link at the bottom of the first post is it...I should move it to the top...I got a few more things I'm toying around with...so there will likely be an update in the next day or so.

One of the things I've been looking at is Normalize (clip, float "volume", bool "show") command in AviSynth..was looking at it prior...but after seeing CandyFace making use of it I decided to give it a try...and it does a fair job...from the little testing I've done thus far...AACGain adjusted the resulting MP4 down 1db...which the original went up 10db...so has me wondering if maybe we should ditch running AACGain on stuff...we would only be up 1db.

Link to comment
Share on other sites

Thanks, downloaded it right now.

I use your AVIGain script and it works pretty good, I'm applying it to the final flv (with mp3 audio) files though, I always leave my source avi files audio untouched. Can you actually notice any difference hearing the same file normalized with both scripts?

Link to comment
Share on other sites

Okay updated the script...added Normalize, however AVIGain\AACGain should still be applied afterwards...however should you manage to forget..things shouldn't be much different from what has been done prior.

Now if anyone notices any altering of the audio other than gain please let me know and I'll revert this change. However CandyFace has been using this setting for a bit with good results so no issues are expected, but please keep in mind the change all the same.

I've added the creation of a Log file for missing Titles...the text file is written to your Temp folder & opened in Notepad...or whatever you have setup to replace Notepad. Now each log is overwriting the prior one...so if you wish to save the data...you need to save it elsewhere.

Oh I also changed the location to the download link which is not only in the first post of the thread but at the start of it. :)

Link to comment
Share on other sites

Hey Nologic any chance you could alter your script to accept the video folder as a parameter instead of showing the file browser dialog. I mean if no parameter is passed then show it, but otherwise you would start the processing immediately.

I was thinking on integrating this on an app later on and this would be really useful that way I could call your script directly.

Will check all these new features asap and also that new encoding script.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...