Added wav2mp3 script

This commit is contained in:
Johannes Olzem 2024-03-02 20:10:41 +01:00
parent 15891a27d5
commit ca32437f6d
Signed by: jolzem
GPG Key ID: DB5485828E95A447

15
scripts/wav2mp3 Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
# Check if any arguments are given
[ "$#" -eq 0 ] && echo "No input file given" && exit 1
# Check if input file is wav
file "$1" | grep -q 'WAV' || { echo "Wrong input file given"; exit 1; }
# Use input file name as output file name
[ "$#" -eq 1 ] && OUTPUT="$(echo $1 | sed 's/\.wav$/.mp3/')"
# Use second argument as output file name
[ "$#" -eq 2 ] && OUTPUT="$2"
ffmpeg -i $1 -vn -ar 44100 -ac 2 -b:a 192k -f mp3 $OUTPUT