FFmpeg and Chromaprint
The API uses FFmpeg for two things:
- Encoding uploaded tracks and stems (
ProcessAudiojob, settings underencodinginconfig/settings.php). - Copied-audio detection. The
FingerprintTrackjob reads Chromaprint codes through FFmpeg'schromaprintmuxer and flags tracks that match another owner's earlier track. See Moderation.
Encoding uses libfdk_aac unless AUDIO_ENCODING_CODEC says otherwise. Fingerprints need an FFmpeg built with Chromaprint. Without it, uploads still work and only file hashes are compared, so re-encoded copies are not caught.
Check your build
ffmpeg -hide_banner -muxers | grep chromaprint
# E chromaprint ChromaprintNo output means your FFmpeg has no Chromaprint.
Install
Ubuntu and Debian
The distribution package includes Chromaprint, but not libfdk_aac, so tell the API to use FFmpeg's own AAC encoder:
sudo apt-get install ffmpegAUDIO_ENCODING_CODEC=aacmacOS
Homebrew's core ffmpeg formula may not include Chromaprint. The homebrew-ffmpeg tap lets you add it:
brew tap homebrew-ffmpeg/ffmpeg
brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-chromaprint --with-fdk-aacBuilding from source
Pass --enable-chromaprint (and install libchromaprint-dev). The ffmpeg-build-script is an easy way to get a static build with libfdk-aac.
Point the API at it
When ffmpeg and ffprobe are not on the PATH of the PHP and queue processes, set their paths:
FFMPEG_BINARIES=/usr/local/bin/ffmpeg
FFPROBE_BINARIES=/usr/local/bin/ffprobe
# Optional, defaults to the system temp folder
FFMPEG_TEMPORARY_FILES_ROOT=/var/tmp/ffmpeg
# Empty uses libfdk_aac. Set aac when your FFmpeg has no libfdk_aac.
AUDIO_ENCODING_CODEC=The check is cached
The API caches whether Chromaprint is available, forever. After installing or changing FFmpeg, clear it and restart the queue worker:
php artisan cache:forget audio::chromaprint
php artisan queue:restart