Created
August 2, 2022 17:07
-
-
Save player0k/92fd4650228368416a8881920dab7072 to your computer and use it in GitHub Desktop.
Script mixing Janus .mjr video files (videocall recordings)
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 | |
JANUS_BIN=/usr/bin/janus-pp-rec | |
FFMPEG_BIN=/usr/bin/ffmpeg | |
file1=$1 | |
file2=$2 | |
out1=${file1%.mjr}.webm | |
out2=${file2%.mjr}.webm | |
if [ -z "$3" ] | |
then | |
out3=OUTPUT.webm | |
else | |
out3=$3 | |
fi | |
start1=`$JANUS_BIN --extended-json $file1 | jq ".u"` | |
start2=`$JANUS_BIN --extended-json $file2 | jq ".u"` | |
delay=$((($start1-$start2)/1000)) | |
if [ $delay -lt 0 ] | |
then | |
delay1=0 | |
delay2=${delay#-} | |
else | |
delay1=$delay | |
delay2=0 | |
fi | |
$JANUS_BIN $file1 $out1 | |
$JANUS_BIN $file2 $out2 | |
$FFMPEG_BIN -i $out1 -i $out2 -filter_complex "[0:v]format=yuv420p, scale=640:360:force_original_aspect_ratio=increase,\ | |
crop=640:360,setsar=1,setpts=PTS-STARTPTS,tpad=start_duration=${delay1}ms:start_mode=add:color=black[l]; \ | |
[1:v]format=yuv420p, scale=640:360:force_original_aspect_ratio=increase,\ | |
crop=640:360,setsar=1,setpts=PTS-STARTPTS,tpad=start_duration=${delay2}ms:start_mode=add:color=black[r]; \ | |
[l][r]xstack=inputs=2:fill=black:layout=0_0|w0_0, pad=1280:720:-1:-1[stacked]" -map [stacked] -preset superfast $out3 | |
rm -f $out1 $out2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment