Northpack
19th August 2008, 01:43
Hi,
recently I had to transcode hundreds of wmv video files on harddisk - all with the same resolution and framerate - to h264. As I found no utility exactly fitting for that purpose, I developed a windows batch script doing the job (in doing so I was quite surprised how powerful stuff you can get out of such nasty batch-scripting). As my little tool proved well for my purpose, I thought it might be of some use for other people with similar tasks. So I decided to revamp it and make it available here.
BatCode v0.1.3 by Northpack
Licensed under the terms of the GNU General Public License.
Contents:
1. Introduction
2. Premises
3. Installation
4. Usage
5. Changelog
6. Known Issues
1. Introduction
---------------
BatCode is a Windows32 batch script for the purpose of
batch-transcoding a large amout of video files into x264/AAC.
It utilizes AviSynth frameserver to feed video and audio
streams to x264 encoder respectively Wavi/NeroAACEnc.
Both are eventually muxed using mp4box.
Currently, only one audio stream is supported.
2. Premises
-----------
To run BatCode, you have to have recent versions of the
employed programs (GPL/freeware) installed. These are:
- Avisynth 2.5 <http://www.avisynth.org>
- x264 <http://www.videolan.org/developers/x264.html>
- Nero AAC Encoder <http://www.nero.com/eng/down-ndaudio.php>
- Wavi <http://sourceforge.net/projects/wavi-avi2wav/>
- MP4Box <http://www.videohelp.com/tools/mp4box>
And optionally
- AsfBin <http://www.radioactivepages.com/>
If you use AviSynth DirectShowSource() input to convert
flv files you have to install lastest ffdshow filter:
<http://sourceforge.net/projects/ffdshow-tryout/>
3. Installation
---------------
3.1 Extract the content of the zip file to any folder and make
sure, the user who is supposed to run the script has write
permissons on it.
3.2 Customize batcode.ini:
Edit batcode.ini and set the parameters to the program
executables according to your system.
Set the programs' parameters according to your needs.
(Make sure you leave no spaces before or after the "=".)
3.3 Customize AVS templates:
In batcode.ini, two AVS templates are specified, one
for video and one for audio processing. These have to be
valid AVS files, except for the variable __SOURCE__ which
will be replaced with the actual source file name by the
script. Edit these AVS templates according to your needs.
To avoid trouble, make sure that the video template
only contains the video part of the source and vice versa.
4.Usage
-------
Usage: batcode <source> [destination] [ini file]
<source> may be a single filename or a set of files defined
by wildcards, including absolute or relative path. I.e.:
"c:\videos\more\*.avi" or "videos\more\justthisone.avi"
If [destination] is given, it defines the path and/or
prefix of the destination files, i.e.:
"videos\transcoded\new_"
will save the transcoded files to the path videos\transcoded
and add the prefix new_ to the name of the source files.
Normally BatCode will expect an batcode.ini in the path of
the script file. If [ini file] is given, it will use the
specified file instead. This is useful for creating profiles
with different encoder settings and AVS templates.
The command line
"batcode c:\videos\*.avi c:\videos\h264\ mysettings.ini"
will transcode all avi files inside the folder c:\videos\
to mp4 files saved to the subfolder h264 (Note that without
the trailing "\" files with prefix h264 would be created
in the folder videos).
It uses the ini file mysettings.ini instead of default
batcode.ini and thus the AVS templates specified therein.
BatCode also keeps a logfile to report which files were
encoded successfully or where errors occured. The name
of this logfile is specified in the batcode ini file.
5. Changelog
------------
v0.1.3:
- New option to fix corrupt WMV files. You can specify a
parameter asfb_dir in batcode.ini with the path to
AsfBin.exe (see 2.). If specified, BatCode will try to
fix WMV files that won't encode using AsfBin.
This should work for most WMV files that AviSynth won't
open because of corrupt or missing indexing.
v0.1.2:
- Fixed bug that BatCode won't run if there is no logfile
present already.
- BatCode now works with pathnames containing spaces,
if the pathname is put into quotes.
- BatCode now works with file- and pathnames containing
special characters (like German umlaut).
- New options introduced: you can now set the fourth command
line parameter to 4 binary digits.
The first digit tells BatCode whether to encode video
(1=encode), the second whether to encode audio (1=encode),
the third whether to mux audio and video (1=mux) and the
fourth if temporary files are to be sweeped (1=sweep,
only if muxing is enabled). Default is "1111".
v0.1.1:
- Fixed improper screen output if BatCode terminates
6. Known Issues
---------------
- MP4Box crashes AFTER finishing mux when destination
path contains relative directorys ".." or ".".
Download it here: http://www.kalebasse.de/div/batcode.zip
If you should have use for it, don't hesitate to post any questions or problems you encountered.
-Northpack
EDIT: Update to v.0.1.3
recently I had to transcode hundreds of wmv video files on harddisk - all with the same resolution and framerate - to h264. As I found no utility exactly fitting for that purpose, I developed a windows batch script doing the job (in doing so I was quite surprised how powerful stuff you can get out of such nasty batch-scripting). As my little tool proved well for my purpose, I thought it might be of some use for other people with similar tasks. So I decided to revamp it and make it available here.
BatCode v0.1.3 by Northpack
Licensed under the terms of the GNU General Public License.
Contents:
1. Introduction
2. Premises
3. Installation
4. Usage
5. Changelog
6. Known Issues
1. Introduction
---------------
BatCode is a Windows32 batch script for the purpose of
batch-transcoding a large amout of video files into x264/AAC.
It utilizes AviSynth frameserver to feed video and audio
streams to x264 encoder respectively Wavi/NeroAACEnc.
Both are eventually muxed using mp4box.
Currently, only one audio stream is supported.
2. Premises
-----------
To run BatCode, you have to have recent versions of the
employed programs (GPL/freeware) installed. These are:
- Avisynth 2.5 <http://www.avisynth.org>
- x264 <http://www.videolan.org/developers/x264.html>
- Nero AAC Encoder <http://www.nero.com/eng/down-ndaudio.php>
- Wavi <http://sourceforge.net/projects/wavi-avi2wav/>
- MP4Box <http://www.videohelp.com/tools/mp4box>
And optionally
- AsfBin <http://www.radioactivepages.com/>
If you use AviSynth DirectShowSource() input to convert
flv files you have to install lastest ffdshow filter:
<http://sourceforge.net/projects/ffdshow-tryout/>
3. Installation
---------------
3.1 Extract the content of the zip file to any folder and make
sure, the user who is supposed to run the script has write
permissons on it.
3.2 Customize batcode.ini:
Edit batcode.ini and set the parameters to the program
executables according to your system.
Set the programs' parameters according to your needs.
(Make sure you leave no spaces before or after the "=".)
3.3 Customize AVS templates:
In batcode.ini, two AVS templates are specified, one
for video and one for audio processing. These have to be
valid AVS files, except for the variable __SOURCE__ which
will be replaced with the actual source file name by the
script. Edit these AVS templates according to your needs.
To avoid trouble, make sure that the video template
only contains the video part of the source and vice versa.
4.Usage
-------
Usage: batcode <source> [destination] [ini file]
<source> may be a single filename or a set of files defined
by wildcards, including absolute or relative path. I.e.:
"c:\videos\more\*.avi" or "videos\more\justthisone.avi"
If [destination] is given, it defines the path and/or
prefix of the destination files, i.e.:
"videos\transcoded\new_"
will save the transcoded files to the path videos\transcoded
and add the prefix new_ to the name of the source files.
Normally BatCode will expect an batcode.ini in the path of
the script file. If [ini file] is given, it will use the
specified file instead. This is useful for creating profiles
with different encoder settings and AVS templates.
The command line
"batcode c:\videos\*.avi c:\videos\h264\ mysettings.ini"
will transcode all avi files inside the folder c:\videos\
to mp4 files saved to the subfolder h264 (Note that without
the trailing "\" files with prefix h264 would be created
in the folder videos).
It uses the ini file mysettings.ini instead of default
batcode.ini and thus the AVS templates specified therein.
BatCode also keeps a logfile to report which files were
encoded successfully or where errors occured. The name
of this logfile is specified in the batcode ini file.
5. Changelog
------------
v0.1.3:
- New option to fix corrupt WMV files. You can specify a
parameter asfb_dir in batcode.ini with the path to
AsfBin.exe (see 2.). If specified, BatCode will try to
fix WMV files that won't encode using AsfBin.
This should work for most WMV files that AviSynth won't
open because of corrupt or missing indexing.
v0.1.2:
- Fixed bug that BatCode won't run if there is no logfile
present already.
- BatCode now works with pathnames containing spaces,
if the pathname is put into quotes.
- BatCode now works with file- and pathnames containing
special characters (like German umlaut).
- New options introduced: you can now set the fourth command
line parameter to 4 binary digits.
The first digit tells BatCode whether to encode video
(1=encode), the second whether to encode audio (1=encode),
the third whether to mux audio and video (1=mux) and the
fourth if temporary files are to be sweeped (1=sweep,
only if muxing is enabled). Default is "1111".
v0.1.1:
- Fixed improper screen output if BatCode terminates
6. Known Issues
---------------
- MP4Box crashes AFTER finishing mux when destination
path contains relative directorys ".." or ".".
Download it here: http://www.kalebasse.de/div/batcode.zip
If you should have use for it, don't hesitate to post any questions or problems you encountered.
-Northpack
EDIT: Update to v.0.1.3