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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
12-28-2010, 10:01 PM
|
#1
|
Member
Registered: Nov 2005
Location: Dayton, NV, USA
Distribution: Ubuntu 13.10
Posts: 47
Rep:
|
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.
|
12-29-2010, 01:16 AM
|
#2
|
Senior Member
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,696
|
|
|
|
12-29-2010, 01:54 AM
|
#3
|
Member
Registered: Nov 2005
Location: Dayton, NV, USA
Distribution: Ubuntu 13.10
Posts: 47
Original Poster
Rep:
|
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.
|
|
|
12-29-2010, 03:31 AM
|
#4
|
Senior Member
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,696
|
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. :-)
|
|
|
02-05-2011, 02:43 PM
|
#5
|
LQ Newbie
Registered: Feb 2011
Posts: 1
Rep:
|
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):
- Install mkvtoolnix
- Launch mkvmerge GUI
- Add your MP4 file and start muxing it into a MKV file (this is lossless!)
- 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!
|
|
|
02-05-2011, 03:47 PM
|
#6
|
Member
Registered: Nov 2005
Location: Dayton, NV, USA
Distribution: Ubuntu 13.10
Posts: 47
Original Poster
Rep:
|
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.
|
|
|
02-06-2011, 03:22 AM
|
#7
|
LQ Guru
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
|
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.
|
02-06-2011, 06:44 AM
|
#8
|
Member
Registered: Nov 2005
Location: Dayton, NV, USA
Distribution: Ubuntu 13.10
Posts: 47
Original Poster
Rep:
|
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.
|
01-01-2013, 02:41 PM
|
#9
|
LQ Newbie
Registered: Jan 2013
Posts: 2
Rep: 
|
Quote:
Originally Posted by H_TeXMeX_H
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
|
|
|
03-20-2013, 04:27 PM
|
#10
|
LQ Newbie
Registered: Mar 2013
Posts: 1
Rep: 
|
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
|
|
|
03-22-2014, 12:10 PM
|
#11
|
LQ Newbie
Registered: Mar 2014
Posts: 1
Rep: 
|
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
|
|
|
All times are GMT -5. The time now is 09:09 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|