Answers:
MPlayer可能已经安装。还请确保您有la脚:
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
-ao pcm -waveheader
,则该快捷版本仍可在2016年(14.04版)上使用-ao pcm:waveheader
。
并Soundconverter
从启动器或终端运行
默认的转换是.ogg
改变这mp3
要edit-> preferences
根据类型的结果。Format
到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 -m s \
audiodump.wav -o "${wma_file}".mp3
rm audiodump.wav
done
看起来它确实可以满足您的要求。请记住,您可能想要摆弄the脚的标志,以确保获得所需的质量水平。
安装Perl音频转换器(pacpl): sudo apt-get install pacpl
此命令会将给定目录中的所有wma文件转换为mp3文件(保持原始格式不变):
pacpl -r -to mp3 -only wma <directory name>
如果您觉得有风险,可以添加--delete
选项来删除原件:
pacpl -r --delete -to mp3 -only wma <directory name>
一世
我知道这有点旧,但是我修改了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
-o "${wma_file}".mp3 && rm "${wma_file}" "${tmp_file}"
这将显着提高处理速度,因为缺少rm的另一个exec。
对于那些正在寻找能够选择某些文件类型的GUI版本的用户:KDE工具soundKonverter https://github.com/HessiJames/soundkonverter询问应将哪些文件类型添加到对话队列中。
我庞大的包含mp3 / ogg / wma文件的有声读物收藏的最佳解决方案。
这是我使用ffmpeg编写的Marko Haapala脚本版本:
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,因为它不会更改采样率并且不需要中间临时文件
您也可以在批量模式下使用我的应用程序... dmMediaConverter。要获得帮助,请观看此视频...而不是将视频文件拖放到wma文件中。 https://www.youtube.com/watch?v=rZR40mdFRoQ&index=1&list=PLwURYFQvHBAtG8wqzyVgOQ1WtEYSkiscO