2

I'm working on a video piece by piece, saved with the filenames scene1.avi, scene2.avi and so on.

I want an easy way to build the video into one block and dub in the audio track. For this purpose, I'm using VirtualDub.

Now, it's simple enough for me to open VirtualDub, go through File => Open, load the first scene, go to File => Append video segment, select the second scene, check the "autodetect additional segments by filename" option, set the video to Direct Stream Copy, set the audio to "from other file" and choose the soundtrack, then save the whole thing as out.avi... but it takes four lines just to explain all that!

What I'd like is a VCF script to build all these files together. Unfortunately, the coding language sucks.

I don't know what I was thinking when I created this scripting language. It's very loosely based on C, but it sucks more. I must have been watching Bubblegum Crisis before I created it.
All statements are either declarations or expressions, and all statements must end in a semicolon. There is no flow control -- no functions, no procedures, no if, no while, no for, no switch, no goto.

No if, no while, no for... so I guess while file exists("scene"+i+".avi") {VirtualDub.Append("scene"+i+".avi"); i++;} is completely out of the question.

I am using a Batch script to check for the existence of the VCF file and run VirtualDub with the correct command line to run the script, so perhaps I might be able to use that script to "build" the VCF file needed to include all the files? Is there any way to autodetect the segments in the VCF file, or will I have to custom-build the VCF using the Batch script?

Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592
  • Virtual VCF file works better as a state file rather than a video script. You might want to use *AviSynth* instead. It has a plugin for VirtualDub. – Jay Sep 12 '12 at 03:53
  • I tried using AVISynth, but for some reason it'd always fail to load into VirtualDub. It may be because I'm working with huge files (uncompressed 1080p for a total of around 30GB so far...) – Niet the Dark Absol Sep 12 '12 at 04:09

2 Answers2

2

I just ran across this question after researching ways to do something very similar. It seems to me that the best thing to do is to write a little script or program that generates a VirtualDub script file for one-time use, then executes it.

For example, I hand-wrote the following script to concatenate three .avi files together:

// Set Video and Audio to Direct Stream Copy
VirtualDub.video.SetMode(0);
VirtualDub.audio.SetMode(0);

VirtualDub.Open(U"D:\path\to\file1.avi");
VirtualDub.Append(U"D:\path\to\file2.avi");
VirtualDub.Append(U"D:\path\to\file3.avi");

VirtualDub.SaveAVI(U"D:\path\to\concatenatedFile.avi");
VirtualDub.Close();

You could use this as a template and go from there.

Eric Pohl
  • 2,324
  • 1
  • 21
  • 31
1

I just wrote something related/similar that should get you started on the coding. it is a batch file, so copy the following to something.bat:

Set Mfps=23.976
Set Bpath="E:\- Video Extractions\Virtualdub\1920x1280 (23.976fps pure,93%%,MPEG2,deinterlaced)auto openNsave.vcf"
rem Set Bpath="E:\- Video Extractions\Virtualdub\852x480 DAR3 (16x9) (24fps,96%%,MPEG2,deinterlaced).vcf"
Set Vdpath="E:\- Video Extractions\Virtualdub\VirtualDub-1.8.8\"
Set Svpath="D:\"
for %%A in (*.mkv *.avi *.mpg *.mpeg *.m2ts *.vob) do >%%~nA.avs echo # M2ts file & >>%%~nA.avs echo SetMemoryMax(128) & >>%%~nA.avs echo DirectShowSource("%%~dA%%~pA%%~nA%%~xA", fps=%Mfps%, audio=true, seekzero = true, convertfps=true) & >>%%~nA.avs echo EnsureVBRMP3Sync() & start /d %Vdpath% VirtualDub.exe /i %Bpath% "%%~dA%%~pA%%~nA.avs" "%Svpath%%%~nA.avi"
rem ---Notes---
rem code requires: Avisynth, virtualdub, pre-existing (.vcf) config file
rem most people prefer to use virtualdub with jobs in queue; run them in sequence. This runs jobs in parallel by searching the directory of the script, finding all listed wildcard masked files below, generating a simple avisynth script file for each file, then opening virtualdub and autosaving the video to .avi
rem caution, this will stress your system. you may only be able to handle 1 file at a time. I can input 30 blueray .m2ts files just fine, so long as i set vdub process to idle or low. Modify the code to your hearts content  ~  TigerWild
rem create a unique .vcf that you will use with this batch file only. Do this by running Virtualdub, opening a video file, configuring all your settings as you want them, then selecting File->save processing settings->.vcf
rem use a text editor to open the vcf file you made, and add these 2 lines:      VirtualDub.Open(VirtualDub.params[0]); VirtualDub.SaveAVI(VirtualDub.params[1]);
rem ---References---
rem http://stackoverflow.com/questions/8749637/dos-command-to-sperate-file-name-and-extension-into-variables
rem http://forum.doom9.org/archive/index.php/t-152842.html     with a nod to stax76
Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592
TigerWild
  • 11
  • 2