Mac OSX おすすめフリーソフト、定番ソフトからかわったソフトまで紹介しています

mac のコマンドラインでLame エンコーダを使ってmp3を作成する

● Lameのインストール

brew install lame

● afinfo コマンドを使ってmp3ファイルの情報を見る

afinfo ファイル名

● lame コマンドのヘルプを見てオプションを確認する

lame --help
LAME 64bits version 3.100 (http://lame.sf.net)

usage: lame [options] <infile> [outfile]

    <infile> and/or <outfile> can be "-", which means stdin/stdout.

RECOMMENDED:
    lame -V2 input.wav output.mp3

OPTIONS:
    -b bitrate      set the bitrate, default 128 kbps
    -h              higher quality, but a little slower.
    -f              fast mode (lower quality)
    -V n            quality setting for VBR.  default n=4
                    0=high quality,bigger files. 9.999=smaller files
    --preset type   type must be "medium", "standard", "extreme", "insane",
                    or a value for an average desired bitrate and depending
                    on the value specified, appropriate quality settings will
                    be used.
                    "--preset help" gives more info on these

    --help id3      ID3 tagging related options

    --longhelp      full list of options

    --license       print License information

● lame コマンドで音質やファイルサイズを変更しながらエンコードする

・VBRクオリティー2(ファイルサイズ大)

 lame -V2 input.mp3 output.mp3

・VBRクオリティー4(ファイルサイズ標準)

 lame -V4 input.mp3 output.mp3

・VBRクオリティー6(ファイルサイズ小・おすすめ)

 lame -V6 input.mp3 output.mp3

・VBRクオリティー9(ファイルサイズ小)

 lame -V9 input.mp3 output.mp3

クォリティのオプションは -V9.99 までありますが、ここまで下げると音質がかなり悪くなります。

● あるディレクトリ内の全てのmp3ファイルをLameエンコーダーを使って圧縮し dis/ ディレクトリに保存する

find . -type f  | xargs -I{} lame -V6 {} dist/{}

( {} は マッチしたファイル名に変換されます )

● あるディレクトリ内の全てのmp3ファイルをLameエンコーダーを使って圧縮し dis/ ディレクトリに保存する

.DS_Storeファイルを除外し、4プロセス並列で高速実行する

find . -type f ! -name ".DS_Store" -print0 | xargs -0 -P 4 -I{} lame -V6 {} dist/{}
No.2373
07/20 14:54

edit