linux convert mp3 to wav and opus to wav

时间:2023-03-09 19:33:13
linux convert mp3 to wav  and opus to wav

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 ]] && { echo "mp3wav mp3file"; exit ; }
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 上使用 Opus Tools 將音樂轉成 Opus 格式

装一下opus-tools即可

sudo apt-get install opus-tools

Opus Tools 包含什麼工具?

Opus Tools 包含了以下幾種工具:

  • opusdec:Opus 的解碼器。
  • opusenc:Opus 的編碼器。
  • opusinfo:Opus 檔案的資訊顯示器。
  • opusrtp:發送 Opus 音訊至 RTP 串流,或從 RTP 串流接收 Opus 音訊。

详细的,看一下链接