Skip to content

Instantly share code, notes, and snippets.

@btskinner
Last active January 7, 2022 19:49
Show Gist options
  • Save btskinner/85c4d973c5e42531f2ce45600530292f to your computer and use it in GitHub Desktop.
Save btskinner/85c4d973c5e42531f2ce45600530292f to your computer and use it in GitHub Desktop.
Bash script to convert OBS *.mkv files to *.mp4 that work with Canvas LMS
#!/usr/bin/env bash
# 1. Save script as mkv2mp4.sh
# 2. chown +x mkv2mp4.sh
# 3. Use to convert default OBS *.mkv files to *.mp4 files that work with Canvas LMS
usage()
{
cat <<EOF
PURPOSE:
Convert mkv files from obs into mp4 for Canvas.
USAGE:
$0 <arguments>
ARGUMENTS:
[-i] Name of input *.mkv file
EXAMPLE:
./mkv2mp4.sh -i intro.mkv
EOF
}
while getopts "hi:" opt;
do
case $opt in
h)
usage
exit 1
;;
i)
i=$OPTARG
;;
\?)
usage
exit 1
;;
esac
done
# set output file name
o="${i%%.*}".mp4
# code
ffmpeg -nostats -loglevel 0 -i $i -c copy -map 0 $o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment