今まではテンポ(再生速度)を変えるには atempo
を、ピッチ(高低)を変えるには asetrate
を使っていたが、rubberband
は asetrate
で変わる周波数を変えずにピッチとテンポを変えることができる。
rubberband
は別途ライブラリをインストールしないと使えないのと、現在は 64bit に未対応である。
インストールする
git clone git://github.com/lachs0r/rubberband rubberband cd rubberband make && make install
これでインストールできるが、Makefile の冒頭に PREFIX でインストール場所を指定できる。XhmikosR’s Builds を使っている場合は cc がなくエラーが出るので MSYS/mingw/bin/gcc.exe を MSYS/mingw/bin/cc.exe にコピー&リネームする。
ffmpeg の configure オプションには
--enable-librubberband --pkg-config-flags="--static"
をつける。
公式ドキュメント:FFmpeg Filters Documentation :: rubberband
オプション
詳細にオプションが指定できるが説明は省略。
- tempo
テンポ(音声再生速度)指定。規定値:1 - pitch
ピッチ(音の高さ)指定。規定値:1 - transients
- crisp
- mixed
- smooth
- detector
- compound
- percussive
- soft
- phase
- laminar
- independent
- window
- standard
- short
- long
- smoothing
- off
- on
- formant
- shifted
- preserved
- pitchq
- quality
- speed
- consistency
- channels
- apart
- together
基本コマンド
2倍速再生にする(映像は2倍速にはならない)
ffplay input -af rubberband=tempo=2
映像も2倍速再生にする
ffplay input -vf setpts=1/2*PTS -af rubberband=tempo=2
ffplay input -vf setpts=1/2*PTS -af atempo=2