Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Extracting audio from a file
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1741

PostPosted: Fri Jan 01, 2010 1:25 am    Post subject: Extracting audio from a file Reply with quote

I have a .flv (ugh) file that basically has nothing in it but audio (aac) and metadata. I would like to remove the useless stuff and have nothing but an audio file.

Mencoder apparently only works with mp3 and ac3 (according to the man page).

I also tried:
Code:

$ ffmpeg -vn -acodec copy -i file.flv file.aac


That produced:
Code:

[NULL @ 0x9c7cab0]error, non monotone timestamps 14415390 >= 14411250
av_interleaved_write_frame(): Error while opening file


And playing it gave me:
Code:

Unsupported LATM configuration: 4 programs/ 6 subframes, 4 layers, allstreams: 0

Unsupported LATM configuration: 11 programs/ 27 subframes, 3 layers, allstreams: 1

Unsupported LATM configuration: 4 programs/ 3 subframes, 4 layers, allstreams: 1


Any way of fixing this or getting it to work. The only requirement is that I don't want to convert or recompress it in a way that loses quality.
Back to top
View user's profile Send private message
Ken69267
Developer
Developer


Joined: 08 Apr 2007
Posts: 111
Location: #gentoo-pr0n

PostPosted: Fri Jan 01, 2010 2:20 am    Post subject: Reply with quote

Perhaps this?

Code:
mplayer -quiet -vc dummy -vo null -ao pcm:waveheader:file="audiodump.wav" foo.flv

_________________
!snack
Back to top
View user's profile Send private message
salahx
Guru
Guru


Joined: 12 Mar 2005
Posts: 530

PostPosted: Fri Jan 01, 2010 8:20 am    Post subject: Reply with quote

I've run into the before (with DVD). Many players cannot handle raw AAC frames (previous version of mplayer had problem with this but the current version seems to do just fine).

You might have better luck if you wrap it into something:
Code:
ffmpeg -vn -acodec copy -f aac -i file.flv file.m4a


This will (loselessly) put the resulting AAC file in an appropriate container (the same one iTunes uses).
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1741

PostPosted: Fri Jan 01, 2010 9:39 am    Post subject: Reply with quote

Ken69267 wrote:
Perhaps this?

Code:
mplayer -quiet -vc dummy -vo null -ao pcm:waveheader:file="audiodump.wav" foo.flv


Going back to pcm is an absolute no-no for me (it would require reencoding resulting in a quality loss). I already have a good aac encoding in the flv file. I want to use that.

salahx wrote:
I've run into the before (with DVD). Many players cannot handle raw AAC frames (previous version of mplayer had problem with this but the current version seems to do just fine).


It didn't handle this. The mplayer -dumpaudio command produces absolutely no headers for aac, so (for example) the "file" command can't identify it ("data"), and mplayer has absolutely no idea what it is (I did see that the raw data matched the original file, though).

salahx wrote:
You might have better luck if you wrap it into something:
Code:
ffmpeg -vn -acodec copy -f aac -i file.flv file.m4a


This will (loselessly) put the resulting AAC file in an appropriate container (the same one iTunes uses).


That didn't work (although it certainly didn't destroy any data :) ).

I actually looked inside the file before I tried to play it, but let me show you what happened when I tried to play it first:

Code:

$ mplayer file.m4a
MPlayer SVN-r29463-4.3.2 (C) 2000-2009 MPlayer Team
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick

Playing file.m4a.
libavformat file format detected.
[lavf] Audio stream found, -aid 0
==========================================================================
Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding)

Unsupported LATM configuration: 4 programs/ 6 subframes, 4 layers, allstreams: 0

Unsupported LATM configuration: 11 programs/ 27 subframes, 3 layers, allstreams: 1
FAAD: compressed input bitrate missing, assuming 128kbit/s!
AUDIO: 32000 Hz, 2 ch, s16le, 128.0 kbit/12.50% (ratio: 16000->128000)
Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
FAAD: error: Channel coupling not yet implemented, trying to resync!
FAAD: error: Channel coupling not yet implemented, trying to resync!
FAAD: error: Channel coupling not yet implemented, trying to resync!
FAAD: error: Gain control not yet implemented, trying to resync!
FAAD: error: Gain control not yet implemented, trying to resync!
FAAD: error: Gain control not yet implemented, trying to resync!
FAAD: error: Quantised value out of range, trying to resync!
FAAD: error: Gain control not yet implemented, trying to resync!
FAAD: error: Maximum number of scalefactor bands exceeded, trying to resync!
FAAD: error: Scalefactor out of range, trying to resync!
FAAD: Failed to decode frame: Scalefactor out of range
A:   0.6 (00.5) of 236.2 (03:56.2) ??,?% ^MFAAD: error: Maximum number of scalefactor bands exceeded, trying to resync!
FAAD: error: Unexpected channel configuration change, trying to resync!
FAAD: error: Gain control not yet implemented, trying to resync!
FAAD: error: Channel coupling not yet implemented, trying to resync!
FAAD: error: Scalefactor out of range, trying to resync!
FAAD: error: Gain control not yet implemented, trying to resync!
FAAD: error: Unexpected channel configuration change, trying to resync!
FAAD: error: Scalefactor out of range, trying to resync!
FAAD: error: Maximum number of scalefactor bands exceeded, trying to resync!
FAAD: error: Gain control not yet implemented, trying to resync!
FAAD: Failed to decode frame: Gain control not yet implemented
FAAD: error: Unexpected channel configuration change, trying to resync!

[...]



What the command you suggested did was add forty bytes to the front of the .flv file, then copy the entire .flv file byte for byte, then add about 21k to the end of the .flv file. I was not surprised when mplayer could not play aac audio inside a flv container inside an m4a container.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Fri Jan 01, 2010 11:10 am    Post subject: Reply with quote

I've done something like this in past ... here's what I found in my notes.

First, I opened it in Avidemux and saved audio into audio.aac.
Second, I packed raw AAC audio into a container: $ faad -a audio.mpa audio.aac
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
salahx
Guru
Guru


Joined: 12 Mar 2005
Posts: 530

PostPosted: Sat Jan 02, 2010 10:34 pm    Post subject: Reply with quote

Actually I screwed up the command from before it should be:
Code:
ffmpeg -vn -acodec copy -i file.flv file.m4a

The -f aac should not have been there.
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1741

PostPosted: Sat Jan 02, 2010 11:17 pm    Post subject: Reply with quote

Jaglover wrote:
Second, I packed raw AAC audio into a container: $ faad -a audio.mpa audio.aac


I have the raw aac from mplayer. That command produced:
Code:

 *********** Ahead Software MPEG-4 AAC Decoder V2.7 ******************

 Build: Jul 24 2009
 Copyright 2002-2004: Ahead Software AG
 http://www.audiocoding.com
 Floating point version

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License.

 **************************************************************************

file.aac file info:
RAW

Error: Bitstream value not allowed by specification


salahx wrote:
Actually I screwed up the command from before it should be:


That produced the same result as my original ffmpeg command (except for a slightly larger output file due to container overhead). In both cases, ffmpeg processed about a third of the file before puking.

Code:

[NULL @ 0x90f8ab0]error, non monotone timestamps 3531771 >= 3530756
av_interleaved_write_frame(): Error while opening file


I have verified that the time stamps in the input file are indeed monotonic. Right now, I am inclined to do this myself (write my own converter).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum