#!/bin/bash -e ##################################################### # # This script will combine the audio from one file and the # video from another file. # # Usage: bash ffmpeg/audio/audiovideo.sh # ##################################################### AUDIO="${1}" VIDEO="${2}" OUTPUT="${3}" # Check if output file extension is .mkv if [[ "${OUTPUT}" != *".mkv" ]]; then echo "Please use an .mkv extension on your output file argument" exit 1 fi ffmpeg -i "${VIDEO}" \ -i "${AUDIO}" \ -map 0:v:0 \ -map 1:a:0 \ -c:a aac \ -c:v libx264 \ -crf 22 \ -shortest \ "${OUTPUT}"