将WMA曲目库转换为MP3曲目?

我知道有一些选项,比如声音转换器,一次只能做一个轨道或目录,但有没有任何工具可以递归爬行目录的子目录并将所有WMA转换为MP3的?

我基本上想把它放在我的〜/音乐上,让它在没有我手动不得不一次给它一个子目录的情况下做它的事情。

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 '[AZ]' '[az]'`; 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 -ms 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 -mj -h --vbr-new -b 160 audiodump.wav -o "`basename "$i" .wma`.mp3"; done; rm -f audiodump.wav 

安装Soundconverter 安装声音转换器

并从启动器或终端运行Soundconverter

在此处输入图像描述

默认转换为.ogg将此更改为mp3将在结果类型下进行edit-> preferencesFormat为MP3如下:

在此处输入图像描述

单击添加文件夹,然后选择您的音乐文件夹。 在单击转换之前,您可以在上述首选项配置中选择输出文件夹。

希望这将通过两次点击完成:)

必须首先安装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 -ms \ audiodump.wav -o "${wma_file}".mp3 rm audiodump.wav done 

看起来它完全符合您的要求。 请记住,您可能想要摆弄跛脚旗,以确保您获得所需的质量水平。

安装Perl Audio Converter(pacpl): sudo apt-get install pacpl

此命令将给定目录中的所有wma文件转换为mp3文件(保留原始文件):

pacpl -r -to mp3 -only wma

如果您感觉有风险,可以添加--delete选项以删除原件:

pacpl -r --delete -to mp3 -only wma I

我知道这有点旧,但我修改了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 -ms "${tmp_file}" \ -o "${wma_file}".mp3 && rm "${wma_file}" rm "${tmp_file}" done 

对于那些正在寻找能够选择某些文件类型的GUI版本的人:KDE工具soundKonverter https://github.com/HessiJames/soundkonverter询问应该将哪些文件类型添加到对话队列中。

包含mp3 / ogg / wma文件的巨大Audiobook系列的最佳解决方案。

这是我的版本的Marko Haapala脚本,使用ffmpeg:

 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 # Also, it must be run as root to correctly handle spaces on Ubuntu 16 IFS=$'\n' for wma_file in ${wma_files}; do ffmpeg -i "${wma_file}" -q:a 0 "${wma_file}".mp3 #uncomment rm below to delete original wma's #rm "${wma_file}" done 

我更喜欢ffmpeg,因为它不会改变采样率,也不需要中间临时文件

Soundcoverter显示有关Windows Media模块和Python 2.7的错误

Avconv运行良好:avconv -i ./song.wma song.mp3

您也可以在批量模式下使用我的应用程序… dmMediaConverter 。 如需帮助,请参阅此video…而不是video文件,拖放wma。 https://www.youtube.com/watch?v=rZR40mdFRoQ&index=1&list=PLwURYFQvHBAtG8wqzyVgOQ1WtEYSkiscO