new script for easier transcoding
This commit is contained in:
parent
34baf7e029
commit
d79688f50f
25
scripts/transcode_flac.sh
Executable file
25
scripts/transcode_flac.sh
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user