-
-
Save klappradla/04c41d559f71bcc9527e to your computer and use it in GitHub Desktop.
# Convert .flac to .mp3 (lossless) | |
for f in *.flac; do ffmpeg -i "$f" -aq 1 "${f%flac}mp3"; done | |
# Convert .flac to .mp3, compress to ~ 120k | |
for f in *.flac; do ffmpeg -i "$f" -aq 5 "${f%flac}mp3"; done | |
# Convert .flac to mp3, compress to ~ 128k | |
for f in *.flac; do ffmpeg -i "$f" -b:a 128k "${f%flac}mp3"; done | |
# Convert .flac to mp3, compress to variable 190k | |
for f in *.flac; do ffmpeg -i "$f" -aq 2 "${f%flac}mp3"; done | |
# Compress .mp3 files with lame to constant 128k | |
for i in *.mp3; do lame --preset 128 "$i" "${i}.mp3"; done | |
# Compress .mp3 to variable 190k (constant quality) | |
for i in *.mp3; do lame -V2 "$i"; done | |
# Compress .mp3 to variable 190k bitrate and replace files | |
for i in *.mp3; do lame -V2 "$i" tmp && mv tmp "$i"; done |
This is very nice, but how do you ensure that you do not inflate the bitrate? I have found a few flac files with very low bit rates (why, I do not know) but it would be useful to ensure that it only do a conversion if the flac bitrate is higher than target bitrate.
Is that possible?
you should add the -nostdin
option and either -n
or -y
to all the ffmpeg calls
I've been looking for something like this. thanks!
Amazing!!11
This is really great, and thank you. It works fine in a Mac shell, but I'd like to run it from a Perl script. When I do it seems to hang and the perl script does not continue. Ideas / suggestions?
Hm, I don't think I can help you there @trudge42 😞 I put these snippets down at what feel like ages ago because I needed to convert something... I'm not familiar with the details in there plus I don't know the Perl language 🤷♂️
But maybe share you're approach and someone else may be able to chime in?
This worked perfect, thanks so much for this!