Created
January 18, 2018 16:40
-
-
Save anildigital/7adbdf46fc1750c777b9fa61a763ba58 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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: mjr2webm [--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