將 WMA 曲目庫轉換為 MP3?

將 WMA 曲目庫轉換為 MP3?

我知道有諸如 Sound Converter 之類的選項可以一次處理一個曲目或目錄,但是是否有任何工具可以遞歸地爬取目錄的子目錄並將所有 WMA 轉換為 MP3?

我基本上想讓它在我的 ~/Music 上自由發揮,讓它做它的事情,而無需我手動一次給它一個子目錄。

答案1

安裝聲音轉換器 安裝聲音轉換器

Soundconverter並從啟動器或終端運行

在此輸入影像描述

預設轉換是.ogg將其變更為mp3轉到edit-> preferences結果類型下。Format轉成MP3如下:

在此輸入影像描述

按一下新增資料夾,然後選擇您的音樂資料夾。在按一下轉換之前,您可以在上述首選項配置中選擇輸出資料夾。

希望這將透過兩次點擊來完成:)

答案2

MPlayer 可能已經安裝。也要確保你有跛腳:

sudo apt-get install mplayer lame

那麼有兩種方法可以做到這一點,一種是易於閱讀的版本,另一種是簡短而骯髒的腳本:

所有 wma 都應該位於您的目前目錄中。在您的主目錄 (~/) 中建立一個名為 wmamp3 的文件,其中包含:

#!/bin/bash

current_directory=$( pwd )

#remove spaces
for i in *.wma; do mv "$i" `echo $i | tr ' ' '_'`; done

#remove uppercase
for i in *.[Ww][Mm][Aa]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done

#Rip with Mplayer / encode with LAME
for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm -ao pcm:waveheader $i && lame -m s audiodump.wav -o $i; done

#convert file names
for i in *.wma; do mv "$i" "`basename "$i" .wma`.mp3"; done

#cleanup
rm audiodump.wav

chmod +x ~/wmamp3使其可執行

sudo cp ~/wmamp3 /usr/bin將其彈出到您路徑上有用的地方

輸入“wmamp3”來運行轉換。


簡短而骯髒的版本(與上面完全相同):

for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm -ao pcm:waveheader "$i" && lame -m j -h --vbr-new -b 160 audiodump.wav -o "`basename "$i" .wma`.mp3"; done; rm -f audiodump.wav

答案3

必須先安裝Mplayer和lame:

sudo apt-get install mplayer lame

然後創建腳本(參考頁 )並執行它:

#!/bin/bash
# By Marko Haapala
# converts wma to mp3 recursively. does not delete any static files, so 
# cleanup and renaming is needed afterwards. 
#
# requirements:
# lame    - http://lame.sourceforge.net/download.php
# mplayer - apt-get install mplayer or http://www.mplayerhq.hu/design7/dload.html


current_directory=$(pwd)
wma_files=$(find "${current_directory}" -type f -iname "*.wma")
# Need to change IFS or files with filenames containing spaces will not
# be handled correctly by for loop
IFS=$'\n' 
for wma_file in ${wma_files}; do 
    mplayer -vo null -vc dummy -af resample=44100 \
    -ao pcm -ao pcm:waveheader "${wma_file}" && lame -m s \
    audiodump.wav -o "${wma_file}".mp3
    rm audiodump.wav
done

看起來它完全符合你的要求。請記住,您可能需要擺弄蹩腳的標誌,以確保獲得所需的品質等級。

答案4

我知道這有點舊,但我修改了 David Futcher 顯示的腳本。變化是:

  • 使用/tmp臨時 wav 檔案而不是當前資料夾(當我使用它來轉換 USB 記憶棒上的檔案時,這會帶來很大的加速)。

  • 在轉換(希望成功)後刪除 wma 檔案。

這裡是:

#!/bin/bash
# By Marko Haapala
# converts wma to mp3 recursively. does not delete any static files, so
# cleanup and renaming is needed afterwards.
#
# Modified by V10lator
# to delete the wma files and to use /tmp for temporary files
#
# requirements:
# lame    - http://lame.sourceforge.net/download.php
# mplayer - apt-get install mplayer or http://www.mplayerhq.hu/design7/dload.html


current_directory=$(pwd)
tmp_file=$(mktemp -t -u --suffix=.wav)
wma_files=$(find "${current_directory}" -type f -iname "*.wma")
# Need to change IFS or files with filenames containing spaces will not
# be handled correctly by for loop
IFS=$'\n' 
for wma_file in ${wma_files}; do 
    mplayer -vo null -vc dummy -af resample=44100 \
    -ao pcm -ao pcm:waveheader -ao pcm:file="${tmp_file}" \
    "${wma_file}" && lame -m s "${tmp_file}" \
    -o "${wma_file}".mp3 && rm "${wma_file}"
    rm "${tmp_file}"
done

相關內容