ver.90c7dbb
Tags: tech music software

Audio File Conversion

Scripts I put together when converting FLACs to ALACs (.m4a files). As with anything media file related these use the venerable ffmpeg.

FLAC => ALAC conversion

ffmpeg -i myFlacFile.flac -c:a alac -c:v copy myAlacFile.m4a

Bulk conversion

Following bash script converts all .flacs in the current directory to .alac, creating an .alac copy of each .flac in the current directory:

#! /bin/bash

for filename in *.flac; do
	filenameNoExt=${filename%.*}
	ffmpeg -i "$filename" -c:a alac -c:v copy "$filenameNoExt".m4a
done

Adding album art to FLACs

Following bash script will add album art to all FLACs in the current directory using metaflac. Album art must be in the same directory and named "cover.jpg":

#! /bin/bash

for file in *.flac; do
	echo $file
	metaflac --import-picture-from="./cover.jpg" "$file"
done