c3d2-web/scripts/encode_mp4.sh

35 lines
542 B
Bash
Executable File

#!/bin/sh -e
if=$1
of=`basename "$1"`".mp4"
# No. CPU cores:
threads=2
# Video bitrate:
vb=400k
# Audio bitrate:
ab=96k
ffmpeg -i "$if" \
-f mp4 \
-an \
-threads $threads \
-vcodec libx264 \
-vpre libx264-ipod640 \
-b:v $vb \
-pass 1 \
-passlogfile "$of.ffmpeg2pass" \
-y /dev/null
ffmpeg -i "$if" \
-f mp4 \
-acodec libfaac \
-ab $ab \
-threads $threads \
-vcodec libx264 \
-vpre libx264-ipod640 \
-b:v $vb \
-pass 2 \
-passlogfile "$of.ffmpeg2pass" \
-y "$of"