Convert all flac in directory on Synology to MP3 with specific output directory, VBR 220 - 260 kbps:
find . -name "*.flac" -exec bash -c 'D=$(dirname "{}"); B=$(basename "{}"); mkdir -p "/volume1/Download/MP3/$D/"; ffmpeg7 -hide_banner -n -i "{}" -sample_fmt s16p -ar 44100 -c:v copy -q:a 0 -map_metadata 0 -id3v2_version 3 "/volume1/Download/MP3/$D/${B%.*}.mp3" 2>> /volume1/Download/flac2mp3.txt' \;
LAME Bitrate Overview | |||
---|---|---|---|
lame option |
Average kbit/s | Bitrate range kbit/s | ffmpeg option |
-b 320 |
320 | 320 CBR (non VBR) example | -b:a 320k (NB this is 32KB/s, or its max) |
-V 0 |
245 | 220-260 | -q:a 0 (NB this is VBR from 220 to 260 KB/s) |
-V 1 |
225 | 190-250 | -q:a 1 |
-V 2 |
190 | 170-210 | -q:a 2 |
-V 3 |
175 | 150-195 | -q:a 3 |
-V 4 |
165 | 140-185 | -q:a 4 |
-V 5 |
130 | 120-150 | -q:a 5 |
-V 6 |
115 | 100-130 | -q:a 6 |
-V 7 |
100 | 80-120 | -q:a 7 |
-V 8 |
85 | 70-105 | -q:a 8 |
-V 9 |
65 | 45-85 | -q:a 9 |
Convert all wav in directory to MP3 VBR 190-250 kbps:
for f in *.wav; do ffmpeg -i "$f" -acodec libmp3lame -vn -ar 44100 -ac 2 -q:a 1 "${f%.*}.mp3"; done
Convert wav to FLAC:
ffmpeg -i $SOURCE -q:a flac -compression_level 2 $OUT.flac
Insert ID3 Tag metadata with cover image to MP3:
for f in *.mp3; do ffmpeg -y -i "$f" -i cover.jpg -map 0:0 -map 1:0 -c copy -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" -metadata title="${f%.*}" -metadata album="Albumi" -metadata artist="Artists" -metadata genre="Audiobook" -metadata date="2008" -metadata publisher="Publisher" "output/${f%.*}.mp3"; done
Read all metadata from MP3 file:
ffmpeg -i file.mp3 -f ffmetadata