Skip to content

Instantly share code, notes, and snippets.

@cubuspl42
Created September 1, 2023 08:11
Show Gist options
  • Save cubuspl42/7892d47b8153e9f40ab522ecce06fef8 to your computer and use it in GitHub Desktop.
Save cubuspl42/7892d47b8153e9f40ab522ecce06fef8 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Check if ffmpeg is installed
if ! command -v ffmpeg &> /dev/null
then
echo "ffmpeg could not be found. Please install it and try again."
exit 1
fi
# Check if a file path was provided
if [ -z "$1" ]
then
echo "Please provide a file path."
exit 1
fi
# Get the input file path and remove the extension to get the base name
input_file="$1"
base_name="${input_file%.*}"
# Run the ffmpeg command with the input file and output file
ffmpeg -i "$input_file" -q:v 0 -an "${base_name}.mp4"
echo "Conversion complete: ${base_name}.mp4"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment