#!/bin/sh

# Encode video for web
# Needs a recent melt, libav* with X.264, AAC and WebM support, and the
# localvideowebencode script from git://source.jones.dk/bin

# Original video material consisted of three AVI files, the first
# slightly corrupted causing failures to recode as WebM.
# Solved by merging them with avimerge.  Originally fixing the corrupted
# file was an added bonus to the merge itself, which was required when
# encoding with ffmpeg that does not support merging on the fly - now
# with melt it would be more beneficial to "merge" only that first file
# to allow e.g. applying transition effects between the files.
avimerge -o video.avi -i MVI_1016.mp4 MVI_1017.mp4 MVI_1018.mp4

# Raw video was zoomed out a lot, activity at the sides occuring only at
# the first small chunk.  Solved by cropping to an area exactly
# half width and halfhalf height, and using that same target size, to
# limit quality loss.
# Also, make audio mono.
localvideowebencode -p quarter_15 -b 384k -- ac=1 -filter crop left=160 right=160 top=145 bottom=95 in=94 out=99999 video.avi
