PDA

View Full Version : Tutorial - Bulk: de-/mux, encode, create d2v/avs; avisynth manual install


snowden
3rd October 2007, 23:50
I'm still working on this so keep checking back and don't be afraid to ask any questions!!
(I dunno what the proper section for this would be, because it doesn't seem to fit into any particular section directly.)


In case anyone is wondering, I originally found the batch command here:

http://forum.doom9.org/showthread.php?t=114932

If you want more help with understanding the windows batch commands:

http://en.wikibooks.org/wiki/Guide_to_Windows_commands


Anyway, here's how I figured out how to do everything in bulk using free software(s).

Please note that there are probably easier ways to do these things than the way I do, so if you do know something please tell me.


Bulk Demuxing audio/video streams from matroska (.mkv) files

Of course there are limitations with this, as not only do all your mkv files have to have at least 1 of the same types of tracks (e.g. video), but also they have to have been muxed together in the same order.

Here is a video tutorial on how to demux, along with a demux package. If you need any help with it let me know.

MKV Batch Demux Tutorial (http://www.rapidhoster.info/doom9/convert1-1.swf)
MKV Batch Demux Tools (http://www.rapidhoster.info/doom9/batchmkvextractor.rar)


Bulk Demuxing audio from MPEG-2 files, and in the process making a D2V and a corresponding AVS file from each one (WIN-TV anyone?)

This is so easy, but only works if your files are all the same format (MPEG-1/-2 [works for VOBs also]), and have previously been cut-edited (if needed) with an MPEG-2 stream editing tool such as Womble (http://womble.com/).

#1
The hardest part of this is not understanding the commandline, but understanding the way in which DGIndex works. If you don't understand it, you will find it difficult to fix anything you are not happy with.
What DGIndex does when you click on 'Save Project...', with a single MPEG/VOB file you have loaded is 1) create a .d2v file of that movie; 2) rip the audio stream off of it named the same as the file, except with the appropriate audio extension (.ac3/.mpa, etc.); 3) can also make a corresponding .avs file that works straight away if you have avisynth installed (but only if you specify the avs template file and select it to happen!) Not really that complicated at all. :)

#2
Open DGIndex and set the options you want for audio, video, and so on. These will be the default settings for your batch d2v making. It's very important to test that you get the desired output also, by testing a single file. Also you can select, if you want, to have an avs file automatically created for each file that gets d2v'd, but you will have to set up an avs template file. This template file contains paramaters which will appear in each avs file output; it may not be what you want for each file though, so it's entirely up to you.

#3
Now that you have set the default values, you can run the following command in a batch (.bat) or command (.cmd) file, and DGIndex will do the rest.
Put the following code into a .cmd or .bat file, and then put this file into the folder containing all the files you want to make d2v files from:

set filetype=*.mpg
set dgindex=S:\VIDEO_EDIT\COMPRESSION_PACK\dgmpgdec-149\DGIndex.exe

for /R %%A in (%filetype%) do IF NOT EXIST "%~1%%~pnA.d2v" "%dgindex%" -AIF=[%~1%%~pnxA] -OF=[%~1%%~pnA] -exit
You MUST change the value of dgindex from its current value to where YOU have DGIndex installed (e.g. set dgindex=<your/path/to/dgindex.exe), otherwise this won't work. Also, you may have to change the 'set filetype' to .vob if that is the filetype you want to process; otherwise leave that value alone.

The ~pn argument in its current state will leave your avs and d2v files containing relative paths to files, based on the current partition that the avs/d2v is in. For example, if your video file is in C:\videos\my_video.mpg, your associated .d2v file will contain the path to the mpeg file as "\videos\my_video.mpg", and the associated .avs file will contain the path to this file as mpeg2source("\videos\my_video.d2v") assuming that the d2v file is created in the same folder as the video itself. This will create problems if for example you decided to move the avs file to another partition, e.g. say it has the drive-letter D: (because then the \videos location would be pointing to a videos folder in the partition D: and not C: .
If you are using DubMan (VirtualDub Manager), and you are encoding files not all in the same partition, then you might want to change the batch command to

for /R %%A in (%filetype%) do IF NOT EXIST "%~1%%~pnA.d2v" "%dgindex%" -IF=[%~1%%~dpnxA] -OF=[%~1%%~dpnA] -exit

Take note of the "d" in front of the [pnxA] argument. The "d" stands for 'drive'. In this case your avs files will use absolute paths that include a drive letter when pointing to a file. [Thanks to Flintz]

See the original post here:
http://forum.doom9.org/showthread.php?t=130684



Bulk Muxing audio/video streams into an AVI file (e.g. AVI+MP3)

From what I have seen already, the general way to join audio to video (using VirtuaDub) is to have VirtualDub compress and join the audio to the video while the video is encoding. I might be wrong, but anyway I prefer to encode video and audio separately for one simple reason: a/v sync. Separate encoding of the audio and video simplifies testing them for sync. Encoding the audio right in during the video encode might lead to the problem where you only notice the video out of sync afterwards; then you might have to demux it if you want to re-encode it.

Basically all you have to do with this is download these 2 files (http://www.rapidhoster.info/doom9/batchmuxavi2mp3.rar), drag the .vcf file over onto the .vbs file, and then select the files and folders you want to mux. The only snag is that you will have to bulk rename your mp3 audio files in a certain fashion (when you have batch encoded them with BeSweet, or a similar batch audio transcoding tool), for this you can use something like LupasRename. Let's use example filenames to make things easier to understand; here's how your files should be named in a directory.

i) Let's say you have a folder with a load of avi files that you just bulk encoded using DubMan, perhaps. (E.g. these avi files have no audio attached to them.) For simplicity, assume they are called file01.avi, file02.avi, file03.avi, and so on.
In the same directory, you should place the corresponding audio files you already encoded into the mp3 format. Notice that when you used DGIndex to make d2v files of the video before you had encoded them, you should have had the audio stream of each one be ripped into the same directory, be they mpg or vob files (except each filetype could possibly yield a different audio format).
The important thing to note here is that each ripped audio stream gets the same name as its video counterpart, with the added extension T01 DELAY 0ms. If you think of it this way, file01.avi came from file01.mpg that had the audio ripped from it named "file01 T01 DELAY 0ms.mpa", and the same format for the other files. When you have encoded all of the mpa files into mp3 files, you put these mp3 files into the same directory as all of the avi video counterparts. ALWAYS MAKE BACKUPS!

ii) Now you have a directory full of file01.avi/file01 T01 DELAY 0ms.mp3, file02.avi/file02 T01 DELAY 0ms.mp3, and so on. What you have to do is rename each of the mp3 files; you should use a batch renaming tool for this, doing it by hand just makes a lot more work than is needed. In the renaming tool, you should rename each of the mp3 files to the following format: filexy.avi.mp3
Yes, each mp3 should now have the extension .avi.mp3 This is a limitation in the vbscript until i figure out (or someone tells me) how to add audio support to the vbs file. This is just a makeshift way of doing things for the time being! Using an example, your files should now be named file01.avi/file01.avi.mp3, file02.avi/file02.avi.mp3, file03.avi/file03.avi.mp3 and so on. Do note that the .avi.mp3 file is actually an mp3 file, don't add .mp3 to the end of an avi file!

iii) Make another folder inside the folder your files are in and call it 'muxed'. This is where your muxed avi files will be output to when you use VirtualDub to batch mux them together!

iv) Finally, put the .vbs and the .vcf file into the same directory that contains the files you want to mux, and then drag the .vcf file onto the .vbs file. You are now prompted to press the Cancel button if you want the path that is automatically suggested to you. See this (http://www.ericphelps.com/scripting/samples/VirtualDub/createjobs.gif) tutorial for more info. If you want to make your own .vcf file, see this (http://www.ericphelps.com/scripting/samples/VirtualDub/savevcf.gif) tutorial.

v) When your VirtualDub.jobs file has been created, move it into your VirtualDub folder (wherever you installed VirtuaDub). In other words, it should be placed in the same folder as VirtualDub.exe.

vi) Open up VirtualDub, and press the F4 key. Now your files will be muxed to the 'muxed' folder we made earlier.

vii) Check your files to see they are okay. If they are, delete the unmuxed files. Finished!

How To Manually Install Avisynth
Download this 7-Zip file (http://www.rapidhoster.info/doom9/manual_avisynth.7z), and run it with register_avisynth.cmd.
You can remove everything by running the AVISYNTH_FULL_REMOVE.REG and then deleting the avisynth.dll and devil.dll files from your system32/ directory.
I haven't tested this on Vista (and never plan to). It is only tested and working on XP SP2 for now.
And yes, devil.dll is actually part of the AviSynth installer, ask anyone on this forum. I basically installed avisynth 2.5.7 and took these two dll files from the system32/ directory.