Skip to content

Instantly share code, notes, and snippets.

@Manouchehri
Created July 9, 2023 14:49
Show Gist options
  • Save Manouchehri/72f45635b1dd451b29ad6a4385af5657 to your computer and use it in GitHub Desktop.
Save Manouchehri/72f45635b1dd451b29ad6a4385af5657 to your computer and use it in GitHub Desktop.
Convert a OBS Capture (in HEVC) to a .mov that Apple Keynote and Final Cut Pro can import
#!/bin/bash
# sudo nano /usr/local/bin/mkv_to_mov_hevc.sh
# paste all of this text into that file
# sudo chmod +x /usr/local/bin/mkv_to_mov_hevc.sh
# now you can run: mkv_to_mov_hevc.sh your_obs_screencap.mkv
# you'll end up with a your_obs_screencap.mov that Final Cut Pro and Apple Keynote can import
# Define a function that takes an input file, converts it, and saves it as a .mov
convert_to_mov() {
inputfile="$1"
outputfile="${inputfile%.*}.mov" # Change the extension to .mov
echo "Converting $inputfile to $outputfile"
ffmpeg -nostdin -i "$inputfile" -c:a copy -c:v copy -movflags +faststart -tag:v hvc1 "$outputfile"
}
# Check if a directory was provided as an argument
if [[ -d $1 ]]; then
directory="$1"
# If a directory was provided, process all .mkv files in that directory
for file in "$directory"/*.mkv; do
convert_to_mov "$file"
done
else
# If a single file was provided, just process that file
convert_to_mov "$1"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment