#!/bin/bash -e
#####################################################
#
# This command will re-encode a video into an MP4
# container with H264 video and AAC audio encoded to
# 96K. Each of the arguments are explained as follows:
#
# -i "${INPUT}"
# Sets the first argument, saved as variable "$INPUT"
# as the input file that ffmpeg will re-encode. Must
# go at the beginning of your command.
#
# -codec:video libx264
# Sets the video codec to libx264, which is the library
# ffmpeg uses to encode H264 video streams.
#
# -preset slow
# Sets the preset of the H264 encoding process to run
# slow, which can yield higher quality imagery at the
# expense of speed. Available options:
# ultrafast, superfast, veryfast, faster, medium (default),
# slow, slower, veryslow, placebo
#
# -crf 22
# Sets the Constant Rate Factor of the video stream,
# which determines the data rate. The range of -crf
# values range from 0 to 51, with 0 being visually
# lossless and 51 being extremely compressed.
#
# -codec:audio aac
# Sets the codec of the output audio stream to AAC.
#
# -b:a
# Sets the data rate of the audio to 192kbit/s.
#
# "${OUTPUT}"
# The output video file, which should be the last
# argument you provide.
#
# Usage: bash ffmpeg/basic/reencode.sh