PDA

View Full Version : How to automate opening of multiple files?


junglemike
30th July 2008, 09:22
Hello folks.
here's what I need to do. I have about 850 .vob mpeg2 files off a video camera that i would like to encode to either x264/mp3/mkv or xvid/mp3/mkv.
Usually, In such cases I use VirtualDubMod's ability to process multiple files at one go (with "process directory" option in job control) - But the problem is that VDM cannot open many files /Via avs script . I have no problem loading single file via script in VDM of course. But not many. Or, at least I could not figure out how to do this. The script itself I create with Gordian Knot ( it has nice deinterlace and denoise options).
I would really really prefer to use Megui for encoding but I cannot find any ability to process mult. files in one go.

So, Bottom line the questions:

1)how can I create a same avisynth script for 850 files in one go??

2)After I solve 1) Is there any way to encode 850 files with Megui into x264? - If there isn't - I will be forced to use VDM's "process directory" on these scripts and encode to xvid instead.

Thank you for listening. :)

dat720
30th July 2008, 15:45
You could use vb script to create a new avs file for each vob file, but thats abit of effort and the time to set it up properly could just as well be spent manually creating a avs for each vob file.

I've never used Megui but i would assume the manual/help file would state if it could process a directory....

Edit: example of vbs to parse a directory and create a avs file for each of the files found in a directory....


strFolder = "D:\DVD\TERMINATOR2\VIDEO_TS"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strFolder)
Set colFiles = objFolder.Files
For Each objFile In colFiles
if inStr(objFile.Path,".VOB") then createavs(objFile.Path)
if inStr(objFile.Path,".vob") then createavs(objFile.Path)
Next

function createavs(filename)
Set fso = CreateObject("Scripting.FileSystemObject")
Set AVSFile = fso.CreateTextFile(filename & ".avs", True)
AVSFile.WriteLine("LoadPlugin(" & chr(34) & "d:\mpeg2dec.dll" & chr(34) & ")")
AVSFile.WriteLine("mpeg2source(" & chr(34) & filename & chr(34) & ")")
AVSFile.Close
end function


Edit: now that im home from work i spent abit of time tidying it up, it works nicely.....

I ran that on the folder specified and it created a avs for each vob file, 7 in all with the following contents:
LoadPlugin("d:\mpeg2dec.dll")
mpeg2source("D:\DVD\TERMINATOR2\VIDEO_TS\VTS_01_4.VOB")

junglemike
31st July 2008, 02:39
Thanks. This is very original Idea. Never thought of that.
I will try it with my files.
As I get it, I add up as many AVSFile.WriteLine() lines - i I have in my script. So , this way i can create scripts with any complexity, right?

dat720
31st July 2008, 03:20
Yup as long as you put them before the AVSFile.Close

Another thing to keep in mind is vbs is pretty picky about double qoutes........

LoadPlugin("d:\mpeg2dec.dll")
Looks like this in vb speak:
LoadPlugin(" & chr(34) & "d:\mpeg2dec.dll" & chr(34) & ")

chr(34) is the ascii equivelant of the " character.

Basicly replace " with " & chr(34) & "

If you get stuck paste you avs script and i'll throw it into vb for you!

dat720
31st July 2008, 17:21
I don't know why i was being such a dumb arse before and didn't think to convert the string to lower case then do a inStr check for .vob.......

here is a better version:
strFolder = "D:\DVD\TERMINATOR2\VIDEO_TS"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strFolder)
Set colFiles = objFolder.Files
For Each objFile In colFiles
strfilename = lcase(objFile.Path)
if inStr(strfilename,".vob") then createavs(strfilename)
Next

function createavs(filename)
Set fso = CreateObject("Scripting.FileSystemObject")
Set AVSFile = fso.CreateTextFile(filename & ".avs", True)
AVSFile.WriteLine("LoadPlugin(" & chr(34) & "d:\mpeg2dec.dll" & chr(34) & ")")
AVSFile.WriteLine("mpeg2source(" & chr(34) & filename & chr(34) & ")")
AVSFile.Close
end function