Created
May 31, 2025 14:13
-
-
Save DevER-M/b9ea73926d1aef22ba6a38182fdf5bba to your computer and use it in GitHub Desktop.
flac to aac batch transcoder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| newdir="${PWD##*/}" | |
| mkdir -p "$newdir" | |
| process_file() { | |
| local i="$1" | |
| local out="$newdir/${i%.*}.m4a" | |
| ffmpeg -y -vn -i "$i" -c:a aac_at -q:a 3 -ar 48k "$out" # change your required quality here use fdk_aac or aac if audiotoolbox not supported | |
| if [[ -f cover.jpg ]]; then | |
| convert cover.jpg -resize 500x500 -strip -quality 70 compressed.jpg | |
| AtomicParsley "$out" --artwork compressed.jpg --overWrite >/dev/null | |
| fi | |
| echo "Finished: $i" | |
| } | |
| export -f process_file | |
| export newdir | |
| IFS=$'\n' | |
| find . -maxdepth 1 -name '*.flac' -print0 | parallel -0 -j 4 process_file # change the number threads here | |
| cp cover.jpg "$newdir/cover.jpg" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this needs atomic parsley,ffmpeg and gnu parallel