Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Multimedia
  • Search

Extracting audio from a file

Help with creation, editing, or playback of sounds, images, or video. Amarok, audacious, mplayer, grip, cdparanoia and anything else that makes a sound or plays a video.
Post Reply
Advanced search
7 posts • Page 1 of 1
Author
Message
curmudgeon
Veteran
Veteran
Posts: 1746
Joined: Fri Aug 08, 2003 1:39 pm

Extracting audio from a file

  • Quote

Post by curmudgeon » Fri Jan 01, 2010 1:25 am

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: Select all

$ ffmpeg -vn -acodec copy -i file.flv file.aac
That produced:

Code: Select all

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

Code: Select all

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.
Top
Ken69267
Developer
Developer
User avatar
Posts: 111
Joined: Sun Apr 08, 2007 7:59 pm
Location: #gentoo-pr0n
Contact:
Contact Ken69267
Website

  • Quote

Post by Ken69267 » Fri Jan 01, 2010 2:20 am

Perhaps this?

Code: Select all

mplayer -quiet -vc dummy -vo null -ao pcm:waveheader:file="audiodump.wav" foo.flv
!snack
Top
salahx
Guru
Guru
Posts: 572
Joined: Sat Mar 12, 2005 6:39 am

  • Quote

Post by salahx » Fri Jan 01, 2010 8:20 am

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: Select all

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).
Top
curmudgeon
Veteran
Veteran
Posts: 1746
Joined: Fri Aug 08, 2003 1:39 pm

  • Quote

Post by curmudgeon » Fri Jan 01, 2010 9:39 am

Ken69267 wrote:Perhaps this?

Code: Select all

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: Select all

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: Select all

$ 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.
Top
Jaglover
Watchman
Watchman
User avatar
Posts: 8291
Joined: Sun May 29, 2005 1:57 am
Location: Saint Amant, Acadiana

  • Quote

Post by Jaglover » Fri Jan 01, 2010 11:10 am

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!
Top
salahx
Guru
Guru
Posts: 572
Joined: Sat Mar 12, 2005 6:39 am

  • Quote

Post by salahx » Sat Jan 02, 2010 10:34 pm

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

Code: Select all

ffmpeg -vn -acodec copy -i file.flv file.m4a
The -f aac should not have been there.
Top
curmudgeon
Veteran
Veteran
Posts: 1746
Joined: Fri Aug 08, 2003 1:39 pm

  • Quote

Post by curmudgeon » Sat Jan 02, 2010 11:17 pm

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: Select all

 *********** 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: Select all

[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).
Top
Post Reply

7 posts • Page 1 of 1

Return to “Multimedia”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic