Adding new encoding scripts and the template file.
authorBrennan Taylor <taylor.brennan@gmail.com>
Tue, 13 Apr 2010 20:07:02 +0000 (16:07 -0400)
committerBrennan Taylor <taylor.brennan@gmail.com>
Tue, 13 Apr 2010 20:07:02 +0000 (16:07 -0400)
encode.sh [new file with mode: 0755]
make-avi.sh [new file with mode: 0755]
make-flv.sh [new file with mode: 0755]
make-mp4.sh [new file with mode: 0755]
make-mpg.sh [new file with mode: 0755]
make-ogg.sh [new file with mode: 0755]
make-template.sh [new file with mode: 0644]
make-thumbs.sh [new file with mode: 0755]

diff --git a/encode.sh b/encode.sh
new file mode 100755 (executable)
index 0000000..92136ce
--- /dev/null
+++ b/encode.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+#####
+# TODO: b4taylor
+# * Progress printing
+
+if [ $# !=  "2" ] ; then
+    echo "Usage: encode input-video.format output_prefix";
+    exit 1;
+fi
+
+mkdir "encodes" 2> /dev/null
+if [ ! -d "encodes" ] ; then
+    echo "Could not create directory: encodes"
+    exit 1
+fi
+
+mkdir "timings" 2> /dev/null
+if [ ! -d "timings" ] ; then
+    echo "Could not create directory: timing"
+    exit 1
+fi
+
+TIC=`date +%s`
+
+# Job1: avi (xvid, mp3)
+./make-avi.sh $1 $2 &
+
+# Job2: mp4 (h264, aac)
+./make-mp4.sh $1 $2 &
+
+# Job3: mpg (mpeg2, mp2)
+./make-mpg.sh $1 $2 &
+
+# Job4: ogg (theora, vorbis)
+./make-ogg.sh $1 $2 &
+
+# Job5: flv
+./make-flv.sh $1 $2 &
+
+wait
+
+./make-thumbs.sh $1 $2
+
+TOC=`date +%s`
+
+LOG="$2.log"
+for i in timings/$2*.log ; do
+    echo $i >> $LOG
+    cat $i >> $LOG
+    rm $i
+done
+
+{
+    echo "$1"
+    echo "Total: `expr $TOC - $TIC`"
+} >> $LOG
+
+mv $LOG "timings"
+
diff --git a/make-avi.sh b/make-avi.sh
new file mode 100755 (executable)
index 0000000..33cf815
--- /dev/null
@@ -0,0 +1,15 @@
+V_BIT_RATE=768kb
+A_BIT_RATE=128kb
+
+LOG="timings/$2-avi.log"
+TIC=`date +%s`
+
+ffmpeg -i $1 -v -1 -y \
+       -vcodec libxvid -b "$V_BIT_RATE" \
+       -acodec libmp3lame -ac 1 -ab "$A_BIT_RATE" \
+       "encodes/$2.avi" 2> /dev/null
+
+TOC=`date +%s`
+
+echo "`expr $TOC - $TIC`" >> $LOG
+
diff --git a/make-flv.sh b/make-flv.sh
new file mode 100755 (executable)
index 0000000..042e40d
--- /dev/null
@@ -0,0 +1,14 @@
+V_BIT_RATE=768kb
+A_BIT_RATE=128kb
+
+LOG="timings/$2-flv.log"
+TIC=`date +%s`
+
+ffmpeg -i "$1" -v -1 -y \
+       -f flv -b "$V_BIT_RATE" \
+       -ac 1 -ab "$A_BIT_RATE" -ar 22050 \
+       "encodes/$2.flv" 2> /dev/null
+
+TOC=`date +%s`
+
+echo "`expr $TOC - $TIC`" >> $LOG
diff --git a/make-mp4.sh b/make-mp4.sh
new file mode 100755 (executable)
index 0000000..836db54
--- /dev/null
@@ -0,0 +1,26 @@
+V_BIT_RATE=768kb
+A_BIT_RATE=128kb
+
+LOG="timings/$2-mp4.log"
+TIC=`date +%s`
+
+ffmpeg -i $1 -v -1 -y\
+       -pass 1 -threads 0 -y \
+       -vcodec libx264 -b "$V_BIT_RATE"  -bt "$V_BIT_RATE" \
+       -vpre fastfirstpass \
+       "encodes/$2-first.mp4" 2> /dev/null
+
+ffmpeg -i $1 -v -1 -y \
+       -pass 2 -threads 0 \
+       -vcodec libx264 -b "$V_BIT_RATE" -bt "$V_BIT_RATE" \
+       -vpre hq \
+       -acodec libfaac -ac 1 -ab "$A_BIT_RATE" \
+       "encodes/$2.mp4" 2> /dev/null
+
+mv "ffmpeg2pass-0.log" "$2-ffmpeg2pass-0.log"
+mv "x264_2pass.log" "$2-x264_2pass.log"
+
+TOC=`date +%s`
+
+echo "`expr $TOC - $TIC`" >> $LOG
+
diff --git a/make-mpg.sh b/make-mpg.sh
new file mode 100755 (executable)
index 0000000..1e2fee7
--- /dev/null
@@ -0,0 +1,15 @@
+V_BIT_RATE=768kb
+A_BIT_RATE=128kb
+
+LOG="timings/$2-mpg.log"
+TIC=`date +%s`
+
+ffmpeg -i "$1" -v -1 -y \
+       -vcodec mpeg2video -b "$V_BIT_RATE" \
+       -acodec mp2 -ac 1 -ab "$A_BIT_RATE" \
+       "encodes/$2.mpg" 2> /dev/null
+
+TOC=`date +%s`
+
+echo "`expr $TOC - $TIC`" >> $LOG
+
diff --git a/make-ogg.sh b/make-ogg.sh
new file mode 100755 (executable)
index 0000000..fbb2619
--- /dev/null
@@ -0,0 +1,15 @@
+V_BIT_RATE=768kb
+A_BIT_RATE=128kb
+
+LOG="timings/$2-mkv.log"
+TIC=`date +%s`
+
+ffmpeg -i "$1" -y -v -1 \
+       -f ogg \
+       -b "$V_BIT_RATE" \
+       -ac 1 -ab "$A_BIT_RATE" -aq 60 \
+       "encodes/$2.ogg" 2> /dev/null
+
+TOC=`date +%s`
+
+echo "`expr $TOC - $TIC`" >> $LOG
diff --git a/make-template.sh b/make-template.sh
new file mode 100644 (file)
index 0000000..cc23243
--- /dev/null
@@ -0,0 +1,12 @@
+V_BIT_RATE=768kb
+A_BIT_RATE=128kb
+
+#TODO: Change logname
+LOG=`mktemp`
+TIC=`date +%s`
+
+#TODO: Encoding job here
+
+TOC=`date +%s`
+
+echo "`expr $TOC - $TIC`" >> $LOG
diff --git a/make-thumbs.sh b/make-thumbs.sh
new file mode 100755 (executable)
index 0000000..ed960cc
--- /dev/null
@@ -0,0 +1,22 @@
+V_BIT_RATE=768kb
+A_BIT_RATE=128kb
+
+#No logging for this script
+#LOG=`mktemp`
+#TIC=`date +%s`
+
+ffmpeg -itsoffset -20 -i $1 -y -v -1 \
+       -f rawvideo \
+       -vcodec mjpeg -vframes 1 -s 90x60 \
+       -an \
+       "encodes/$2-thumb-small.jpg" 2> /dev/null
+
+ffmpeg -itsoffset -20 -i $1 -y -v -1 \
+       -f rawvideo \
+       -vcodec mjpeg -vframes 1 -s 720x480 \
+       -an \
+       "encodes/$2-thumb-large.jpg" 2> /dev/null
+
+#TOC=`date +%s`
+
+#echo "`expr $TOC - $TIC`" >> $LOG