[SOLVED] Best way to extract AAC from mp4 losslessly
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Subject says it all. I have an mp4 file I'd like to get the audio out of (details below if you want to know), and every method I've seen suggested either produces a junk file, re-encodes it with loss in quality (noticeable), or re-encodes it at 64kbps (which is disgusting for music, frankly). Not looking for anything more than an audio rip. Tips, anyone?
EDIT:
Just obtained Avidemux and am attempting with it. Have a feeling it's doable, but frankly, I've never used the program and have no clue how to work it. If that'd do it, tips there would work too! And now for a second edit, after looking into it, seems in the newer versions of avidemux, that feature is broken. Ah well.
Not quite, unfortunately. Worth note is that I'm not trying to produce a flac, which produces a 22.4MB file for 3.2MB of data. I'm just trying to get the AAC stream -out-, really. Already tried with ffmpeg (can produce an Mp3 at 64kbps, but can't produce a usable file of any other type, nor any other bitrate without attempting a lossy transcode) and mplayer (produces junk files). As mentioned above, I also attempted Avidemux, only to find out that feature is very nicely broken in the current release. I did try mencoder, but if there's a way to manage what I'm attempting using it, I have a feeling I'm approaching it from the wrong angle. All I managed with it was a wav, which suffered the same issue as the flac file did.
The quality of audio is already somewhat impaired in the file I'm working with, and any loss of quality from transcoding beyond the current state is -very- noticeable.
Thanks for the response though! I'm going to keep fiddling with these and see if I can come up with something that works, but if you or anyone else has any suggestions, please, feel free to share, I'm up for trying anything.
This is a new one to me, I have been looking in my local haunts and have only come up with a 2 step process.
And that would be to...
convert to .wav or .flac using avidemux or ffmpeg (or whatever)
change to the dir where the file is,
Code:
ffmpeg -i input.flv output.flac
or change the dir to where you want the output to go to and reference the input file with the url.(see relative and absolute addressing)
Code:
cd ~/build
ffmpeg -i ~/videos/input.flv output.flac
then, using audacity, import the file (wav or flac)
select all and export it as .m4a (which is mpeg4-aac, from what I can gather).
Quality?, as long as you convert up to wav or flac before converting to aac or mp3
I'd be surprised if you lost anymore detail.
49.3Mb .wav to 3.9Mb .m4a
My assumption is based on a quick check of audacity's import/export functions.
If you can try it you should see , you can change the file format at the bottom of the same window as export (type).
If you need/want to install audacity, install the lame package first, for mp3 support.
please try it, and ask here...
Regards Glenn
edit acc/aac typos
Last edited by GlennsPref; 12-29-2010 at 04:12 AM.
Reason: clarity, I should never say clarity here, but use spelling and gramma, so I don't embarras myself. :-)
Hmmm... step three doesn't transcode the audio at all? I hadn't ever considered that option. And no, I never really found a good, clean, working solution. I just ended up having to eat the loss of quality from the AAC>FLAC>AAC convert. Believe me, I'm still -very- interested in a solid solution.
Originally Posted by H_TeXMeX_H View Post
I agree with mkvextract, that's the way I always do it.
You can also extract it as is with ffmpeg:
Code:
Code:
ffmpeg -i input.mp4 -acodec copy output.aac
While I believe the above may work it will require processing of the video content which is unnecessary if you're only concerned with extracting the audio portion. This will result in long processing times. Consider adding "-vn" to disable video. This should result in much faster extractions. Demuxing by definition should not require any kind of transcoding so is I/O bound, not processor bound.
Code:
ffmpeg -i input.mp4 -vn -acodec copy output.aac
Last edited by berain; 04-01-2013 at 08:50 PM.
Reason: typo
Let me add a little detail here because aac-files wont play in some players and e.g. puddletag wont open them, but if you use mp4 or m4a as output here ffmpeg will still encode the video. So add -vn to strip the video.
ffmpeg -i input.mp4 -vn -acodec copy output.aac
or since ffmpeg will be replaced through avconv (I think avconv has a shorter syntax too)
avconc -i input.mp4 -vn -acodec copy output.aac
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.