summaryrefslogtreecommitdiff
path: root/localvideowebencode
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2014-10-01 18:47:39 +0200
committerJonas Smedegaard <dr@jones.dk>2014-10-01 18:47:39 +0200
commit42579a665a3e888ca2224ed5f8a7de512f8438de (patch)
tree963966f7e5586bce69f89a3f675c2982531baddd /localvideowebencode
parentac972d69ff720a4dec8384a1c17f1134d715b831 (diff)
Tidy: Separate codecs from containers.
Diffstat (limited to 'localvideowebencode')
-rwxr-xr-xlocalvideowebencode22
1 files changed, 13 insertions, 9 deletions
diff --git a/localvideowebencode b/localvideowebencode
index 2756435..a4d08a7 100755
--- a/localvideowebencode
+++ b/localvideowebencode
@@ -368,18 +368,22 @@ esac
melt="melt -progress"
_melt_sample="$infile_first ${sample:+in=${samplestart:-0} out=$((${samplestart:-0} + samplelength))}"
_melt_video="progressive=1${framerate:+ frame_rate_num="$framerate_num" frame_rate_den="$framerate_den"}${size:+ s=${width:+$width}x${height:+$height}}${aspect:+ aspect=$aspect}"
-_melt_ogg="$_melt_video f=ogg vcodec=libtheora${bitrate:+ vb=$bitrate} qscale=$qscale_theora"
-_melt_webm="$_melt_video f=webm vcodec=libvpx vpreset=libvpx-$webmpreset${bitrate_vp8:+ vb=$bitrate_vp8 minrate=$((bitrate_vp8/20)) maxrate=$((bitrate_vp8*12))} crf=$crf_vp8 cpu-used=$cpu_vp8"
+_melt_theora="vcodec=libtheora${bitrate:+ vb=$bitrate} qscale=$qscale_theora"
+_melt_vp8="vcodec=libvpx vpreset=libvpx-$webmpreset${bitrate_vp8:+ vb=$bitrate_vp8 minrate=$((bitrate_vp8/20)) maxrate=$((bitrate_vp8*12))} crf=$crf_vp8 cpu-used=$cpu_vp8"
# CRF ignored with libvpx 1.3
-_melt_vp9="$_melt_video f=webm vcodec=libvpx-vp9 vpreset=libvpx-$webmpreset${bitrate_vp9:+ vb=$bitrate_vp9 minrate=$((bitrate_vp9/20)) maxrate=$((bitrate_vp9*12))} crf=$crf_vp9 cpu-used=$cpu_vp9"
-_melt_h264="$_melt_video f=mp4 vcodec=libx264 vpreset=$speedpreset_h264 vprofile=baseline${x264tune:+ tune=$x264tune} threads=0 movflags=+faststart crf=$crf_h264"
+_melt_vp9="vcodec=libvpx-vp9 vpreset=libvpx-$webmpreset${bitrate_vp9:+ vb=$bitrate_vp9 minrate=$((bitrate_vp9/20)) maxrate=$((bitrate_vp9*12))} crf=$crf_vp9 cpu-used=$cpu_vp9"
+_melt_h264="vcodec=libx264 vpreset=$speedpreset_h264 vprofile=baseline${x264tune:+ tune=$x264tune} threads=0 movflags=+faststart crf=$crf_h264"
_melt_audio="${channels:+ac=$channels}"
# limit (i.e. avoid peaks "clipping")
_melt_postfilters_audio="${limit:+-filter ladspa.1077}"
_melt_vorbis="$_melt_audio acodec=libvorbis${channels:+ ab=$(($channels*$bitrate_vorbis))k}"
_melt_opus="$_melt_audio acodec=libopus${channels:+ ab=$(($channels*$bitrate_opus))k}${opusapp:+ application=$opusapp}"
_melt_aac="$_melt_audio acodec=aac${channels:+ ab=$(($channels*$bitrate_aac))k}"
-_melt_img="$_melt_video f=image2"
+_melt_ogg="f=ogg $_melt_video $_melt_theora $_melt_vorbis"
+_melt_webm="f=webm $_melt_video $_melt_vp8 $_melt_vorbis"
+_melt_webm_vp9="f=webm $_melt_video $_melt_vp9 $_melt_vorbis"
+_melt_mp4="f=mp4 $_melt_video $_melt_h264 $_melt_aac"
+_melt_img="f=image2 $_melt_video"
avconv="avconv -threads auto -y -v warning"
_avconv_vp8="-c:v libvpx -pre:v libvpx-$webmpreset${bitrate_vp8:+ -b:v $bitrate_vp8 -minrate $((bitrate_vp8/20)) -maxrate $((bitrate_vp8*12))} -crf $crf_vp8 -cpu-used $cpu_vp8"
@@ -408,10 +412,10 @@ echo "Encoding video..."
$melt ${_melt_sample:-$infiles} \
${channels:+$audioprefilters${_melt_loudness:+ -filter loudness results="$_melt_loudness"}} \
$filters${channels:+ $_melt_postfilters_audio} \
- ${ogg:+-consumer avformat:$stem.ogv $_melt_ogg $_melt_vorbis} \
- ${webm:+-consumer avformat:$stem.webm $_melt_webm${multipass:+ pass=2 passlogfile=${stem}_vp8} $_melt_vorbis} \
- ${vp9:+-consumer avformat:${stem}_vp9.webm${multipass:+ pass=2 passlogfile=${stem}_vp9} $_melt_vp9 $_melt_opus} \
- ${mp4:+-consumer avformat:$stem.mp4 $_melt_h264 $_melt_aac}
+ ${ogg:+-consumer avformat:$stem.ogv $_melt_ogg} \
+ ${webm:+-consumer avformat:$stem.webm $_melt_webm${multipass:+ pass=2 passlogfile=${stem}_vp8}} \
+ ${vp9:+-consumer avformat:${stem}_vp9.webm $_melt_webm_vp9${multipass:+ pass=2 passlogfile=${stem}_vp9}} \
+ ${mp4:+-consumer avformat:$stem.mp4 $_melt_mp4}
if [ -n "$mp4" ] && [ -z "$melt_recent" ]; then
mv "$stem.mp4" "$stem.mp4"~