Back Forum Reply New

UBER l33t Encoding Script

Ok guys, I guess I'll let it all out on the table. There is a wicked program called AutoIt which is available as shareware on the internet. It allows you to create the most amazing script based macros ever imagined. Well, I've been using this for over a year now and figured I'd release it to the public (not auto it, by my scripts). The ones I have are really only applicable for encoding episodes of a tv show or anime series. But they are 100% editable for whatever you want to encode. I'll post my first script in here and if you guys want to see more that I have created just ask. I'll paste the script first, then explain it once the paste is done.

SetEnv, CCE, C:\\CCE\\CCTSPt.EXE
SetEnv, VFAPI, C:\\Vfapi\\Reader\\VFAPIConv-EN.exe
SetEnv, PULL, C:\\Pulldown.exe
SetEnv, DEL, C:\\Delete.exe
SetEnv, TIMES, C:\\Times.txt
SetEnv, CALC, C:\\BBC.exe
SetEnv, VIRT, C:\\VirtualDub\\VirtualDub.exe
SetEnv, HSPA, c:\\Ep\\
SetEnv, EPI, C:\\Episode.txt
SetEnv, BB, C:\\BBMPEG\\avi2mpg2.exe
SetEnv, FILTER, C:\\VirtualDub\\Subtitler.vdf

; --------------------------- Episode Location ---------------------------------

SetEnv, PATH, f:\\AnimeSeries\\
SetEnv, SETTEN, XSVCD
SetEnv, EPISODE, Ep16
SetEnv, TOTAL, 20
SetEnv, SVV, 0

; SVV decides wether or not to LOAD a vcf file at virtualdub startup...             0=dont use amp; 1=use
; SETTEN specifies the name for the vcf file.

; ------------------------------ BEGIN LOOP ---------------------------------

MySVCD:

; --------------------------- AUDIO CONVERSION ---------------------------

Run, %TMPG%
WinWaitActive, TMPGEnc
Send, {TAB}
Send, {DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}
Send, {DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}
Send, {DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}
Send, {DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}
Send, {DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}
Send, {DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}
Send, {DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}
Send, {DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}
Send, {TAB}{TAB}{TAB}{ENTER}
WinWaitActive, Open
Send, %PATH%%EPISODE%\\%EPISODE%j.wav
Send, {ENTER}
WinWaitActive, TMPGEnc
Send, {TAB}{TAB}{TAB}{TAB}{ENTER}
WinWaitActive, MPEG
Send, {TAB}{TAB}{TAB}{TAB}{UP}
Send, {ENTER}
Send, {ALT}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}
WinWaitActive, Batch
LeftClick, 453, 268
WinWaitActive, Clear
Send, {ENTER}
LeftClick, 506,12
WinWaitActive, TMPGEnc
Send, {ALT}
Send, {DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{RIGHT}{ENTER}
WinWaitActive, Save
Send, %PATH%%EPISODE%\\%EPISODE%.MP2
Send, {ENTER}
WinWaitActive, Batch
Sleep, 2000
LeftClick, 457,40
WinWaitActive, TMPGEnc
WinWaitActive, Batch
Send, {TAB}{ENTER}
WinWaitActive, TMPGEnc
WinClose, TMPGEnc

; ------------------------------ Huffy ------------------------------

Run, %VIRT%
WinWaitActive, Virt

IfEqual, %SVV%, 0, Goto, BEER

Send, {ALT}{ENTER}l
WinWaitActive, Load
Send, %PATH%%SETTEN%.vcf
Send, {ENTER}
WinWaitActive, Virt

BEER:

LeftClick, 81,26
Sleep, 500
LeftClick, 90,48

WinWaitActive, Filters
Send, {TAB}{ENTER}
WinWaitActive, Add
Send, {TAB}{ENTER}
WinWaitActive, Load
Send, %FILTER%

Send, {ENTER}
WinWaitActive, Add
Send, {DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}
Send, {DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}
Send, {DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}
WinWaitActive, Subtitler:
Send, {TAB}{ENTER}
WinWaitActive, Select
Send, %PATH%%EPISODE%\\%EPISODE%\-PERFECT.SSA
Send, {ENTER}
WinWaitActive, Subtitler:
Send, 0{ENTER}
WinWaitActive, Filters

Send, {ENTER}
WinWaitActive, Add
Send, {DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}
Send, {DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}
WinWaitActive, Filter:
Send, 480
Send, {TAB}
Send, 480
Send, {TAB}{DOWN}{DOWN}{ENTER}
WinWaitActive, Filters
Send, {TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}

WinWaitActive, VirtualDub
Send, {ALT}{DOWN}{ENTER}
WinWaitActive, Open
Send, %PATH%%EPISODE%\\%EPISODE%.avs
Send, {ENTER}
WinWaitActive, VirtualDub
Send, {ALT}
Send, v
Send, c
WinWaitActive, Select
Send, {DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}
WinWaitActive, VirtualDub
Send, {ALT}
Send, f
Send, {DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}
WinWaitActive, Save
Send, %HSPA%%EPISODE%.AVI
Send, {ENTER}
SetTitleMatchMode, 2
WinWaitActive, Status
Send, {TAB}{SPACE}{TAB}{SPACE}
WinWaitClose, Status
SetTitleMatchMode, 1
WinClose, VirtualDub

; ----------- BitCalc SVCD ---------

StringRight, NUMBER, EPISODE, 2
FileReadLine, TIMECODE, %TIMES%, %NUMBER%
Run, %CALC%
WinWaitActive, Bearson
LeftClick, 226,85
LeftClick, 226,85
StringRight, TIM, TIMECODE, 2
Send, %TIM%
LeftClick, 187,127
LeftClick, 187,127
Send, 790
Send, {TAB}{UP}{UP}{UP}{TAB}
Send, ^c
WinClose, Bearson

; -------------------------------- CCE --------------------------------

Run, %CCE%
WinWaitActive, CCE
WinActivate, CCE
RightClick, 87,100
Send, a
WinWaitActive, Open
Send, %HSPA%%EPISODE%.00.AVI
Send, {ENTER}
WinWaitActive, CCE
LeftClick, 71,73
LeftClick, 71,73
WinWaitActive, Encode
Send, {TAB}{TAB}{ENTER}
WinWaitActive, Ep

IfNotExist, %HSPA%%EPISODE%.01.AVI, Goto, BEGIN
RightClick, 295,219
Send, a
WinWaitActive, Open
Send, %HSPA%%EPISODE%.01.AVI
Send, {ENTER}
WinWaitActive, Ep

IfNotExist, %HSPA%%EPISODE%.02.AVI, Goto, BEGIN
RightClick, 295,219
Send, a
WinWaitActive, Open
Send, %HSPA%%EPISODE%.02.AVI
Send, {ENTER}
WinWaitActive, Ep

IfNotExist, %HSPA%%EPISODE%.03.AVI, Goto, BEGIN
RightClick, 295,219
Send, a
WinWaitActive, Open
Send, %HSPA%%EPISODE%.03.AVI
Send, {ENTER}
WinWaitActive, Ep

IfNotExist, %HSPA%%EPISODE%.04.AVI, Goto, BEGIN
RightClick, 295,219
Send, a
WinWaitActive, Open
Send, %HSPA%%EPISODE%.04.AVI
Send, {ENTER}
WinWaitActive, Ep

IfNotExist, %HSPA%%EPISODE%.05.AVI, Goto, BEGIN
RightClick, 295,219
Send, a
WinWaitActive, Open
Send, %HSPA%%EPISODE%.05.AVI
Send, {ENTER}
WinWaitActive, Ep

IfNotExist, %HSPA%%EPISODE%.06.AVI, Goto, BEGIN
RightClick, 295,219
Send, a
WinWaitActive, Open
Send, %HSPA%%EPISODE%.06.AVI
Send, {ENTER}
WinWaitActive, Ep

IfNotExist, %HSPA%%EPISODE%.07.AVI, Goto, BEGIN
RightClick, 295,219
Send, a
WinWaitActive, Open
Send, %HSPA%%EPISODE%.07.AVI
Send, {ENTER}
WinWaitActive, Ep

IfNotExist, %HSPA%%EPISODE%.08.AVI, Goto, BEGIN
RightClick, 295,219
Send, a
WinWaitActive, Open
Send, %HSPA%%EPISODE%.08.AVI
Send, {ENTER}
WinWaitActive, Ep

IfNotExist, %HSPA%%EPISODE%.09.AVI, Goto, BEGIN
RightClick, 295,219
Send, a
WinWaitActive, Open
Send, %HSPA%%EPISODE%.09.AVI
Send, {ENTER}
WinWaitActive, Ep

IfNotExist, %HSPA%%EPISODE%.10.AVI, Goto, BEGIN
RightClick, 295,219
Send, a
WinWaitActive, Open
Send, %HSPA%%EPISODE%.10.AVI
Send, {ENTER}
WinWaitActive, Ep

BEGIN:

Send, {TAB}{ENTER}
WinWaitActive, Encode
Send, {TAB}{TAB}{TAB}
Send, %HSPA%%EPISODE%.MPV
Send, {TAB}{TAB}
Send, %HSPA%%EPISODE%.MPV
Send, {TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}
Send, ^v
Send, {TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}
WinWaitActive, CCE
Send, {TAB}{ENTER}
Sleep, 1000
Send, {ENTER}
WinWaitActive, Save
Send, %HSPA%%EPISODE%.ECL
Send, {ENTER}
SetTitleMatchMode, 2
WinWaitActive, Ep,Saving
WinWaitClose, Ep,Saving
Sleep, 5000
WinWaitActive, Ep,Saving
WinWaitClose, Ep,Saving
Sleep, 3000
WinActivate, CCE
WinClose, CCE

; -------------------------------- PULLDOWN --------------------------------

RunWait, %PULL% %HSPA%%EPISODE%.MPV %HSPA%%EPISODE%.MP4

; --------- MUXING ----------

Run, %BB%
WinWaitActive, AVI2MPG2
Send, l
Sleep, 3000
Send, {ESC}
Send, e
WinWaitActive, bbMPEG
Send, {TAB}
Send, s
WinWaitActive, MPEG
Send, {TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}
Send, {RIGHT}{TAB}{TAB}{ENTER}
WinWaitActive, bbMPEG
Send, %PATH%%EPISODE%\\%EPISODE%.MPG
Send, {ENTER}
WinWaitActive, MPEG
Send, {TAB}{TAB}{ENTER}
WinWaitActive, bbMPEG
Send, %HSPA%%EPISODE%.MP4
Send, {ENTER}
WinWaitActive, MPEG
Send, {TAB}{TAB}{ENTER}
WinWaitActive, bbMPEG
Send, %PATH%%EPISODE%\\%EPISODE%.MP2
Send, {ENTER}
WinWaitActive, MPEG
Send, {TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}
Send, t
SetTitleMatchMode, 2
WinWaitActive, bbMPEG, amp;Ok
Send, {ESC}
WinClose, AVI2MPG2

; -------------------------------- DELETING --------------------------------

RunWait, %DEL%  %HSPA%%EPISODE%.00.AVI
RunWait, %DEL%  %HSPA%%EPISODE%.MPV
RunWait, %DEL%  %HSPA%%EPISODE%.MP4
RunWait, %DEL%  %HSPA%%EPISODE%.00.VAF
RunWait, %DEL%  %HSPA%%EPISODE%.ECL
RunWait, %DEL%  %PATH%%EPISODE%\\%EPISODE%.MP2

IfExist, %HSPA%%EPISODE%.01.AVI, RunWait, %DEL%  %HSPA%%EPISODE%.01.AVI

IfExist, %HSPA%%EPISODE%.02.AVI, RunWait, %DEL%  %HSPA%%EPISODE%.02.AVI

IfExist, %HSPA%%EPISODE%.03.AVI, RunWait, %DEL%  %HSPA%%EPISODE%.03.AVI

IfExist, %HSPA%%EPISODE%.04.AVI, RunWait, %DEL%  %HSPA%%EPISODE%.04.AVI

IfExist, %HSPA%%EPISODE%.05.AVI, RunWait, %DEL%  %HSPA%%EPISODE%.05.AVI

IfExist, %HSPA%%EPISODE%.06.AVI, RunWait, %DEL%  %HSPA%%EPISODE%.06.AVI

IfExist, %HSPA%%EPISODE%.07.AVI, RunWait, %DEL%  %HSPA%%EPISODE%.07.AVI

IfExist, %HSPA%%EPISODE%.08.AVI, RunWait, %DEL%  %HSPA%%EPISODE%.08.AVI

IfExist, %HSPA%%EPISODE%.09.AVI, RunWait, %DEL%  %HSPA%%EPISODE%.09.AVI

IfExist, %HSPA%%EPISODE%.10.AVI, RunWait, %DEL%  %HSPA%%EPISODE%.10.AVI; -------------------------------- LOOP -------------------------------------

StringRight, NUMBER, EPISODE, 2
IfEqual, TOTAL, %NUMBER%, Goto, Bye
EnvAdd, NUMBER, 1
FileReadLine, EPY, %EPI%, %NUMBER%
StringRight, EPNUM, EPY, 2
SetEnv, EPISODE, Ep%EPNUM%
Goto, MySVCD

; -------------------------------- END --------------------------------------

Bye:
Exit
Ok. Yea, its long as hell ;p. So what does it all do? Well that allows you to setup say 50 episodes to encode, press 1 button, walk away and come back a few days later and have 50 fully muxed SVCD episodes on your hard drive. Pretty sweet eh? The reason I created it was that encoding a 20 minute episode of something takes little or no time and all the intermediate steps are a real pain in the ass to do. So, just put all the crap in a script and away you go.

NOTES on this script:

The top portion with the path names are the locations to the programs you need.
1. Get CCE and set it up for 3 pass VBR and configure all your other settings in there.

2. Ya need to install vfapi.

3. Get ahold of pulldown.exe

4. Find a delete.exe file

5. CREATE a times file. The file should look like:
01-45
02-45
03-45
04-45
05-45
06-45
07-45
08-45
09-45
10-45
11-45
12-53
13-53
14-53
15-53
16-53
17-53
18-45
19-45
20-45
etc** this is ep 01, 02, 03, etc and the time next to it is the time for the TOTAL amount of time that will be placed on *1* CD. So if you are doing two 20 minute episodes, your time will be *40* minutes next to each of those two episodes. Simple.

6. Get BBC (Bearson's Bitrate Calculator)

7. Virtualdub obviously.** NOTE-a: This script is NOT setup for DIVX5 OR DIVX4 installed. If they are installed, either delete them or edit the macro's {DOWN} option to pass through them during the codec selection
** NOTE-b: DO install divx3.11, it's setup for that so it must be installed, and this macro USES the HUFFY codec, so install that and set it up. (AVG size for a huffy avi is 5gb for 20mins)

8. The quot;C:\\epquot; folder is an empty folder where the filestorage for TEMPORARY files. If you are dealing with 20 minute episodes, the segmented huffy avis will be ~5gb so make sure that directory location has space.

9. Episode.txt should appear as follows:
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
etc*** this is just a VERY generic counter system i used. If you want to encode a particular episode, make sure the list counts UP to that episode. Just make this episode txt file one time.

10. Install BBMPEG for muxing the files

11. I use SSA scripts for subtitles on these episodes so you will need to put this filter in your virtualdub folder. like i explained before, DON'T install any filters, just put them in the vdub root folder. If you place them in the plugin folder then the macro will bypass them unless you re-write it.

12. SetEnv, PATH, f:\\AnimeSeries\\
Just sets the location to the folder where the episodes are going to be stored and where the vobs are. This system will count using the
quot;SetEnv, EPISODE, Ep16quot; amp; quot;SetEnv, TOTAL, 20quot; commands. So in your AnimeSeries folder you would need folders called
Ep16
Ep17
Ep18
Ep19
Ep20

If you are not 100% confused by now ;p, the quot;episodequot; and quot;totalquot; variables list your starting episode and ending episode that you will be encoding. If you were doing a FULL series you might want to start at 01 and end at 26. But you see how it works now. Also, this is another reason for the Episode.txt file and the Times.txt file. The correct numbers are pulled from those txt documents and implemented via these variable commands.

13. Finally, this script uses avisynth scripts in virtualdub. Your basic script can look like anything. Mine looks like:

LoadPlugin(quot;C:\Virtualdub\MPEG2DEC.dllquot;)
LoadPlugin(quot;C:\Virtualdub\IVTC.dllquot;)
LoadPlugin(quot;C:\IVTC\it.dllquot;)
mpeg2source(quot;F:\Anime\SeriesXYZ\ep04\ep04.d2vquot;)
IT (fps=24,ref=quot;TOPquot;,blend=false)

14. And one last note. In each Ep01 Ep02 Ep03 folder, you will need to name the d2v file quot;Epxx.d2vquot; xx=01 02 03 etc. The WAV file quot;Epxxj.wavquot; the ssa file quot;epxx-perfect.ssaquot; and the avs file quot;epxx.avsquot;

** If your series is dubbed and you have no subs, you *could* just delete the ssa portion out of the macro, but i would suggest leaving it in case of future need. Instead, just create a BLANK SSA file (open an existing one and delete all the lines). That will allow you to have a dubbed episode. Also snag vobsub. It is really nifty now that it allows you to OCR which p0wns subrips's ocr. heh VOBSUB OCR = GOD. And then just save the output as a .SSA. SO, SSA creation is a piece of cake. The benefit is that you can really modify the fonts or any other aspect of the subs much easier than a crappy srt.

Ok. This is the most generic guide to using my macro that anyone could have ever imagined ;p. I'm sorry, it's friday, i never intended to share this in the first place, but i'm feeling nice, but not nice enough to type 40 pages of explanitory text.

Again, what does this whole mess of crap do? Well, autoit is the best damn macro program ever made on the face of this planet. It's 100% script driven, so you must type this all by hand. As you can see, I took quite awhile doing mine. In the end, you can control your pc to do anything. I used mine to make a macro which would encode however many episodes of a series I wanted it to in the shortest time possible. I have dual AMD's and can whip out a 3 pass encode of a 20 minute episode from the END of the DVD2AVI creation to the FINAL MUX of the SVCD in less than an hour! Yes, I sh*t you not.

This script will create a 44khz mp2 file for the audio track. It will take your avisynth script (mine in this case is already IVTC'd via avisynth) and open it in virtualdub. It will auto-add the subs, resize to 480x480, save a segmented avi file. Open that file in CCE, encode it. Do a 3:2 pulldown. Mux it. Delete the temporary files, start over and do it all again. I have other scripts to make SBC divx files, ones to make DIVX + SVCD at the same time. You name it, it can be done via autoit.

So, what do you do first? D/l autoit from searching for it on google. Learn to use the basics of it. Come back and try to figure what all this nonsense means. Post some questions for me since this guide in NO WAY fully explains my script. But it does a decent job. ;p

LB

BTW: If you actually read all of this, you should be proud of yourself. Heh.

Why use this in comparison to DVD2SVCD? Simple, this does WHAT you want. DVD2SVCD is GREAT for a movie. But for episodes of a series, its impossible basically to use. Say you get a DVD with 3 epsiodes. For quality sake you dont want to put 3 on 1 80min CD. Also, you can add in whatever other options you want. Don't like my IVTC program in my avisynth script? Delete it and add decomb. Don't want to use that all together? Ask me and I'll post a IVTC script done in TMPG. Don't want to do SVCD, want DIVX SBC encodes? Ask me and ill paste my script of that.

Basically, DVD2SVCD is nice. Great program if you are just getting into the area of video encoding. I guess you could compare it to a NEW car and compare AutoIT to a KIT quot;Build your ownquot; car. There are no current easy ways to encode a crapload of short clips/episodes/whatever of video out there except via script.

BTW: This script is in NO WAY meant to be easy to read nor perfected for simplicity. It gets the job done and I know what it means and that's all that mattered when I created it. So a lot of it will be impossible to understand without understanding the command structure of AutoIT. But if you bang your head against the wall for a few hours and ask a few questions, it will all become clear.

waw!...

hope that means ya like it ;p

Yup. But that's waaay too much to learn

For expert like me who never used DVD2SVCD and converted ervery thing by hand your script is not interesting enough. For newbie it is not suitable, too. Scripting language too complicated for them. Thing of the script of avisynth, which only 5% in length of your script, brings so many people great pain. You script will make those 20 times more pain.

When you are so good in the shareware quot;AutoItquot;, perhaps you can develop a script to automate the menu conversion from DVD-Menu to (S)VCD/DiVX-Menu. That will be much more useful and will be highly appreciated by all experts incl. Doom9(I think so).

Well I dunno man. I consider myself an expert in the area of SVCD creation. I used to do it all by hand, but like I stated before. This is a script for short clips or episodes. Have you ever tried to encode 26 anime episodes with 26 previews? Such a pain doing it by hand. The previews alone are 30s each and to go through the entire process 26 times and to sync the subs for that small clip 26 times, do that for a few series(s) and you will understand the benefit of this. Also I am not really sure what you were saying or trying to explain about the avisynth part. It's just an option in there. Take it out if you want and insert a tmpg ivtc, or toss out ivtc all together. That's all I had the avisynth proggie doing. And, reason I chose that over tmpg was that avisynth and vdub are multiprocessor aware. Hence, they will use both cpus while processing the video which will speed it up 200% (3x).

I just bought a DVD-r this past week via dell and should get it in the near future. I doubt I'll be creating a dvd-menu to svcd/divx since its virtually impossible. There is such a functionality drop between the two that all you could convert over would be the video clip possibly. The navigational features would be lost since they cannot be implemented into svcds. But I can tell you one thing. I will be making a macro in the coming weeks to automate the conversion of SVCD to REAL MPG2 (dvd-r compatible) streams. I have a lot of svcds I would like to convert and re-encoding (i want fully compliant streams) is a pain. It would be nice to setup 100 directories with a movie in each one and hit run and come back a week later. ^.^

first of all: thanks for the program: very usefull!

i've a question about it:
i want to uncheck a cetain option in a program; i could do this with leftclick
but if the option is already unchecked, it would be checked after the script....
so my question is: is it possible in a script to see if a certain option is either checked or unchecked? so i can always set it to unchecked if i want?

Thanks a lot LB ! First of all I didn't know AutoIt, it's great (and it's free, not shareware as you said). And I think your scripts will help as a starting point.

to htc10825 -gt; I don't agree with you. You're right that newbies won't want to learn this scripting language, but the quot;expertsquot; will ! (though I don't consider myself as an expert). I also do everything quot;by handquot; because but it takes so much time :
- AVS Script Generation with FitCD (I don't rip DVDs, I convert only homemade AVIs)
- Edit the avs script to add filters
- Video Encoding with CCE
- Convert audio to mp2 with TMPGEnc and TooLame
- Multiplex mpv and mp2 with bbmpeg
- launch VCDEasy, import the MPEG
- create chapters
- generate BIN/CUE and burn (thanks to VCDEasy for making this automatic)

I usually launch the video encoding before going to work, and when I come back at night, I have to do all the audio conversion and video multiplexing quot;by handquot;. That would be great if this was automatical, too.

AutoIt lets you do EXACTLY what you want, with every proggie you're used to, and nothing is quot;hiddenquot;. That's great. Thanks again LB !

Djidjo

Daniel: Hmm... I think I ran into the same issue before. I don't believe there is a way. You would figure there would be. Why not try emailing the author? I bet he would implement it if you asked him

LB

This is a VERY simple script that say you have 20 eps of something and plan on DVD2AVI'ing the ENTIRE portion of EACH vob for EACH episode. Isn't it a pain to sit there for like 5 minutes and wait for (1) .d2v file to be created, then make another one, and another, etc etc? Well, here is an automated simple approach.

************* START HERE DO NOT COPY THIS LINE *******************

SetEnv, DAVI, C:\\DVD2AVI\\DVD2AVI.EXE
setEnv, VOBNAMES, c:\\VobNames.txt
SetEnv, EPI, C:\\Episode.txt

; --------------------------- Episode Location ---------------------------------

SetEnv, PATH, F:\\PROJECTalpha\\
SetEnv, EPISODE, Ep01
SetEnv, TOTAL, 10

; ------------------------------ BEGIN LOOP ---------------------------------

MySVCD:

;--------------------------- DVD2AVI Ripping ---------------------------

Run, %DAVI%
WinWaitActive, DVD2AVI
Send, {ALT}{ENTER}{ENTER}
winWaitActive, Open

StringRight, NUMBERTEST, EPISODE, 2
FileReadLine, VOBCODE, %VOBNAMES%, %NUMBERTEST%
StringRight, VOOB, VOBCODE, 8
Send, %PATH%%EPISODE%\\%VOOB%.VOB
Send, {ENTER}

WinWaitActive, File
Send, {DOWN}{ENTER}
Send, {F4}

WinWaitActive, Save
Send, %PATH%%EPISODE%\\%EPISODE%
Send, {ENTER}

Sleep, 5000
WinWaitActive, DVD2AVI
send, {ALT}{ENTER}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}

; -------------------------------- LOOP -------------------------------------

StringRight, NUMBER, EPISODE, 2
IfEqual, TOTAL, %NUMBER%, Goto, Bye
EnvAdd, NUMBER, 1
FileReadLine, EPY, %EPI%, %NUMBER%
StringRight, EPNUM, EPY, 2
SetEnv, EPISODE, Ep%EPNUM%
Goto, MySVCD

; -------------------------------- END --------------------------------------

Bye:
Exit

**************** END HERE DO NOT COPY THIS LINE *******************

This is a SIMPLE script to explain and understand. It's built for DVD2AVI v1.76.

The first two lines are your lines to DVD2AVI.EXE and to your vob names file. Since each episode may begin with a DIFFERENT vob file (e.g., vts_01_1.vob / vts_01_4.vob / vts_04_1.vob) you want to tell DVD2AVI what file to open. Remember, just need it to open the first non-0kb file and it will auto-open the remainder of that particular episode. Your vobnames.txt file should be similar to:

01-vts_01_1
02-vts_01_1
03-vts_01_2
04-vts_01_3
05-vts_01_4
06-vts_01_4
07-vts_01_5
08-vts_01_6
09-vts_01_1
10-vts_01_1
etc

Obviously, the first number is your episode#. The script will scan down it until it finds the corresponding episode. The other half of each line is the name of the first NON-0kb vob file (extension .vob not needed, copy the above verbatim).

Now that you created the .txt file, it's time to set the path locations. First set the path to where your episode dirs are located. In this case its F:\PROJECTalpha\ (don't forget the double \\ in the script file).

Ok, now lets set the episode start and stop positions.
SetEnv, EPISODE, Ep01
SetEnv, TOTAL, 10

quot;EPISODEquot; is the variable for the *starting* episode. In this case we will use 01. But, if you read my previous code you will realize that you can begin on ANY episode #.

quot;TOTALquot; is the *ending* or *stopping* episode. Obviously it has to be larger than quot;EPISODEquot; and it is since it's 10. And yes, my script is pasted correctly. Don't put a quot;Epquot; in front of the 10 like there is for the quot;EPISODEquot;. As I previously explained, this script was created on the fly. It was not made to be user friendly to anyone other than myself, that's why half of my variables have odd names. ;p

Almost there. We still need a episode.txt file. This is a geneirc counter file. Make it once and save it. It is all you will ever need for any project in the future. What's in it? Just count from 01,02,03, --gt; 99 or whatever. I think it maxes at 99. Gotta edit my script for it to reach 100+. Here is what a sample episode.txt looks like.

01
02
03
04
05
06
07
08
09
10
etc

Simple eh? And no, don't be a retard and include the quot;etcquot; ;p

Finally, don't forget to put the vob files in the correct locations. This script is based upon the idea that the path is the location to where the DIRECTORY OF EPS is located. So, create your filesystem on your HD as follows:

F:\PROJECTalpha\ep01\
F:\PROJECTalpha\ep02\
F:\PROJECTalpha\ep03\
etc

And inside those dirs, have the corresponding episodes.

Ok, last stretch. Don't forget to set the correct audio output. Just open DVD2AVI and select the correct audio stream, save a test or sample .d2v file so that it will modify the default settings automatically.

A-L-M-O-S-T   T-H-E-R-E!

Last item is to place the actual SCRIPT .aut file into the same directory as DVD2AVI.exe.

Why? The script is run from the direcory its located in.

So? Well, I found that your prefrences will not be re-used (aka, the audio stream you chose will not be saved) and thus if you chose stream 2 on the setup, it will default to stream one.

Solution? Place the .aut file into the same dir as dvd2avi.exe and everything should be perfect now.

RUN THE B*TCH! But don't forget, PRESS or CLICK NOTHING while it's running. Go get a beer or something. The acknowledgement that it's done with an episode is the quot;WinWaitActive, DVD2AVIquot; line. So, if you were to click something and make the dvd2avi window active again, hehe well try it and see for yourself.

Anyway, this is an EASY ASS script. Well, not THAT easy, but on a scale of 1-10 (10 being my first script/paste) I would give this a 6. It utilizes a lot of GOOD/USEFULL commands so if you can get through it, you will be one more step towards a recognized degree in AUTOITTIN! ;p

LB

BTW: Obviously this takes awhile to figure out on your first go. But if you are like myself and encode thousands (probably just hundreds) of small clips or episodes, this will save an ass of time. If you are just doing a .d2v for one episode or just 20 and never any more, then this is probably a waste or your time.

My god... I have to try this, for gods sake post a link!

heh it's not that difficult to go on google and search for quot;autoit downloadquot; but alas, here you are...

cgi-bin/co...oIt/AutoIt.zip

Originally posted by LB
So? Well, I found that your prefrences will not be re-used (aka, the audio stream you chose will not be saved) and thus if you chose stream 2 on the setup, it will default to stream one. this can be done much easier:
simply run this command:
Run, %DAVI%, c:\\dvd2avi\\

or change the path
or do this:
SetEnv, DAVIPATH, c:\\dvd2avi\\
Run, %DAVI%, %DAVIPATH%and another thing:
{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}
is the same as:
{DOWN 5}

and about the checked/unchecked thing:
i read something in the FAQ:
You should send quot;+quot; (for enabling) or quot;-quot; (disable) to the checkbox  instead.thats great. I didn't know about the {Down 5} command! And yea, I suppose if I thought about it for a little longer I woulda realized that solution in dvd2avi. ;p. Thanks for the answers.

LB

Thanks for pointing out Autoit.  This is a nice program that has simplified my encoding process.  I have included my autoit script I use for encoding, as it may be useful for others as well.

This script will take any number of mpeg2 video streams and process them through dvd2avi cli, create an avs script, and then re-encode using cce 2.66.01.02.  The first time you run the script, it will prompt you for the locations of the cce executable, dvd2avi cli executable, and the mpeg2dec.dll and save their locations to an ini file so you will not have to modify the script to specify their locations.  The script will then prompt for the mpeg2 files that you wish to re-encode (you can specify multiple files).  After you have selected all of the mpeg2 files you wish to re-encode, you will then be prompted if you want to 'force film' on these files, the aspect ratio, and the max. and avg. bitrate to use for encoding.  The process will then begin, first creating the d2v and avs files, then re-encoding each file.  One other nice feature of this script is that it will enter any chapter frames for you.  Simply create a text file with the same name as the mpeg2 file, but with an extension chp.  In this text file, enter the frame number of each chapter on a seperate line.  The script will then check to see if this file exists, and if so, will parse the file entering each chapter for that mpeg2 file into cce.

Here's the script...

************* START HERE DO NOT COPY THIS LINE *******************

; Before using this script...
; 1.  Create two templates in CCE.
;- The first template name must begin with a 0 (zero).  Use this template to configure your favorite settings for
;encoding interlaced material.
;- The second template name must begin with a 1 (one).  Use this template to configure your favorite settings for
;encoding progressive material.
;- Make sure that you do not have any other templates that begin with a 1 or 0.
;- This script will set Avg. and Max. bitrates, and Aspect ratio for you, so you do not need to worry about these
;in your templates.
;- Obviosly this script could be enhanced to eliminate templates and prompt for all values necessary to encode.
;However, I found it to be annoying to be prompted with a dozen questions everytime I ran this script as most
;of the settings, in my case, rarely change, other then bit rates and aspect ratios.  This may be different for
;you though.
; 2.  For the sake of simplicity, this script uses the cli version of DVD2AVI.  Make sure you have this.
; 3.  If you want to make sure all chapters start with an I frame, simply create a text file having the same name as the
;     video file being encoded, but with the extesion .chp.  Make sure this file is also in the same directory as the
;     video file.  In the text file, enter the frame number of each chapter on a separate line.SetEnv, FILENO,0
SetEnv, FILELIST,
SetEnv, ARRAYFILE,M2VFILEx
SetEnv, FILM,0
SetEnv, ASPECT,0
SetEnv, DEFMAXBITRATE,9600
SetEnv, DEFAVGBITRATE,4000

IfNotExist, %A_SCRIPTDIR%\\cceautoit.ini, Goto, createini
INIRead, CCE,%A_SCRIPTDIR%\\cceautoit.ini,Path,CCE
INIRead, DVD2AVI,%A_SCRIPTDIR%\\cceautoit.ini,Path,DVD2AVI
INIRead, MPEG2DEC,%A_SCRIPTDIR%\\cceautoit.ini,Path,MPEG2DEC
Goto, startfileselect

createini:
MsgBox, 0, CCE Location, Please select your CCE executable
FileSelectFile, CCE,1
MsgBox, 0, DVD2AVI CLI Location, Please select your DVD2AVI_CLI executable
FileSelectFile, DVD2AVI,1
MsgBox, 0, MPEG2DEC Location, Please select your MPEG2DEC.DLL
FileSelectFile, MPEG2DEC,1
INIWrite, %CCE%,%A_SCRIPTDIR%\\cceautoit.ini,Path,CCE
INIWrite, %DVD2AVI%,%A_SCRIPTDIR%\\cceautoit.ini,Path,DVD2AVI
INIWrite, %MPEG2DEC%,%A_SCRIPTDIR%\\cceautoit.ini,Path,MPEG2DEC

startfileselect:
MsgBox, 0, MPEG2 Files, Please select the files you wish to re-encode.

fileselect:
EnvAdd, FILENO,1
FileSelectFile, M2VFILE%FILENO%,1
ifEqual,ERRORLEVEL,1, Goto, selectcancel
Goto, filelist

selectcancel:
EnvSub, FILENO,1
Goto, displaylist

filelist:
; create the file list
StringReplace, X,ARRAYFILE,x,%FILENO%
StringReplace, Y,%X%,,
SetEnv, FILELIST, %FILELIST%\n%Y%
Goto, displaylist

displaylist:
; display the file list
MsgBox, 4,Selected Files,%FILELIST%\n\n\nSelect More Files?
IfMsgBox, NO, Goto, encode
goto, fileselectencode:
MsgBox, 4,Force Film, Enable Force Film?
IfMsgBox, YES, SetEnv, FILM,1
MsgBox, 4,Aspect Ratio, Set Aspect Ratio to 16:9?\n\n
IfMsgBox, YES, SetEnv, ASPECT,1
InputBox, MAXBITRATE,Maximum Bitrate, Enter Maximum Bitrate for Encoding:\n\n(Default is 9600)
InputBox, AVGBITRATE,Average Bitrate, Enter Average Bitrate for Encoding:\n\n(Default is 4000)
IfLess, MAXBITRATE,1,SetEnv, MAXBITRATE,%DEFMAXBITRATE%
IfLess, AVGBITRATE,1,SetEnv, AVGBITRATE,%DEFAVGBITRATE%
BlockInput, On
SetEnv, I,0
GoSub, step1
SetEnv, I,0
GoSub, step2
Goto, End

End:
BlockInput, Off
MsgBox, 0,Done,Completed on %A_MON%/%A_MDAY%/%A_YEAR% at %A_HOUR%:%A_MIN%:%A_SEC%
exit

step1:
; dvd2avi and create avs files
EnvAdd, I,1
IfGreater, I,%FILENO%, Return
StringReplace, X,ARRAYFILE,x,%I%
StringReplace, Y,%X%,,
SetEnv, CURRENTFILE, %Y%
StringTrimRight, OUTFILE,CURRENTFILE,4
RunWait, %DVD2AVI% -IA=4 -FO=%FILM% -CS=2 -TN=0 -IF[%CURRENTFILE%] -OF[%OUTFILE%] -Exit, %A_SCRIPTDIR%
RunWait, %COMSPEC% /C erase quot;%OUTFILE%.avsquot;
FileAppend, LoadPlugin(quot;%MPEG2DEC%quot;)\nMPEG2source(quot;%OUTFILE%.d2vquot;)\nResampleAudio(44100),%OUTFILE%.avs
Goto, step1step2:
; encode using cce
EnvAdd, I,1
IfGreater, I,%FILENO%, Return
StringReplace, X,ARRAYFILE,x,%I%
StringReplace, Y,%X%,,
SetEnv, CURRENTFILE, %Y%
StringTrimRight, FILENOEXT,CURRENTFILE,4
SetEnv, AVSFILE,%FILENOEXT%.avs
SetEnv, CHPFILE,%FILENOEXT%.chp
Run, %CCE%
WinWaitActive, CCE
WinActivate, CCE
; set the template.  1 for progresive and 0 for inerlaced
Send, !t
Send, %FILM%{ENTER}
Send, {ESC}
; add the avs file
RightClick, 87,100
Send, a
WinWaitActive, Open
Send, %AVSFILE%{ENTER}
WinWaitActive, CCE
; modify encode settings
LeftClick, 47,80
LeftClick, 47,80
WinWaitActive, Encode
; make sure something is changing so we can hit OK
Send, !r{UP}{DOWN}{TAB}
; set bitrate max and avg
Send, !b
Send, {TAB 2}
; max
Send, %MAXBITRATE%{TAB}
Send, !b
; avg
Send, %AVGBITRATE%{TAB}
; set aspect ratio
; 4:3 aspect ratio
IfNotEqual, ASPECT,1,Send, !r{DOWN 3}{UP 1}{TAB}
; 16:9 aspect ration
IfEqual, ASPECT,1,Send, !r{DOWN 3}{TAB}
; set chapters if chapters file exists
IfExist, %CHPFILE%, GoSub,ccechaps
; commit the settings made
LeftClick, 620,370
; encode it
LeftClick, 47,80
LeftClick, 47,80
WinWaitActive, Encode
Send, !w
; exit
WinWaitActive, Encode
Send, {ESC}
WinClose, CCE
Send, !n
Goto, step2ccechaps:
SetEnv, LINENO,0
SetTitleMatchMode, 2
Send, !s
WinWaitActive, avs
LeftClick, 47,80
LeftClick, 47,80
SetTitleMatchMode, 1
WinWaitActive, File
Goto, ccechapsloopccechapsloop:
EnvAdd, LINENO,1
FileReadLine, CHAP,%CHPFILE%,%LINENO%
IfEqual, ERRORLEVEL,1, Goto, ccechapsDone
LeftClick, 263,70
Send, {DELETE 8}%CHAP%!s
Goto, ccechapsloopccechapsDone:
Send, {ENTER}
SetTitleMatchMode, 2
WinWaitActive, avs
SetTitleMatchMode, 1
LeftClick, 254,354
Return

**************** END HERE DO NOT COPY THIS LINE *******************

Hope this script is also useful to others.  Let me know if you have any questions.

PB
¥
Back Forum Reply New