Skip to content

Instantly share code, notes, and snippets.

@ILPlais
Last active August 19, 2025 00:53
Show Gist options
  • Select an option

  • Save ILPlais/f98069a3e3bf83741ae83d143a5858cb to your computer and use it in GitHub Desktop.

Select an option

Save ILPlais/f98069a3e3bf83741ae83d143a5858cb to your computer and use it in GitHub Desktop.
Convert all the FLAC files in MP3 using FFmpeg
#!/bin/bash
# Find all .flac files recursively
find . -name "*.flac" -type f | while IFS= read -r f; do
# Generates the name of the corresponding MP3 file
mp3_file="${f%.flac}.mp3"
# Check if the MP3 file already exists
if [[ ! -f "$mp3_file" ]]; then
echo "Conversion: $f -> $mp3_file"
ffmpeg -i "$f" -ID3v2_version 4 "$mp3_file"
eyeD3 -to-v1 "$mp3_file"
else
echo "File already exists, ignored: $mp3_file"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment