Skip to content

Instantly share code, notes, and snippets.

@paulo-amaral
Last active March 28, 2024 05:59
Show Gist options
  • Save paulo-amaral/ba6b2910ec70fc568e6b16b0cc00756f to your computer and use it in GitHub Desktop.
Save paulo-amaral/ba6b2910ec70fc568e6b16b0cc00756f to your computer and use it in GitHub Desktop.
Update the recording file name in Jibri - Part of JITSI MEET
#!/bin/bash
#Script to save records by date to better organize your recordings
#Use on :
#mounted NFS SHARE VIA FSTAB or local folder.
#The folder to save records is configured on Jibri json file (config.json.
#Dependencies : mailutils
RECORDINGS_DIR=$1
# Find latest modified directory
_lastdir=$(find /opt/SRV-RECORDS -mindepth 1 -maxdepth 1 -type d -exec stat --printf="%Y\t%n\n" {} \; | sort -n -r | head -1 | cut -f2)
# Rename the directory
if [ -r ${_lastdir} ]; then
mv ${_lastdir} /opt/SRV-RECORDS/$(date +%Y-%m-%d_%H:%M)
fi
# Find files in directory
_recording=$(find /opt/SRV-RECORDS/$(date +%Y-%m-%d_%H:%M) -type f -name "*.mp4" -exec basename {} .mp4 \;)
# Send file(s) list
echo -e "Hi ,\n\nNew conference recording is available:\n\n ${_recording}" | mailx -s "New conference recording" [email protected]
# Move the .mp4 file & delete the folder
mv /opt/SRV-RECORDS/$(date +%Y-%m-%d_%H:%M)/*.mp4 /opt/SRV-RECORDS
# ffmpeg need some time to finalize the .mp4 - then remove old folder
sleep 1m
cd /opt/SRV-RECORDS
find . -maxdepth 1 -mindepth 1 -type d -exec rm -rf '{}' \;
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment