Skip to content

Instantly share code, notes, and snippets.

@pedrohdz
Created June 26, 2021 14:36
Show Gist options
  • Save pedrohdz/5134a8aac6746336c1a6238c858c1ad3 to your computer and use it in GitHub Desktop.
Save pedrohdz/5134a8aac6746336c1a6238c858c1ad3 to your computer and use it in GitHub Desktop.
Replace FLAC with ALAC version while preserving metadata and cover art
#! /usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
while IFS= read -r -d '' source; do
echo
echo ===============================================================================
path=$(dirname "$source")
target=$path/$(basename "$source" ".flac").m4a
echo Input: $source
echo Output: $target
ffmpeg -y -nostdin -i "$source" -vcodec copy -acodec alac "$target"
rm -v "$source"
done < <(find . -type f -name '*.flac' -print0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment