LoginSignup
12

More than 5 years have passed since last update.

posted at

フォルダ内のwavファイルを一括でmp3に変更

やりたかったことは

  • コマンドライン上でwavをmp3に変換
  • フォルダ内の全ファイルに一括でコマンド適用(シェルのお勉強)

wav to mp3

ffmpegをインストール

$brew install ffmpeg

変換

ffmpeg -i "hoge.wav" -vn -ac 2 -ar 44100 -ab 256k -acodec libmp3lame -f mp3 "hoge.mp3"

-abでビットレートを指定します。

一括処理

for i in $(ls)
do
ffmpeg -i $i -vn -ac 2 -ar 44100 -ab 256k -acodec libmp3lame -f mp3 ${i%.*}.mp3
done

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
12