From ca32437f6da7fdf69094658098a1b067e8c7f5a4 Mon Sep 17 00:00:00 2001 From: jolzem Date: Sat, 2 Mar 2024 20:10:41 +0100 Subject: [PATCH] Added wav2mp3 script --- scripts/wav2mp3 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 scripts/wav2mp3 diff --git a/scripts/wav2mp3 b/scripts/wav2mp3 new file mode 100755 index 0000000..b577771 --- /dev/null +++ b/scripts/wav2mp3 @@ -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