LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 08-08-2009, 11:37 AM   #1
adityavpratap
Member
 
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 429

Rep: Reputation: 32
unable to extract audio from .flv


Hi,

Well, I don't know if this falls within the purview of this forum. However here it is -

I have downloaded a video from youtube which is saved as a .flv file. I am trying to extract the soundtrack as follows -

$ mplayer -dumpaudio infile.flv -dumpfile infile.mp3

However, the dumpfile doesn't seem to be an mp3 file as is evident from the output of -

$ file infile.mp3

which gives -

infile.mp3: \012- Assembler source

and this doesn't play in mplayer or any other audio player.

How can I set right this? Awaiting your valuable suggestions,
 
Old 08-08-2009, 01:54 PM   #2
disturbed1
Senior Member
 
Registered: Mar 2005
Location: USA
Distribution: Slackware
Posts: 1,133
Blog Entries: 6

Rep: Reputation: 212Reputation: 212Reputation: 212
Is it really an mp3 file? Use mplayer -identify file.flv to check. Does mplayer play the flv file on its own?

Try -
mplayer -vo null -vc null -ao pcm:fast:file=audio.wav file.flv
This doesn't dump the stream, but decodes it to pcm wav file.
 
Old 08-08-2009, 02:25 PM   #3
vanstra
Member
 
Registered: Mar 2005
Distribution: Ubuntu 10.04 - CentOS 5.4
Posts: 40

Rep: Reputation: 15
I use the following 'flash2avi' script:

!#/bin/sh

if [ -z "$1" ]; then
echo "Usage: $0 {-divx|-xvid} list_of_flv_files"
exit 1
fi

# video encoding bit rate
V_BITRATE=1000

while [ "$1" ]; do
case "$1" in
-divx)
MENC_OPTS="-ovc lavc -lavcopts vcodec=mpeg4:vbitrate=$V_BITRATE:mbd=2:v4mv:autoaspect"
;;
-xvid)
MENC_OPTS="-ovc xvid -xvidencopts bitrate=$V_BITRATE:autoaspect"
;;
*)
if file "$1" | grep -q "Macromedia Flash Video"; then
mencoder "$1" $MENC_OPTS -vf pp=lb -oac mp3lame -lameopts fastreset=standard -o "`basename $1 .flv`.avi"
else
echo "$1 is not Flash Video. Skipping"
fi
;;
esac
shift
done
 
Old 08-08-2009, 04:10 PM   #4
justwantin
Member
 
Registered: Aug 2003
Location: Melbourne, Australia
Distribution: Slackware, Slackware ARM, Salix and Porteus
Posts: 551

Rep: Reputation: 43
Nice little script!
 
Old 08-08-2009, 11:24 PM   #5
adityavpratap
Member
 
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 429

Original Poster
Rep: Reputation: 32
Question

Hi,

Thanks for the prompt reply!

Quote:
$ mplayer -identify infile.flv
gives the following output -

Quote:
libavformat file format detected.
[flv @ 0x8e5da80]skipping flv packet: type 18, size 294, flags 0
ID_VIDEO_ID=0
[lavf] Video stream found, -vid 0
ID_AUDIO_ID=1
[lavf] Audio stream found, -aid 1
VIDEO: [H264] 208x142 0bpp 15.000 fps 0.0 kbps ( 0.0 kbyte/s)
ID_FILENAME=infile.flv
ID_DEMUXER=lavfpref
ID_VIDEO_FORMAT=H264
ID_VIDEO_BITRATE=0
ID_VIDEO_WIDTH=208
ID_VIDEO_HEIGHT=142
ID_VIDEO_FPS=15.000
ID_VIDEO_ASPECT=1.4648
ID_AUDIO_FORMAT=255
ID_AUDIO_BITRATE=0
ID_AUDIO_RATE=22050
ID_AUDIO_NCH=2
ID_LENGTH=214.69
ID_SEEKABLE=1
ID_CHAPTERS=0
and it plays the .flv file without any problem. However, the file audio.wav dumped by the following command,

Quote:
$ mplayer -vo null -vc null -ao pcm:fast:file=audio.wav infile.flv
is unplayable by mplayer. When I try to play the .wav file, I can only hear a short burst of sound as though the whole file has been played in a fraction of a second with the following output
Quote:
MPlayer UNKNOWN-4.2.4 (C) 2000-2009 MPlayer Team

Playing audio.wav.
Audio only file format detected.
==========================================================================
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 44100 Hz, 2 ch, s16le, 1411.2 kbit/100.00% (ratio: 176400->176400)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
==========================================================================
AO: [oss] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A: 0.0 (00.0) of 0.4 (00.3) ??,?%

Exiting... (End of file)
The script flash2avi outputs the following message -

Quote:
MEncoder UNKNOWN-4.2.4 (C) 2000-2009 MPlayer Team
Option lameopts: Unknown suboption fastreset
Error parsing option on the command line: -lameopts

Exiting... (error parsing command line)

Last edited by adityavpratap; 08-08-2009 at 11:29 PM. Reason: to add more information
 
Old 08-08-2009, 11:31 PM   #6
adityavpratap
Member
 
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 429

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by vanstra View Post
I use the following 'flash2avi' script:

!#/bin/sh
should this be -

Quote:
#!/bin/sh
 
Old 08-09-2009, 12:14 AM   #7
disturbed1
Senior Member
 
Registered: Mar 2005
Location: USA
Distribution: Slackware
Posts: 1,133
Blog Entries: 6

Rep: Reputation: 212Reputation: 212Reputation: 212
The script posted above wasn't wrapped in code tags and had bbcode enabled.

It should read -
Code:
mencoder "$1" $MENC_OPTS -vf pp=lb -oac mp3lame -lameopts fast:preset=standard -o "`basename $1 .flv`.avi"
AUDIO_FORMAT=255 I believe is aac audio. According to http://www2.mplayerhq.hu/DOCS/codecs-status.html#ac you need either libfaad2 or ffmpeg with aac support.
http://slackbuilds.org/repository/12.2/audio/faad2/

I find it quite strange that mplayer can play the original flv file with sound, but can not do a simple dump. As using dumpaudio, and -ao pcm:fast:file=audio.wav is actually no different than playing the file back. Playing the file back it has to be decoded, dumpaudio demuxes without decoding, -ao pcm:$ dumps the decoded stream. If mplayer can play the file, it should be able to dump it.
 
Old 08-09-2009, 12:57 AM   #8
vdemuth
Member
 
Registered: Oct 2003
Location: West Midlands, UK
Distribution: Slackware 14 (Server),Suse 13.1 (Desktop),, Mepis on the wifes lappy
Posts: 764

Rep: Reputation: 92
Why not just grab video downloader helper for FF from this link -> https://addons.mozilla.org/en-US/firefox/addon/3006 This will download and convert files from youtube with a couple of mouse clicks

Last edited by vdemuth; 08-09-2009 at 12:58 AM.
 
Old 08-09-2009, 01:34 AM   #9
chuckie
LQ Newbie
 
Registered: Jul 2009
Location: Blm. IL. USA
Distribution: slackware
Posts: 13

Rep: Reputation: 0
from MPlayer.SlackBuild

"The Slackware package is built with "USE_PATENTS=NO" i.e. without using
the lame mp3, faac, AMR and dvdcss libraries."
 
Old 08-09-2009, 01:56 AM   #10
rkirk
LQ Newbie
 
Registered: Apr 2009
Posts: 26

Rep: Reputation: 23
Maybe you could use this:
Code:
$ ffmpeg -i infile.flv outfile.wav
That would seem the simplest way unless you want to use mplayer for a specific reason (I've never done this with mplayer, but I use ffmpeg all the time).
 
Old 08-09-2009, 02:18 AM   #11
Ilgar
Member
 
Registered: Jan 2005
Location: Istanbul, Turkey
Distribution: Slackware 14.1, Slackware64 14.1
Posts: 917

Rep: Reputation: 87
When the old -dumpaudio failed to work for the .mp4 files, I started using the following script to extract their audio; it seems to work for .flv files as well:

Code:
mplayer -quiet $1 -ao pcm:fast:file=$2  -vc dummy -vo null -channels 2
Here $1 is the .flv file and $2 is the output filename.
 
Old 08-09-2009, 05:53 AM   #12
adityavpratap
Member
 
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 429

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by Ilgar View Post
When the old -dumpaudio failed to work for the .mp4 files, I started using the following script to extract their audio; it seems to work for .flv files as well:

Code:
mplayer -quiet $1 -ao pcm:fast:file=$2  -vc dummy -vo null -channels 2
Here $1 is the .flv file and $2 is the output filename.

Ok! Now this command works and I am getting mplayer-playable .mp3 files. That's a major achievement. Thanks Ilgar!

However, I want to upload these mp3s to my Samsung Ultra Touch S8300 mobile. When I do this, and try to play them using the music player app in my mobile, I get the following message -

Quote:
File has incorrect data
Any suggestions?
 
Old 08-09-2009, 06:23 AM   #13
dwr1
Member
 
Registered: Aug 2009
Distribution: slack-current
Posts: 46

Rep: Reputation: 17
I'm pretty sure mplayer outputs audio to raw pcm format. I've ripped audio from flv like that. I then use some mp3 encoder to turn it into an mp3.
 
Old 08-09-2009, 06:30 AM   #14
adityavpratap
Member
 
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 429

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by dwr1 View Post
I'm pretty sure mplayer outputs audio to raw pcm format. I've ripped audio from flv like that. I then use some mp3 encoder to turn it into an mp3.
Yes I think so,

Quote:
file infile.mp3
gives the following output -

Quote:
Ennenno.mp3: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz
 
Old 08-09-2009, 07:00 AM   #15
Ilgar
Member
 
Registered: Jan 2005
Location: Istanbul, Turkey
Distribution: Slackware 14.1, Slackware64 14.1
Posts: 917

Rep: Reputation: 87
Oops yes, I forgot to add, you'll get a wav file that way (as you'll notice from the file size).
 
  


Reply

Tags
ffmpeg, flv, mplayer


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
copy-mode extract of audio from youtube flv video moob8 Linux - Desktop 18 10-05-2013 08:44 AM
ffmpeg - flv Unsupported audio codec JavaNinja Linux - Software 15 06-02-2011 02:08 AM
Mplayer and flv files: audio trouble Changes Linux - Software 4 03-20-2009 07:32 PM
Converting flv to Mpg with Audio and ffmpeg btbx Linux - Software 7 06-12-2008 02:41 PM


All times are GMT -5. The time now is 04:18 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration