#!/bin/bash -e

#####################################################
#
# This script will extract the audio from a video 
# losslessly into a .wav file.
#
# Usage: bash ffmpeg/audio/extract.sh <input video> <output audio>
#
#####################################################

INPUT="${1}"
OUTPUT="${2}"

# Check if output file extension is .wav
if [[ "${OUTPUT}" != *".wav" ]]; then
	echo "Please use an .wav extension on your output file argument"
	exit 1
fi

ffmpeg -i "${INPUT}" -vn "${OUTPUT}"