flac2mp3 & m4a2mp3

Submitted scripts and programs
Forum rules
Your own work only.
User avatar
GekkoP
Emacs Sancho Panza
Posts: 5878
Joined: Tue Sep 03, 2013 7:05 am

flac2mp3 & m4a2mp3

Unread post by GekkoP » Thu May 22, 2014 9:01 pm

I like having all my music collection in mp3 format, otherwise some mp3 readers complain. So these two scripts come in handy when I put my hands on flac/m4a records. First one is not mine, but I don't remember where it comes from. Dependencies, IIRC: ffmpeg, libavcodec-extra-53

flac2mp3

Code: Select all

#!/bin/bash
# flac2mp3: convert flac files in the working directory to mp3 320kbps

for FILE in *.flac ; do
    ffmpeg -i "$FILE" -f mp3 -ab 320000 "`basename "$FILE" .flac`.mp3" || break;
done
m4a2mp3

Code: Select all

#!/bin/bash
# m4a2mp3: convert m4a files in the working directory to mp3 320kbps
for FILE in *.m4a ; do
    ffmpeg -i "$FILE" -f mp3 -ab 320000 "`basename "$FILE" .m4a`.mp3" || break;
done
I know they could probably be made into one script offering the format selection, but I'm lazy and I needed something quick and dirty.

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: flac2mp3 & m4a2mp3

Unread post by dkeg » Thu May 22, 2014 9:29 pm

nice GP! I have one too to add to this. Like you, don't remember where I picked it up. I should do better noting these things to give props to the right person. Anyway, I found this in necessity to convert all my files. It worked great. I have it in my github/scripts. Listed as convert3.sh

Work hard; Complain less

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: flac2mp3 & m4a2mp3

Unread post by rhowaldt » Fri May 23, 2014 8:56 am

cool gekko, thanks!
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

Post Reply