--- /dev/null
+#!/bin/bash
+
+# inputdesc specification:
+#
+# general options
+# output_file\tinput_file\tspecific_options
+# output_file\tinput_file\tspecific_options
+#
+# Example inputdesc
+# --filters pp=ci,crop=704:576:10:0,scale=768:576,denoise3d,harddup
+# 1x01.avi dvd://1 --dvd DISC1
+# 1x02.avi dvd://1 --dvd DISC2
+
+
+input="$1"
+if [ -z "$input" ]; then
+ echo "Usage: $0 inputdesc"
+ exit 1
+fi
+
+# Read the general options
+options="$(head -n 1 "$input")"
+
+# Read each file description
+tail -n +2 "$input" | while read line; do
+ out=$(echo "$line" | cut -d ' ' -f 1)
+ in=$(echo "$line" | cut -d ' ' -f 2)
+ specopts=$(echo "$line" | cut -d ' ' -f 3)
+ nice -n 10 toh264.py $options $specopts "$in" "$out"
+done
+
--- /dev/null
+#!/usr/bin/env python
+
+import optparse, subprocess, sys
+
+cmd = [
+ "mencoder", "%(input)s", "-o", "%(output)s",
+ "-ffourcc", "DX50",
+ "-vf", "%(filters)s",
+ "-ovc", "x264", "-x264encopts", "pass=%(pass)d:turbo:bitrate=%(vbitrate)d:bframes=0:me=umh:partitions=all:trellis=1:qp_step=4:qcomp=0.7:direct_pred=auto:keyint=300",
+ "-oac", "faac", "-faacopts", "br=%(abitrate)d:mpeg=4:object=2", "-channels", "2", "-srate", "48000",
+]
+
+parser = optparse.OptionParser(usage="%prog [options] input output")
+parser.add_option("--dvd", action="store", dest="dvd")
+parser.add_option("--filters", action="store", dest="filters", default="denoise3d")
+parser.add_option("--vbitrate", action="store", dest="vbitrate", type="int", default=600)
+parser.add_option("--abitrate", action="store", dest="abitrate", type="int", default=192)
+parser.add_option("--dump", action="store_true", dest="dump")
+try:
+ opts, (input, output) = parser.parse_args(sys.argv[1:])
+except:
+ parser.print_usage()
+ sys.exit(1)
+
+# Start/stop time?
+# Custom dvd device?
+if opts.dvd:
+ cmd.insert(1, opts.dvd)
+ cmd.insert(1, "-dvd-device")
+
+# Default options
+subst = {
+ "vbitrate": opts.vbitrate,
+ "abitrate": opts.abitrate,
+ "filters": opts.filters,
+ "input": input,
+}
+
+def run(args):
+ if opts.dump:
+ print " ".join(args)
+ else:
+ subprocess.Popen(args).wait()
+
+# Pass 1
+subst["pass"] = 1
+subst["output"] = "/dev/null"
+run([x % subst for x in cmd])
+
+# Pass 2
+subst["pass"] = 2
+subst["output"] = output
+run([x % subst for x in cmd])
+
--- /dev/null
+#!/bin/bash
+
+input="$1"
+output="$2"
+if [ -z "$input" -o -z "$output" ]; then
+ echo "Usage: $0 infile outfile"
+ exit 1
+fi
+
+mplayer "$input" -dumpvideo -dumpfile tmp.h264 &&
+mplayer "$input" -dumpaudio -dumpfile tmp.aac &&
+mp4creator -create=tmp.h264 -H -rate=25 "$output" &&
+mp4creator -create=tmp.aac -H -I -rate=25 -optimize "$output" &&
+rm -f tmp.aac tmp.h264 &&
+echo 'Done!'
+