Initial commit
authorElana Hashman <ehashman@csclub.uwaterloo.ca>
Fri, 17 Oct 2014 03:38:26 +0000 (23:38 -0400)
committerElana Hashman <ehashman@csclub.uwaterloo.ca>
Fri, 17 Oct 2014 03:38:26 +0000 (23:38 -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..07e5b03
--- /dev/null
+++ b/encode.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+#####
+# TODO: b4taylor
+# * Progress printing
+
+export ffmpeg=/users/pbarfuss/ffmpeg
+export ffmpegopts="$3"
+
+if [ $# !=  "3" ] ; then
+    echo "Usage: encode input-video.format output_prefix opts";
+    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 &
+# broken
+
+# Job2: mp4 (h264, aac)
+./make-mp4.sh $1 $2 &
+
+# Job3: mpg (mpeg2, mp2)
+# ./make-mpg.sh $1 $2 &
+# worthless
+
+# Job4: ogg (theora, vorbis)
+# ./make-ogg.sh $1 $2 &
+# broken
+
+# 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..05f45e5
--- /dev/null
@@ -0,0 +1,15 @@
+V_BIT_RATE=768k
+A_BIT_RATE=128k
+
+LOG="timings/$2-avi.log"
+TIC=`date +%s`
+
+$ffmpeg -i $1 $ffmpegopts -v -1 -y \
+       -vcodec libxvid -b "$V_BIT_RATE" \
+       -acodec libmp3lame -ac 1 -ab "$A_BIT_RATE" \
+       "encodes/$2.avi"
+
+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..f58bb78
--- /dev/null
@@ -0,0 +1,14 @@
+V_BIT_RATE=768k
+A_BIT_RATE=128k
+
+LOG="timings/$2-flv.log"
+TIC=`date +%s`
+
+$ffmpeg -i "$1" $ffmpegopts -v -1 -y \
+       -f flv -b "$V_BIT_RATE" \
+       -ac 1 -ab "$A_BIT_RATE" \
+       "encodes/$2.flv"
+
+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..691ff6f
--- /dev/null
@@ -0,0 +1,26 @@
+V_BIT_RATE=768k
+A_BIT_RATE=128k
+
+LOG="timings/$2-mp4.log"
+TIC=`date +%s`
+
+$ffmpeg -i $1 -v -1 -y $ffmpegopts -strict experimental \
+       -pass 1 -threads 0 -y \
+       -vcodec libx264 -f mp4 -b "$V_BIT_RATE"  -bt "$V_BIT_RATE" \
+       -vpre slow_firstpass \
+       "encodes/$2-first.mp4"
+
+$ffmpeg -i $1 -v -1 -y $ffmpegopts -strict experimental \
+       -pass 2 -threads 0 \
+       -vcodec libx264 -f mp4 -b "$V_BIT_RATE" -bt "$V_BIT_RATE" \
+       -vpre slow \
+       -acodec aac -ac 1 -ab "$A_BIT_RATE" \
+       "encodes/$2.mp4"
+
+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..bddb2d4
--- /dev/null
@@ -0,0 +1,15 @@
+V_BIT_RATE=768k
+A_BIT_RATE=128k
+
+LOG="timings/$2-mpg.log"
+TIC=`date +%s`
+
+$ffmpeg -i "$1" $ffmpegopts -v -1 -y \
+       -vcodec mpeg2video -b "$V_BIT_RATE" \
+       -acodec mp2 -ac 1 -ab "$A_BIT_RATE" \
+       "encodes/$2.mpg"
+
+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..a43db94
--- /dev/null
@@ -0,0 +1,15 @@
+V_BIT_RATE=768k
+A_BIT_RATE=128k
+
+LOG="timings/$2-mkv.log"
+TIC=`date +%s`
+
+$ffmpeg -i "$1" $ffmpegopts -y -v -1 \
+       -f ogg \
+       -b "$V_BIT_RATE" \
+       -ac 1 -ab "$A_BIT_RATE" -aq 60 \
+       "encodes/$2.ogg"
+
+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..29f7bb8
--- /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