码迷,mamicode.com
首页 > 系统相关 > 详细

linux convert mp3 to wav

时间:2018-08-27 18:37:54      阅读:392      评论:0      收藏:0      [点我收藏+]

标签:follow   using   pg1   ...   for   mil   org   gui   str   

link :  https://www.cyberciti.biz/faq/convert-mp3-files-to-wav-files-in-linux/

Install mpg321 or mpg123

Type the following command under Debian / Ubuntu Linux, enter:


sudo apt-get install mpg321

OR

sudo apt-get install mpg123

I recommend using mpg123 as it is updated frequently.

Install mpg123 under CentOS / RHEL / Fedora Linux

Turn on rpmforge repo and type the following command:

yum install mpg123

Convert an MP3 to WAV

The -w option will convert an .mp3 file to .wav file. The syntax is:

mpg123 -w output.wav input.mp3

OR

mpg321 -w output.wav input.mp3

A Sample Shell Script Helper Function

Add the following to your ~/.bashrc startup file (tested with bash v3.x+):

mp3towav(){
    [[ $# -eq 0 ]] && { echo "mp3wav mp3file"; exit 1; }
    for i in "$@"
    do
        # create .wav file name
        local out="${i%/*}.wav"
        [[ -f "$i" ]] && { echo -n "Processing ${i}..."; mpg123 -w "${out}" "$i" &>/dev/null  && echo "done." || echo "failed."; }
    done
}

Use it as follows:

mp3towav *.mp3
mp3towav "this is a test.mp3"
ls *.wav

 

linux convert mp3 to wav

标签:follow   using   pg1   ...   for   mil   org   gui   str   

原文地址:https://www.cnblogs.com/dahu-daqing/p/9542482.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!