Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Neeed your inputs to fix this.
#!/bin/bash
set -e
function error {
>&2 echo $1
exit 1
}
# set defaults
ffmpegParams="-strict -2"
# parse optional arguments
while test $# -gt 0
do
case $1 in
--help)
echo "Usage: mjr2mp4 [--ffmpeg-params <ffmpeg-params>] <video-mjr-source> <audio-mjr-source> <output-file>"
exit 1
;;
--ffmpeg-params)
shift
ffmpegParams=$1
;;
*)
break
;;
esac
shift
done
videoMjr=$1
audioMjr=$2
outputFile=$3
if [ -z $videoMjr ] || [ ! -f $videoMjr ] || [[ "$videoMjr" != *.mjr ]]; then
error "Must specify existing <video-mjr-source>"
fi
if [ -z $audioMjr ] || [ ! -f $audioMjr ] || [[ "$audioMjr" != *.mjr ]]; then
error "Must specify existing <audio-mjr-source>"
fi
if [ -z $outputFile ]; then
error "Must specify <output-file>"
fi
TFILE="$$"
videoSource=$TFILE.mp4
audioSource=$TFILE.opus
/home/ubuntu/bin/janus-pp-rec $videoMjr $videoSource
/home/ubuntu/bin/janus-pp-rec $audioMjr $audioSource
command="ffmpeg -i $videoSource -i $audioSource $ffmpegParams $outputFile"
echo $command
$command
test -f "${outputFile}" || error "No output file generated"
rm $videoSource
rm $audioSource
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment