Skip to content

Instantly share code, notes, and snippets.

@markov00
Last active June 6, 2024 13:48
Show Gist options
  • Save markov00/6a3d4744d18b2035f0be5eaf9130e349 to your computer and use it in GitHub Desktop.
Save markov00/6a3d4744d18b2035f0be5eaf9130e349 to your computer and use it in GitHub Desktop.
Convert new .mov screen recorded videos to mp4, use with macOS Automator
# Use this with macOS Automator
# Create a "Run shell script" action and specify the folder where your screenshot and screen videos are stored
# Add this script and save it
export PATH=/opt/homebrew/bin:$PATH
send_notification() {
local title="$1"
local message="$2"
osascript -e "display notification \"$message\" with title \"$title\""
}
for input_file in "$@"; do
if [[ "$input_file" != *.mov ]]; then
continue
fi
if [ ! -f "$input_file" ]; then
send_notification "Conversion Script" "File not found: $input_file"
continue
fi
output_file="${input_file%.mov}.mp4"
# ffmpeg -i "$input_file" "$output_file" > "ffmpeg.log" 2>&1
ffmpeg -i "$input_file" "$output_file"
if [ $? -eq 0 ]; then
send_notification "Conversion Successful" "File converted: $output_file"
else
send_notification "Conversion Failed" "Failed to convert $input_file. Check log: $log_file"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment