2021-05-08 16:53:26 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
#####################################################
|
|
|
|
#
|
|
|
|
# This script will combine the audio from one file and the
|
|
|
|
# video from another file.
|
|
|
|
#
|
|
|
|
# Usage: bash ffmpeg/audio/audiovideo.sh <input audio> <input video> <output video>
|
|
|
|
#
|
|
|
|
#####################################################
|
|
|
|
|
|
|
|
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 \
|
2021-05-09 14:46:43 +00:00
|
|
|
-c:a aac \
|
|
|
|
-c:v libx264 \
|
|
|
|
-crf 22 \
|
2021-05-08 16:53:26 +00:00
|
|
|
-shortest \
|
|
|
|
"${OUTPUT}"
|