Howto convert audio files to *.m4a?
I'd stick with ffmpeg. You weren't far off. Here's what I've just used to convert a load of 50-meg flacs to 5-meg m4as, complete with metadata:
find -name "*.flac" -exec ffmpeg -ab 192k -i "{}" -map_meta_data "{}.m4a":"{}" "{}.m4a" \;
You could expand that to clean up the original files or save them somewhere else (I was actually struggling with that bit).
For some reason, mine was crawling along at 190kbits/s so there might be a better encoding string (I should hope there is, this is a bit silly).
Related videos on Youtube
Kervin Ramen
Updated on September 17, 2022Comments
-
Kervin Ramen over 1 year
I want to convert a lot of *.flac and some high bitrate *.mp3 files to *.m4a files. I want to use a fixed bitrate of 192kb (stereo) and want to keep the audiotags (except of, obviously, the tag "bitrate" - this sshould nbe set to the correct 192kb.).
I'm using 64-bit Maverick.
I tried about every program I could find.
Including
Sound Converter
soundKonverter (KDE)
WinFF
Arista Transcoder, Handbrake, Transmageddon (fails, seems only video works)
ffmpeg (tried "-acodec libfaac -ab 192k -map_meta_data outfile.m4a:infile.mp3")
But either they don't transfer the tags or they don't offer any way to set the bitrate to fixed 192kb or the resulting file doesn't show the new bitrate in any audio program (for example: nautilus saying "bitrate" n.a.")!
-
Olivia over 13 yearsWould you please edit your question to list the programs from the Ubuntu repository that you've tried? That would help us narrow which apps to suggest (and even assist in crafting a script).
-
Kervin Ramen over 13 yearsSry, you're right. I thought if anyone knows a working one we don't have to fiddle around with fixing my vain efforts ... but anyway: see above now. thx, p.
-
NightwishFan over 13 yearsNautilus might just not know how to read the bitrate using gstreamer.
-
Kervin Ramen over 13 years@Nightwishfan: Maybe, but Amarok, banshee or guayadeque show "bitrate n.a." also ...
-
NightwishFan over 13 yearsI think all of them potentially use gstreamer as a backend.
-
Kervin Ramen over 13 yearsgstreamer backend reads the bitrate perfectly on all other *.m4a files not encoded by myself.
-
djeikyb about 13 yearsJust out of curiousity...why on earth would you transcode mp3 to m4a? You'll lose quality (granted, may not be noticeable), and mp3 is more universal.
-
Kervin Ramen about 13 years@dkeikyb: sry I won't get into any discussion about my motivation. But: I never asked about mp3 to m4a. I ripped my cds in flac, I have some raw wavs, a few high quality mp3 (320kb, a bit too bloated considering file size) and some files in ape. 192kb m4a has good enough quality for our purposes, can be used by all our devices and don't worry, we won't transcode 128kb, 160kb or 192kb mp3 in 192kb m4a ...If you're really interested in why m4a (aac) might be superior to mp3 plz open a new thread. I guess you'll get a lot of lively discussion on that topic. cya
-
Praveen over 9 yearsIf you are ready to use the
.exe
application calledFormatFactory
your need will be simply satisfied. Either you should have installedwine
in ubuntu or you should have with you some OS which can install executable files.
-
Kervin Ramen over 13 yearshi Oli! thx for your line here. If you're struggling with cleaning up - you can use winff and add your line (well parts of your line) as custom profile, winFF is a gui for ffmpeg I guess. Funny thing still, all my *.m4a (aac) files from different sources show a bitrate whith every program reading the tags. The ones I convert myself don't, it seems like ffmpeg doesn't write the tag "bitrate" and the music library managment programs don't compute and add them. Cause I share my music with my girlfriends ipod, apple desktop and ps3 over lan streaming I'd rather have the bitrate info in correct.
-
Kervin Ramen over 13 yearsTo be precise: converting to other formats then aac ffmpeg writes a correct bitrate tag! (tested with mp3 ogg). It would be so nice if all devices could read ogg - I'd happily stick with that! Annoying ...
-
Kervin Ramen over 13 yearsChecking once more I found that nautilus shows the bitrate on different songs encoded with 192k *.m4a on other devices NOT by reading the "bitrate" tag - there is none set! So the gstreamer backend seems to be able to compute the bitrate showing values like "188k", "192k", "189k" - all around the 192k that programs claimed they encoded with.
-
Kervin Ramen over 13 yearshi Oli! If I open the encoded files (your line or my line) doesn't matter! with the program "mediainfo" it computes a bitrate of 152k! So by telling ffmpeg to encode with 192k it seems to result in 152k bitrate ... wtf is going on?
-
Kervin Ramen over 13 yearsI tried your suggestion of using "aacplusenc". Could you give me an example? I get an error trying to set the bitrate to 192 AND it seems to only support a sample rate of 22050 ... The second option looks more promising but doesn't recognize "libfaac" or "faac" and I didn't get any conversion done at all. Could you give an example?
-
NightwishFan over 13 yearsYes, to be honest it looks like the 64-bit build is flawed. I will try force installing the 32-bit to see if it is better. Edit: No dice, you would have to install 32-bit libs as well, and that just has too many potential downsides.
-
jmtd over 13 yearsfor multicore systems, try
find . -name "*.flac" -print0 |xargs -r0I {} -P 6 ffmpeg -ab 192k -i "{}" -map_meta_data "{}.m4a":"{}" "{}.m4a"
: the-P
argument is the number of concurrent jobs to run. -
jmtd over 13 years@piedro: what is the bitrate if you calculate by hand? take a long-ish track, divide the filesize by the length in seconds, convert from bytes to bits... the longer the better, as there will be some error due to the headers (especially if you have a lot of metadata)
-
Kervin Ramen about 13 yearsSry for the pause! Mediainfo tells me it's still 152 kbit rate. Calculate manually 9.3 MB file 8:25 min length resulting in a kbitrate of roughly 151 kbit. It's obviously faulty.