extract audio from video or online stream
March 1st, 2007 mysurface Posted in ffmpeg, Misc, mplayer | Hits: 254933 | 40 Comments »
You can easily extract audio from video files such as avi, mpg, even flv! into mp3 uses either mplayer or ffmpeg. You can even record online stream into mp3, such as stream from radio cast.
Lets begin with mplayer. To extract audio from video files, use -dumpaudio option and specified the output filename with -dumpfile
mplayer -dumpaudio nodame_theme.flv -dumpfile nodame_theme.mp3
Okay check out the output:
file nodame_theme.mp3
Output:
MPEG ADTS, layer III, v2, 8 kBits, 22.05 kHz, Monaural
Okay, The audio extracted from flv, so quality is quite low, haha. But you can change the audio rate by using ffmpeg. Let see how to use ffmpeg.
ffmpeg -i nodame_theme.flv -ab 128 -ar 44100 nodame_theme.mp3
-i is to specified input file, -ab audio bitrate, -ar audio sampling frequency
Let say what file tells you.
MPEG ADTS, layer II, v1, 128 kBits, 44.1 kHz, Monaural
How about record online stream?
First, find an online radio cast to try, you can have plenty of it from shoutcast.
mplayer -dumpstream http://64.236.34.97:80/stream/1005 -dumpfile smoothjazz.mp3
ffmpeg -i http://64.236.34.97:80/stream/1005 -ab 128 -ar 44100 smoothjazz.mp3
Thanks to Mohd Shakir, you can make it a script for stream recording.







April 2nd, 2007 at 8:29 pm
[…] Another ways to watch the videos is ripping out, there are many cases where you wanna extract out certain tracks from dvd or vcd and watch it later. You can do it with mplayer, as simple as you can extract audio from online stream or video files. […]
April 5th, 2007 at 11:31 pm
The ffmpeg step to increase the mp3’s bitrate and sampling rate is a waste of time and space. It won’t increase the sound quality at all. In fact, it may slightly degrade sound quality if the mp3 encoder throws out different parts of the audio the second time it’s compressed. And the resulting file will take up far more space than the original when you’re through.
It’s like recording a phone conversation in a recording studio. You’re limited by the quality of your source.
May 21st, 2007 at 6:34 am
ur just stupid johnboy id recommend u shut up b4 making a fool of urself
June 11th, 2007 at 4:41 am
Well, no, Johnboy is perfectly correct. You can’t get better quality than the source material. Increasing the bitrate just uses more space, but there isn’t any more audio data available to put in that space than there was in the original. And since mp3 is lossy, any additional encoding step will degrade it somewhat.
July 4th, 2007 at 11:03 am
Johnboy is right. You won’t get any better sound than the one you have in the original file… how could you?
July 21st, 2007 at 5:00 am
You’re a complete idiot. Johnboy is definitely right, how do you think ffmpeg should “increase quality”? Getting the missing information from nowhere?
Please check what you write before someone poorly educated in information theory gets fooled by your pathethic advices.
July 26th, 2007 at 8:36 am
Hey, look at my modified bash script at http://www.donneker.de/projects/radio_rip – its easy to use with streamtuner and you can hear and record the stream you need with one connection and so save bandwith too. just have a try and gimme feedback!
July 29th, 2007 at 11:04 am
I say:
garbage in,…….garbage out!
August 25th, 2007 at 8:27 am
[…] extract audio from video or online stream » Linux by Examples (tags: linux audio mp3 video howto extract tutorial mplayer flash flv convert multimedia opensource ffmpeg mencoder) […]
September 6th, 2007 at 10:11 am
You could also extract audio from a videofile with avidemux
October 7th, 2007 at 9:10 pm
you… extract… audio… vlc also :-)
November 27th, 2007 at 6:57 am
[…] Linux by Example audio […]
December 7th, 2007 at 11:38 am
I see many people tried to go to my website to probably see the script, but the link here is outdated. The new link is at:
http://www.mohdshakir.net/2007/02/27/shell-script-for-the-day-listen-to-online-radio-offline
Thanks
January 30th, 2008 at 4:23 am
[…] mplayer -dumpaudio Metallica.avi -dumpfile Metallica.mp3 [1] [1] http://linux.byexamples.com/archives/229/extract-audio-from-video-or-online-stream/ […]
February 5th, 2008 at 1:12 am
These people are right, encoding it again won’t help it at all.
February 5th, 2008 at 1:12 am
These people are right, encoding it again won’t help it at all.
April 24th, 2008 at 6:45 pm
Thank you so much. It will be useful tip for me.
June 11th, 2008 at 4:13 pm
[…] […]
June 28th, 2008 at 5:12 pm
[…] (thanks to here) […]
June 29th, 2008 at 6:35 am
He/she never said that it would increase the quality ;), just that it would increase the bitrate.
January 26th, 2009 at 9:51 am
A little late, but w.e
I’m assuming that mplayer doesn’t let you set the bitrate and saves it with a crappy default 8kb (as there is no way an op would be recorded with such bad quality), but ffmpeg does. So (s)he redoes it from the _original_ file (not the mplayer rip) with a higher quality. (S)he is a linux user, can’t assume (s)he is dumb.
Or… i could be wrong.
February 15th, 2009 at 12:35 am
anon from January 26th
You assume wrong. Mplayer’s dumpaudio makes it dump the audio stream as it is in the video file, which is essentially the best audio quality you can get out of that particular video file…
Making ffmpeg reencode the stream at a higher bitrate is, as was previously mentioned, a complete waste of time and space :-)
October 10th, 2009 at 11:55 pm
I am using ffmpeg 0.5 and it complained when I ran the command as written above (-ab 128) that teh bitrate was too low and that ffmpeg takes the number as bit/s not kbit/s.
So, I reran the same command with:
ffmpeg -i nodame_theme.flv -ab 128000 -ar 44100 nodame_theme.mp3
and now the bitrate reported is 128kb/s.
January 17th, 2010 at 6:12 am
In addition to all said about changing bitrates is useless. Currently the audio from most flv youtube videos is not codified as mp3 but as AAC, so you need to recodify it as mp3 with loss of quality, I don’t recommend it.
June 19th, 2010 at 8:18 pm
Thanks mate, it rocks
September 11th, 2010 at 10:54 pm
Thanks, this is exactly what I was looking for!
Btw, to complete the conversation about re-encoding the sound track, it can be useful to do that if you want to play it with a device that has limited capacities. Some MP3 players are really picky.
December 4th, 2010 at 5:45 pm
mp4 videos don’t seem to work…
April 23rd, 2011 at 8:52 pm
Thanks for your posting. Another element is that to be a photographer will involve not only issues in capturing award-winning photographs but hardships in acquiring the best photographic camera suited to your requirements and most especially struggles in maintaining the quality of your camera. This can be very true and visible for those photography fans that are straight into capturing the actual nature’s engaging scenes — the mountains, the particular forests, the wild and the seas. Going to these daring places undoubtedly requires a photographic camera that can live up to the wild’s harsh surroundings.
May 3rd, 2011 at 3:28 pm
Thanks first. Is there a program that can extract all video as audio files straightly and easily? I have checked that there is a very good program which is called streaming audio capture(http://www.capturestreamingaudio.net/) for us. Share for you.
May 19th, 2011 at 4:08 am
Quieres conocer nuevas amigas
September 16th, 2011 at 9:54 pm
Hey all I used to be just checkin out this web site and that i really admire the foundation want to know
November 6th, 2011 at 9:21 am
LOL. “Okay, The audio extracted from flv, so quality is quite low, haha. But you can change the audio rate by using ffmpeg. Let see how to use ffmpeg.”
EPIC FAIL! Is this a troll post or are you really that dumb?
Because if you are, I bet you also think renaming a Word document (your “image” format of choice) with a embedded BMP to “.jpg” will make it a JPEG image. ^^
January 24th, 2013 at 2:25 am
I use MP4Box:
http://linux-workers.posterous.com/tag/mp4box
May 3rd, 2013 at 12:48 pm
Too many folks have already thrown away plenty of good money on nothing but useless
salt tablets being shipped from South America.
In fact, I always suggest to those overweight vegetarians
to keep to a max of 4 pounds a week so you won’t suffer loose skin post weight loss. That way, the actual process will end up being much less frustrating and, for the majority of people, enjoyable.
May 12th, 2013 at 1:46 am
This helps business managers to determine what the general public thinks about their products or
services. As an Internet broadcaster, it is high time that you pick on these available opportunities and
add that $ilver sheen to your broadcasting happiness.
Having had my nearby store shut down recently I looked around for another place where I could get my gear from but unfortunately could not find any good outlets
even remotely close to my home so started looking online.
June 1st, 2013 at 4:30 am
the how about extract file audio .mp4?
thx
May 21st, 2015 at 4:37 pm
I do not even know how I ended up right here,
but I believed this submit was once good. I don’t recognize who
you might be but definitely you’re going to a well-known blogger
should you are not already. Cheers!
June 12th, 2015 at 10:41 pm
“The study says that for marketers and retailers, key opportunity for growth lies in delivering decorative items that enhance the dining experience. However, I’ve found that the situation does dictate what silverware we use, the formality of the dinnerware does not always reflect how “nice” the meal actually is. All the pieces have a Christmas tree in the center of the pattern.
October 13th, 2015 at 11:02 pm
[…] VLC has a GUI and a Wizard. ffmpeg and mplayer example here. […]
August 2nd, 2017 at 3:10 am
[…] extract audio from video or online stream […]