Help us understand the problem. What is going on with this article?

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

More than 1 year has passed since last update.
  • -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
Why do not you register as a user and use Qiita more conveniently?
  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
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  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