Skip to content

Instantly share code, notes, and snippets.

@thanosa75
Created February 2, 2022 08:10
Show Gist options
  • Save thanosa75/cdc9aecf178c6694e8ab3390df73d2c2 to your computer and use it in GitHub Desktop.
Save thanosa75/cdc9aecf178c6694e8ab3390df73d2c2 to your computer and use it in GitHub Desktop.
A simple finalize script for Jitsi Meet Recordings, that uses FFMPEG to resize and convert to h265
#!/bin/bash
#
# a script to process Jitsi Meet recordings (JIBRI) and convert to a lower definition while converting
# to a more optimal video format - a few tunables are listed below
#
## encoding quality (lower == better)
# 23 is about 1.5x aka 45 FPS average on my hardware (6 core 12 thread Xeon 2.6GHz)
QENC=23
#scaling (find the default for your JIBRI, mine is 1080p)
VSCALE_720P="-vf scale=720:-1"
VSCALE_480P="-vf scale=480:-1"
VSCALE=$VSCALE_720P
DIR="$1"
# note destination is within the container - so you should mount (bind mount) something to it
# or configure mail/dropbox/s3 or similar to move the completed recordings out of the way
# this destination moves the file to 'recordings' directory
DEST="$(cd $DIR && cd .. && pwd)"
echo "Processing from $DIR to $DEST"
find "$DIR" -name "*mp4" -print0 | xargs -i'{}' -0 ffmpeg -i '{}' -c:v libx265 -crf $QENC -c:a copy $VSCALE '{}'.scaled.mp4
echo "moving to destination directory $DEST"
find "$DIR" -name "*scaled.mp4" -print0 | xargs -i'{}' -0 mv '{}' "$DEST/`date +%y%m%d_%H%M`_meeting.mp4"
echo "Removing original files"
find "$DIR" -name "*mp4" -print0 | xargs -i'{}' -0 rm -f '{}'
#exit 0 indicates success
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment