Skip to content

Instantly share code, notes, and snippets.

@virtuosonic
Created May 29, 2025 18:01
Show Gist options
  • Save virtuosonic/50cc54995eae07e22facbe6bd995df75 to your computer and use it in GitHub Desktop.
Save virtuosonic/50cc54995eae07e22facbe6bd995df75 to your computer and use it in GitHub Desktop.
compress video with ffmpeg
#!/bin/sh
# check $1 and $2
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: $0 <input_file> <output_file>"
exit 1
fi
# check if $1 is a file
if [ ! -f "$1" ]; then
echo "Error: $1 is not a file"
exit 1
fi
ffmpeg -i $1 -c:v libx264 -crf 18 -preset veryslow -c:a copy $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment