2022-07-23 16:21:39 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
2023-02-20 19:13:25 +01:00
|
|
|
# evaluate options through given arguments
|
|
|
|
file_suffix=
|
|
|
|
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
|
2022-07-23 16:21:39 +02:00
|
|
|
done
|
|
|
|
|
2023-02-20 19:13:25 +01:00
|
|
|
# ensure existence of destination folder
|
|
|
|
dest=../transcode_m4a
|
|
|
|
if [[ !(-d $dest) ]]; then
|
|
|
|
mkdir $dest
|
|
|
|
fi
|
|
|
|
|
|
|
|
for file in ./*.$file_suffix; do
|
|
|
|
echo "ffmpeg -i '$file' -c:a libfdk_aac -profile:a aac_he -b:a 64k $map -movflags +faststart '$dest/${file%$file_suffix}m4a'";
|
|
|
|
ffmpeg -i "$file" -c:a libfdk_aac -profile:a aac_he -b:a 64k $map -movflags +faststart "$dest/${file%$file_suffix}m4a";
|
|
|
|
done
|