Skip to content

Instantly share code, notes, and snippets.

@dillonchr
Created April 10, 2020 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dillonchr/378ac95fa362b49486b7d077dfd30b39 to your computer and use it in GitHub Desktop.
Save dillonchr/378ac95fa362b49486b7d077dfd30b39 to your computer and use it in GitHub Desktop.
OBS records MKVs right? Well this zips them into one MKV for easy YouTubin'
#!/bin/bash
# usage: ./mkvjoin.sh "2020-04-03"
# then all recordings in the current dir with that file prefix (PREFIX*.mkv)
# will be ffmpeg'd into a single mkv stream without conversion so it's fast
#
# usage: ./mkvjoin.sh
# no arg will cause it to use today's date
# tested on macOS 10.15.3 (Catalina) heh
if [ -z "$1 " ]
then
today=$(date '+%Y-%m-%d')
else
today=$1
fi
file="$today.txt"
if [ -f "$file" ]; then
rm $file
fi
touch $file
find $today*.mkv -print0 |
while IFS= read -r -d '' line; do
echo "file '$line'" >> $file
done
cat $file
ffmpeg -f concat -safe 0 -i $file -c copy "$today.mkv"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment