2010年9月26日 星期日

HowTo - Linux 下如何從 flv 取出聲音成 mp3

  • Use  mplayer
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

Then check out the output:

$ file nodame_theme.mp3

Output:

MPEG ADTS, layer III, v2,   8 kBits, 22.05 kHz, Monaural

  • Use ffmpeg
$ ffmpeg -i nodame_theme.flv -ab 128 -ar 44100 nodame_theme.mp3
or 
$ ffmpeg -i video.flv -f mp3 -vn -acodec copy carsounds2.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
or
$ ffmpeg -i http://64.236.34.97:80/stream/1005 -ab 128 -ar 44100 smoothjazz.mp3

  • Reference
http://linux.byexamples.com/archives/229/extract-audio-from-video-or-online-stream/

沒有留言:

張貼留言

Ceasar's Photo

www.flickr.com