LoginSignup
7
2

More than 5 years have passed since last update.

ffmpeg で mp4 や webm などの動画ファイルから mp3 VBR に変換して抽出する

Last updated at Posted at 2018-01-30
  • -i でファイル指定
  • -vn で video 要素を消す
  • -qscale:a 0 で圧縮時の音質レベルを調整しつつ、VBR にする
    • 参考: https://trac.ffmpeg.org/wiki/Encode/MPEG-4
    • You can select an audio quality level with -qscale:a (or the alias -q:a).
    • brew で入れた ffmpeg であれば libmp3lame が利用されるため、lame のライブラリの仕様に準拠した挙動になる
    • qscale 指定がなければデフォルトの音質設定(圧縮係数)になる、およそ平均 128kbps 付近になるように圧縮される
  • <outputfile> を末尾で指定する
ffmpeg -i <inputfile> -vn -qscale:a 0 <outputfile>
  • for do ... done で回す時は、拡張子の置き換えを行うと良い
for file in *.mp4
do
    ffmpeg -i ${file} -vn -qscale:a 0 ${file/%mp4/mp3}
done
7
2
0

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
  3. You can use dark theme
What you can do with signing up
7
2