最近玩儿无损,据说有人曾说无损是种生活,是吗?上帝知道,烧友知道,我知道,你知道吗?
今天来了兴致,想把自己的几张Avril的碟子给榨出来。Google了一小下,知道有这么个工具,名字挺有意思,abcde = A Better CD Encoder. 它能从CD中rip出来波形文件(WAV),然后根据选项把波形文件转换成特定格式的音频文件,比如mp3, ogg, flac等等。flac = Free Lossless Audio Codec,就是我要的无损了。
UB/Debian下安装abcde很简单,apt-get abcde就OK了。安装时你可能发现这个东西很小,只有不到2M。其实,abcde只是一个脚本,它利用其它的工具来实现特定的功能。比如利用cdparanoia来生成WAV文件,利用lame生成mp3文件,利用flac生成flac文件,利用mkcue生成cue文件……因此,如果相应的工具没有被安装,或者路径不在PATH中,abcde就会有错误提示:
[ERROR] abcde: lame is not in your path. [INFO] Define the full path to the executable if it exists on your system.
这时,安装相应的工具即可。
你可以在命令行中为abcde指定选项和参数,但更好的方法是使用配置文件。abcde的配置有/etc/abcde.conf或者~/.abcde.conf(可能需要自行创建),写好了配置文件,你就可以简单地执行abcde进行工作了,当然你仍然可以使用命令行选项来覆盖配置文件中设置的相应选项。abcde有哪些选项,配置文件如何写,请man之,Google之。这里有个帖子,里面有多个配置文件,包括MP3/ogg/AAC/FLAC/MPP/SPEEX,还有一个同时生成各种音频格式的配置。这里把生成FLAC文件的配置些出来,若要同时生成.cue文件(几乎是必需的),执行abcde时只需要
abcde -1 -o default,cue |
当然,mkcue必须已经安装。
# -----------------$HOME/.abcde.conf----------------- #
#
# A sample configuration file to convert music cds to
# FLAC using abcde version 2.3.99.6
#
# http://andrews-corner.org/abcde.html
# -------------------------------------------------- #
# Specify the encoder to use for FLAC. In this case
# flac is the only choice.
FLACENCODERSYNTAX=flac
# Specify the path to the selected encoder. In most cases the encoder
# should be in your $PATH as I illustrate below, otherwise you will
# need to specify the full path. For example: /usr/bin/flac
FLAC=flac
# Specify your required encoding options here. Multiple options can
# be selected as '--best --another-option' etc.
FLACOPTS='--verify --best'
# Output type for FLAC.
OUTPUTTYPE="flac"
# The cd ripping program to use. There are a few choices here: cdda2wav,
# dagrab, cddafs (Mac OS X only) and flac.
CDROMREADERSYNTAX=cdparanoia
# Give the location of the ripping program and pass any extra options:
CDPARANOIA=cdparanoia
CDPARANOIAOPTS="--never-skip=40"
# Give the location of the CD identification program:
CDDISCID=cd-discid
# Give the base location here for the encoded music files.
OUTPUTDIR="$HOME/music/"
# The default actions that abcde will take.
ACTIONS=cddb,playlist,read,encode,tag,move,clean
# Decide here how you want the tracks labelled for a standard 'single-artist',
# multi-track encode and also for a multi-track, 'various-artist' encode:
OUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${TRACKNUM}.${TRACKFILE}'
VAOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${TRACKNUM}.${ARTISTFILE}-${TRACKFILE}'
# Decide here how you want the tracks labelled for a standard 'single-artist',
# single-track encode and also for a single-track 'various-artist' encode.
# (Create a single-track encode with 'abcde -1' from the commandline.)
ONETRACKOUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${ALBUMFILE}'
VAONETRACKOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${ALBUMFILE}'
# Create playlists for single and various-artist encodes. I would suggest
# commenting these out for single-track encoding.
PLAYLISTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${ALBUMFILE}.m3u'
VAPLAYLISTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${ALBUMFILE}.m3u'
# Put spaces in the filenames instead of the more correct underscores:
mungefilename ()
{
echo "$@" | sed s,:,-,g | tr / _ | tr -d \'\"\?\[:cntrl:\]
}
# What extra options?
MAXPROCS=2 # Run a few encoders simultaneously
PADTRACKS=y # Makes tracks 01 02 not 1 2
EXTRAVERBOSE=y # Useful for debugging
EJECTCD=y # Please eject cd when finished
你好!除了代码,此处没有多少原创之物,皆为本人搜集、整理、总结之记录与心得,欢迎转载分享!转载时请尽量注明出处,将不胜感激。祝你健康、快乐!
Be the first to comment on this entry.