Skip to content

Instantly share code, notes, and snippets.

@joshua-koehler
Created February 7, 2025 16:45
Show Gist options
  • Select an option

  • Save joshua-koehler/22aae69254a0472496ade5e41175cbc1 to your computer and use it in GitHub Desktop.

Select an option

Save joshua-koehler/22aae69254a0472496ade5e41175cbc1 to your computer and use it in GitHub Desktop.
Compress mp3 file
#!/bin/bash
bitrate=36
if [[ -n $2 ]]
then
bitrate=$2
fi
inputfilename="$1"
outputfilename="${inputfilename%.mp3}.bitrate${bitrate}.mp3"
echo "Compressing into $outputfilename"
ffmpeg -i $inputfilename -b:a ${bitrate}k -ac 1 $outputfilename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment