extract audio from video or online stream
March 1st, 2007 mysurface Posted in Misc, ffmpeg, mplayer | Hits: 44917 |
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.
Live Chat!









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.