From d79688f50fca3711d181d2d671f4dc801e0922a2 Mon Sep 17 00:00:00 2001 From: fabian Date: Thu, 18 Jan 2024 15:51:11 +0100 Subject: [PATCH] new script for easier transcoding --- scripts/transcode_flac.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 scripts/transcode_flac.sh diff --git a/scripts/transcode_flac.sh b/scripts/transcode_flac.sh new file mode 100755 index 0000000..161499c --- /dev/null +++ b/scripts/transcode_flac.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -euo pipefail + +# evaluate options through given arguments +file_suffix='wav' +map= +while [[ $# > 0 ]]; do + case $1 in + -t | --type) file_suffix=$2; shift 2;; + -map ) map='-map 0:0'; shift;; + * ) break ;; # Anything else stops command line processing. + esac +done + +# ensure existence of destination folder +dir="$(pwd)" +dest=${dir%/*}/${dir##*/}_flac +if [[ !(-d $dest) ]]; then + mkdir "$dest" +fi + +for file in ./*.$file_suffix; do + echo "ffmpeg -i '$file' -c:a flac $map '$dest/${file%$file_suffix}flac'"; + ffmpeg -i "$file" -c:a flac $map "$dest/${file%$file_suffix}flac"; +done