Slackware This Forum is for the discussion of Slackware Linux.
|
| 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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
08-08-2009, 11:37 AM
|
#1
|
|
Member
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 426
Rep:
|
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,
|
|
|
|
08-08-2009, 01:54 PM
|
#2
|
|
Senior Member
Registered: Mar 2005
Location: USA
Distribution: Slackware
Posts: 1,133
|
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.
|
|
|
|
08-08-2009, 02:25 PM
|
#3
|
|
Member
Registered: Mar 2005
Distribution: Ubuntu 10.04 - CentOS 5.4
Posts: 40
Rep:
|
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 fast  reset=standard -o "`basename $1 .flv`.avi"
else
echo "$1 is not Flash Video. Skipping"
fi
;;
esac
shift
done
|
|
|
|
08-08-2009, 04:10 PM
|
#4
|
|
Member
Registered: Aug 2003
Location: Melbourne, Australia
Distribution: Slackware, Salix and Porteus
Posts: 529
Rep:
|
Nice little script!
|
|
|
|
08-08-2009, 11:24 PM
|
#5
|
|
Member
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 426
Original Poster
Rep:
|
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
|
|
|
|
08-08-2009, 11:31 PM
|
#6
|
|
Member
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 426
Original Poster
Rep:
|
Quote:
Originally Posted by vanstra
I use the following 'flash2avi' script:
!#/bin/sh
|
should this be -
|
|
|
|
08-09-2009, 12:14 AM
|
#7
|
|
Senior Member
Registered: Mar 2005
Location: USA
Distribution: Slackware
Posts: 1,133
|
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.
|
|
|
|
08-09-2009, 12:57 AM
|
#8
|
|
Member
Registered: Oct 2003
Location: West Midlands, UK
Distribution: Slackware (current), Mepis on the wifes lappy
Posts: 729
Rep:
|
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.
|
|
|
|
08-09-2009, 01:34 AM
|
#9
|
|
LQ Newbie
Registered: Jul 2009
Location: Blm. IL. USA
Distribution: slackware
Posts: 13
Rep:
|
from MPlayer.SlackBuild
"The Slackware package is built with "USE_PATENTS=NO" i.e. without using
the lame mp3, faac, AMR and dvdcss libraries."
|
|
|
|
08-09-2009, 01:56 AM
|
#10
|
|
LQ Newbie
Registered: Apr 2009
Distribution: Ubuntu 10.10
Posts: 26
Rep:
|
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).
|
|
|
|
08-09-2009, 02:18 AM
|
#11
|
|
Member
Registered: Jan 2005
Location: Istanbul, Turkey
Distribution: Slackware 13.37, Pardus 2011.2
Posts: 884
Rep:
|
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.
|
|
|
|
08-09-2009, 05:53 AM
|
#12
|
|
Member
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 426
Original Poster
Rep:
|
Quote:
Originally Posted by Ilgar
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 -
Any suggestions?
|
|
|
|
08-09-2009, 06:23 AM
|
#13
|
|
Member
Registered: Aug 2009
Distribution: slack-current
Posts: 46
Rep:
|
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.
|
|
|
|
08-09-2009, 06:30 AM
|
#14
|
|
Member
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 426
Original Poster
Rep:
|
Quote:
Originally Posted by dwr1
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,
gives the following output -
Quote:
|
Ennenno.mp3: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz
|
|
|
|
|
08-09-2009, 07:00 AM
|
#15
|
|
Member
Registered: Jan 2005
Location: Istanbul, Turkey
Distribution: Slackware 13.37, Pardus 2011.2
Posts: 884
Rep:
|
Oops yes, I forgot to add, you'll get a wav file that way (as you'll notice from the file size).
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 09:10 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
|
|