enc
“enc” is the project page for my simple (yet powerful) video encoding script. The requirements are just Python and ffmpeg so it should also run on Windows and Mac. It has only been tested on Debian Linux.
The libx264 presets are also required. If you do not have them and cannot find a package that contains them, you can get them from the ffmpeg source (just put the contents of the ffpresets directory into your ~/.ffmpeg directory).
With the current settings it uses libx264 to encode H.264 video, libfaac to encode AAC audio and outputs into a .mp4 container format. It may be possible to change these with the command line arguments but I have never needed to.
Download
Version 1.2 (2009-08-11)
Examples of use
Multiple DVDs to half CDs with de-interlacing and 128kbps stereo audio:
enc -t halfcd -a 128 -o '-deinterlace' dads_army_*.VOB
Blu-ray to data DVD (1080p – Will play on VLC in a PC that has a DVD drive or a Blu-ray player but not a DVD player). DVDs have a file size cap of 4GiB per file so something like “-s 4050m” may be better. This needs more testing but so far I seem to always come up about 15 to 20 megabytes under the 4GiB limit.
enc -t dvd -a 192 the_matrix.m2ts
Blu-ray to iPod
enc -s 1000m --ipod=16x9 i_am_legend.m2ts
Change log
Version 1.2 – 2009-08-11 (Download)
+ “-t”, “–target” option added to target Quarter CD, Half CD, CD and data DVD (175MiB, 350MiB, 700MiB and 4GiB respectively).
+ Size argument now accepts “k”, “m” and “g” suffixes. The argument “-s 350″ now means 350 bytes while “-s 350m” means 350 MiB.
+ “-o” option can now be used multiple times. Options will be concatenated.
+ “–ipod” argument adds 320×240 iPod support. This argument specifies the source aspect ratio and converts it to 4:3, if necessary, with top and bottom padding.
+ Positive bit rate checking added.
Version 1.1 – 2009-07-17
+ All scripts moved into a single python script.
+ Command line arguments added to avoid the need to edit the script
+ “-o”, “–opts” option added for added flexibility
+ “–sim” added for simulation only. This prints out the ffmpeg commands rather than executing them.
Version 1.0 – 2009-06-16
+ Python script to calculate bit rates based on target file sizes and constant audio bit rates.
+ Bash script to loop through files and run 2-pass ffmpeg on them.
Known bugs
* ffmpeg’s -t argument is ignored by the script so using something like -o ‘-t 60′ will generate bad bit rates. You can still use this but it will be as if you encoded the whole thing targeting a file size and then cut some seconds out of that. The current workaround is to cut what you want with the “copy” codecs and the “-t” and “-ss” arguments beforehand and then encode the resulting file with this script.
* Output file names are not very pretty. example.VOB will produce an output file called example.VOB.mp4 rather than example.mp4.