You are not logged in.

#1 2008-03-29 13:21:42

sH
Member
From: Braunschweig, Germany
Registered: 2007-05-02
Posts: 145

Converting flac to mp3 on-the-fly?

Hi ,

as maybe many other people I have the problem, that my Rhythmbox and portable audio player is capable of playing flac, but my car stereo is not.
Is there any burning software, that is capable of converting flac to mp3 while burning without any additional steps? (k3b maybe?)

If not, what is the preferred tool to convert between different audio formats?

thanks in advance.

Last edited by sH (2008-03-29 13:22:16)

Offline

#2 2008-03-29 13:33:26

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: Converting flac to mp3 on-the-fly?

I don't know of any program that does that, but here is a script that I use to convert from flacs to mp3s:

#!/bin/sh
# from http://www.linuxtutorialblog.com/post/solution-converting-flac-to-mp3

OUT_DIR="./mp3"
[ ! -d ${OUT_DIR} ] && mkdir -p ${OUT_DIR}

# modify the lame options to your
# preference
lame_opts=" --vbr-new -V 2 -B 256 "

for x in "${@}"
do
FLAC=${x}
MP3=`basename "${FLAC%.flac}.mp3"`

[ -r "$FLAC" ] || { echo can not read file \"$FLAC\" >&1 ; exit 1 ; } ;

TITLE=""
TRACKNUMBER=""
GENRE=""
DATE=""
COMMENT=""
ARTIST=""
ALBUM=""
Title=""
Tracknumber=""
Genre=""
Date=""
Comment=""
Artist=""
Album=""

metaflac --no-utf8-convert --export-tags-to=- "$FLAC" | sed 's/=\(.*\)/="\1"/' > tmp.tmp

. ./tmp.tmp
rm tmp.tmp

[ -z "$TITLE" ] && TITLE="$Title"
[ -z "$TRACKNUMBER" ] && TRACKNUMBER="$Tracknumber"
[ -z "$GENRE" ] && GENRE="$Genre"
[ -z "$DATE" ] && DATE="$Date"
[ -z "$COMMENT" ] && COMMENT="$Comment"
[ -z "$ARTIST" ] && ARTIST="$Artist"
[ -z "$ALBUM" ] && ALBUM="$Album"

echo "Converting ${FLAC} to MP3 format"

flac -c -d "$FLAC" | lame ${lame_opts} - ${OUT_DIR}/"$MP3"

id3v2 \
-a "$ARTIST" \
-A "$ALBUM" \
-t "$TITLE" \
-c "$COMMENT" \
-g "$GENRE" \
-y "$DATE" \
-T "$TRACKNUMBER" \
${OUT_DIR}/"$MP3"

done

You should save is somewhere that's included in PATH and then run it from within a directory containing flac files as "flac2mp3.sh *.flac" -- depending on how you named the script file of course.  The script requires that flac, lame and id3v2 packages are installed.  It'll create an "mp3" direcory inside the directory with flac files and place the mp3 files there.  If you don't want the tags on the resulting mp3 files to have UTF-8 encoding remove "--no-utf8-convert" switch from the metaflac line.

Offline

#3 2008-03-29 14:03:02

kezar
Member
Registered: 2007-08-14
Posts: 61

Re: Converting flac to mp3 on-the-fly?

Grip does it.
Soundkonverter if you use KDE.

Offline

#4 2008-03-29 14:58:06

[vEX]
Member
From: Sweden
Registered: 2006-11-23
Posts: 450

Re: Converting flac to mp3 on-the-fly?

ffmpeg should be able to do it too:

ffmpeg -i Audio.flac Audio.mp3

Might want to throw in some switches telling it what bitrate to encode to and such, check the manpage for details.

As for converting while burning I have no idea. :-/

Last edited by [vEX] (2008-03-29 14:59:09)


PC: Antec P182B | Asus P8Z77-V PRO | Intel i5 3570k | 16GB DDR3 | GeForce 450GTS | 4TB HDD | Pioneer BDR-207D | Asus Xonar DX | Altec Lansing CS21 | Eizo EV2736W-BK | Arch Linux x86_64
HTPC: Antec NSK2480 | ASUS M3A78-EM (AMD 780G) | AMD Athlon X3 425 | 8GB DDR2 | GeForce G210 | 2TB HDD | Arch Linux x86_64
Server: Raspberry Pi (model B) | 512MB RAM | 750GB HDD | Arch Linux ARM

Offline

#5 2008-03-31 21:34:20

kezar
Member
Registered: 2007-08-14
Posts: 61

Re: Converting flac to mp3 on-the-fly?

gnormalize does it too (rip+encode+cddb+normalize)

Offline

#6 2008-04-02 03:05:12

bionnaki
Member
Registered: 2006-09-05
Posts: 289

Re: Converting flac to mp3 on-the-fly?

follow this wiki I wrote: http://wiki.archlinux.org/index.php/Convert_Flac_to_Mp3

very easy.

Offline

#7 2008-04-02 08:12:09

ezzetabi
Member
Registered: 2006-08-27
Posts: 947

Re: Converting flac to mp3 on-the-fly?

bionnaki, I do not know if advising copying the script in /usr/local/bin is a good idea. Archlinux usually does not use /usr/local .

everyone, why there is so much love for .mp3? Isn't vorbis (.ogg) better?

Offline

#8 2008-04-02 09:22:35

kezar
Member
Registered: 2007-08-14
Posts: 61

Re: Converting flac to mp3 on-the-fly?

Yep, vorbis is better and lighter. Maybe people use MP3 because it's well supported on usb players and because it is older.

Offline

#9 2008-04-02 09:28:08

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: Converting flac to mp3 on-the-fly?

OGG is also completely free of patent issues. OGG FTW!!

ezzetabi wrote:

bionnaki, I do not know if advising copying the script in /usr/local/bin is a good idea. Archlinux usually does not use /usr/local .

I think using /usr/local is suitable for this situation as the script is not part of a package. /usr/local is where you'd usually put stuff you've compiled yourself from source. The script isn't compiled as such, but /usr/local is there for a reason.

Last edited by dyscoria (2008-04-02 09:39:57)


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#10 2008-04-02 09:52:49

ezzetabi
Member
Registered: 2006-08-27
Posts: 947

Re: Converting flac to mp3 on-the-fly?

I think the Archway would be making a package. A such package is trivial to make and you'll have the file under the control of pacman system.

Or less intrusive, add a bin directory in $HOME and change the path for the used in .bashrc.

Offline

#11 2008-04-02 10:13:14

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: Converting flac to mp3 on-the-fly?

The Arch way is that you get to choose what to do.

Anyway, do you make a package for all your scripts? I have about 10 that I keep in ~/.scripts and manage with git. Creating a separate package for each one, or even all of them as one package with pacman would not be the simple way to do it or a good way to manage them (for me).

And I disagree with a bin in $HOME, as there is already a bin in /usr/local made for this purpose. And extra bin in the home folder would be messy and unneccessary.

But again, the arch way is that you get to choose what to do wink

Last edited by dyscoria (2008-04-02 10:13:38)


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#12 2008-04-02 10:48:50

schivmeister
Developer/TU
From: Singapore
Registered: 2007-05-17
Posts: 971
Website

Re: Converting flac to mp3 on-the-fly?

err..i think threadstarter knows that there are many ways to convert. he's asking whether there's any (GUI) app that can convert in the background and burn the processed ones. I'm not sure whether a for loop would be enough for threading, though.

/usr/local basically contains the stuff you do not want associated with the primary system components. You can place your custom scripts in /usr/local/bin and some not-so-well-compiled programs all around there in /usr/local/{lib,etc,include,man,src} whatever. I personally use it as testing ground, eg. make DESTDIR=/usr/local install smile

Last edited by schivmeister (2008-04-02 10:49:25)


I need real, proper pen and paper for this.

Offline

Board footer

Powered by FluxBB