summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xhd_video_encoder37
1 files changed, 37 insertions, 0 deletions
diff --git a/hd_video_encoder b/hd_video_encoder
new file mode 100755
index 0000000..e589f21
--- /dev/null
+++ b/hd_video_encoder
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+set -e
+
+die() {
+ echo $1
+ exit 1
+}
+
+[ $# = 0 ] && die 'No input file name.'
+
+fname="$1"
+output="$1.mp4"
+bitrate=11000k
+
+if [ -f "$output" ] ; then
+ printf 'Output file exists: %s. Override? [yN] ' "$output"
+ read answer
+ case "$answer" in
+ [yY]) ;;
+ *) exit 0;;
+ esac
+fi
+
+vcodec_opts="-preset medium -level 4.1 -r 25 -b:v $bitrate -bt $bitrate -s hd1080 -aspect 16:9"
+
+ffmpeg -v warning -i "$fname"\
+ -vcodec libx264 $vcodec_opts\
+ -an\
+ -pass 1\
+ -f mp4 -y /dev/null
+
+ffmpeg -v warning -i "$fname"\
+ -vcodec libx264 $vcodec_opts\
+ -acodec libmp3lame -ab 256k\
+ -pass 2\
+ -y "$output"