ALAC
27. 8. 2025Why ALAC and script ↓
Lossless audio compression in format that Premiere Pro can open directly:
ffmpeg -i song.wav -c:a alac song.alac.m4a
The usual toALAC script.
On a sample of 56 random songs ALAC compressed audio is 66.67% the size of original wavs.
Alt script with ‘jobs’ ↓
Instead of ‘jobcount’ counter variable, built-in ‘jobs’ shell command is used to control concurrency ‘logic’.
#!/bin/bash
# toALAC with concurrency
# 'jobs' version
# 2025, writen mostly by chatgpt
# usage: toALAC *.wav
if [ $# -eq 0 ]; then
echo "Usage: toALAC *.wav"
exit 1
fi
trap "echo -e '\nAborted by user.'; kill 0" INT
MAX_JOBS=4
# main loop
for f in "$@"; do
[ -f "$f" ] || continue
out="${f%.*}.alac.m4a"
echo "Encoding: $f -> $out"
ffmpeg -y -hide_banner -loglevel quiet -i "$f" -c:a alac "$out" &
# If we've hit the max, wait for one job to finish
(( $(jobs -p | wc -l) >= MAX_JOBS )) && wait -n
done
wait
echo "All encodes finished."
Speed ↓
Script makes 4 encodes at once, which seems to achive rougly the same speed as bumping that to 8, also using gnu parallel instead of plain bash logic will not speed up encoding on this particular testing machine.
Size and speed of ALAC vs FLAC ↓
FLAC default comes out as 61.11%. FLAC file-by-file encoding is much slower than ALAC, taking 2m45s to finish, compared to ALAC in 1m40s.
p.s. ffmpeg ALAC vs standalone FLAC tested.