11
Help us understand the problem. What are the problem?

More than 3 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
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
11
Help us understand the problem. What are the problem?