Skip to content

Instantly share code, notes, and snippets.

@packerdl
Created January 1, 2022 15:50
Show Gist options
  • Save packerdl/91d55310ea59859452b40c0925e39abb to your computer and use it in GitHub Desktop.
Save packerdl/91d55310ea59859452b40c0925e39abb to your computer and use it in GitHub Desktop.
Calculate hash of FLAC audio stream with FFMPEG
#! /usr/bin/env bash
# This converts each flac file in a given folder into a raw PCM bit stream.
# The raw bit stream can be used to perform a metadata-agnostic comparison
# with other audio streams.
for file in *.flac; do
# -ar = sampling rate
# -ac = number of audio channels
# -f = sample format (s16le = 16bit, little-endian)
ffmpeg -i "$file" -loglevel error -ar 44100 -ac 2 -f s16le "$file.pcm"
md5sum "$file.pcm"
rm "$file.pcm"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment