LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 12-28-2010, 10:01 PM   #1
KickMeElmo
Member
 
Registered: Nov 2005
Location: Dayton, NV, USA
Distribution: Ubuntu 13.10
Posts: 47

Rep: Reputation: 1
Best way to extract AAC from mp4 losslessly


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.

File info:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Andrea .mp4':
Duration: 00:03:30.28, start: 0.000000, bitrate: 4157 kb/s
Stream #0.0(und): Video: h264, yuv420p, 1920x942 [PAR 1:1 DAR 320:157], 4024 kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc
Stream #0.1(und): Audio: aac, 44100 Hz, stereo, s16, 128 kb/s

Last edited by KickMeElmo; 12-28-2010 at 10:20 PM. Reason: Added to the edit section, new info.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 12-29-2010, 01:16 AM   #2
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,652
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
this seems to cover it...

http://www.linuxquestions.org/questi...format-834464/

Hope this helps, Glenn
 
Old 12-29-2010, 01:54 AM   #3
KickMeElmo
Member
 
Registered: Nov 2005
Location: Dayton, NV, USA
Distribution: Ubuntu 13.10
Posts: 47

Original Poster
Rep: Reputation: 1
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.
 
Old 12-29-2010, 03:31 AM   #4
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,652
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
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. :-)
 
Old 02-05-2011, 02:43 PM   #5
direx
LQ Newbie
 
Registered: Feb 2011
Posts: 1

Rep: Reputation: 0
Have you found a solution for this yet?

I am trying to accomplish the same thing and this is how I am doing it (pretty dirty, but it works):
  1. Install mkvtoolnix
  2. Launch mkvmerge GUI
  3. Add your MP4 file and start muxing it into a MKV file (this is lossless!)
  4. Open a shell and use mkvextract to extract only the audio track from the MKV. I use this command:
    Code:
    mkvextract tracks "mkv-file.mkv" 1:audio.aac

If anyone has a cleaner solution please let us know!
 
Old 02-05-2011, 03:47 PM   #6
KickMeElmo
Member
 
Registered: Nov 2005
Location: Dayton, NV, USA
Distribution: Ubuntu 13.10
Posts: 47

Original Poster
Rep: Reputation: 1
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.
 
Old 02-06-2011, 03:22 AM   #7
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
I agree with mkvextract, that's the way I always do it.

You can also extract it as is with ffmpeg:
Code:
ffmpeg -i input.mp4 -acodec copy output.aac
 
2 members found this post helpful.
Old 02-06-2011, 06:44 AM   #8
KickMeElmo
Member
 
Registered: Nov 2005
Location: Dayton, NV, USA
Distribution: Ubuntu 13.10
Posts: 47

Original Poster
Rep: Reputation: 1
Bingo. That syntax for ffmpeg is the mythical one I couldn't manage to piece together. Just tested and it worked like a charm.
 
1 members found this post helpful.
Old 01-01-2013, 02:41 PM   #9
ThurnerRupert
LQ Newbie
 
Registered: Jan 2013
Posts: 2

Rep: Reputation: Disabled
Quote:
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:
ffmpeg -i input.mp4 -acodec copy output.aac
the one which works similar, but much quicker:
Code:
avconv -i input.mp4 -acodec copy output.aac
 
Old 03-20-2013, 04:27 PM   #10
berain
LQ Newbie
 
Registered: Mar 2013
Posts: 1

Rep: Reputation: Disabled
Quote:
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
 
Old 03-22-2014, 12:10 PM   #11
turtlepurple
LQ Newbie
 
Registered: Mar 2014
Posts: 1

Rep: Reputation: Disabled
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

Greets
 
  


Reply

Tags
aac, audio, encode, extract, mp4


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Audacious won't play AAC AAC+, & no system sounds KDE 4.4.3 netcrawl Slackware 4 11-09-2014 09:22 PM
Problem AAC while encoding mp4 for my PSP J_angel2000 Linux - General 4 04-29-2007 02:40 AM
aac/m4a support for JUK / decent aac music players reformedgeek Linux - Newbie 1 04-23-2005 02:52 PM
Anyone know how to rip CD's to Tagged m4a, AAC, mp4 files? carl0ski Linux - Software 2 04-17-2005 04:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration