--- /dev/null
+#! /bin/sh
+
+if [ -z "$7" ]; then
+ echo "Usage: $0 title aid1 bitrate1 scale1 aid2 bitrate2 scale2 [menoder options]" >&2
+ exit 1
+fi
+
+title="$1"
+aid1="$2"
+bitrate1="$3"
+scale1="$4"
+aid2="$5"
+bitrate2="$6"
+scale2="$7"
+shift 7
+
+echo "INAM $title" | iconv -f koi8-r -t utf-8 >avi_comments.txt
+echo "ICMT Codec: FFmpeg (DivX5)" >>avi_comments.txt
+
+aid="$aid1" abitrate="$bitrate1" ascale="$scale1" m_encode "$@" &&
+m_extract_a1_comments "$aid2" -lameopts cbr:br=$bitrate2:q=0 -af volume="$scale2" "$@" &&
+mv output2.avi "$title".avi &&
+exec rm avi_comments.txt divx2pass.log a"$aid2".mp3 output.avi