Last active
March 13, 2025 08:09
-
-
Save RAM92/e5c585312e92fb3133d7368399744b4e to your computer and use it in GitHub Desktop.
Script to convert flac files to 320kbps mp3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env nix-shell | |
#! nix-shell -i bash -p ffmpeg_5 | |
trap 'echo "Aborting..."; exit 1' SIGINT | |
find . -type f -name "*.flac" -print0 | while read -d $'\0' flac_file; do | |
echo "Input file: $flac_file" | |
mp3_file="${flac_file%.flac}.mp3" | |
ffmpeg -nostats -loglevel 0 -nostdin -i "$flac_file" -vn -b:a 320k -acodec libmp3lame "$mp3_file" || { rm "$mp3_file"; exit; }; | |
rm "$flac_file" | |
echo "Converted $mp3_file" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment