milahu / nixpkgs

Nix Packages collection
MIT License
1 stars 0 forks source link

ffmpeg-full: add rubberband - fix: No such filter: 'rubberband' #59

Open milahu opened 6 months ago

milahu commented 6 months ago

fix

$ ffmpeg -i src.flac -filter:a "rubberband=pitch=0.9438743126816935,rubberband=tempo=1/0.9438743126816935" dst.flac
No such filter: 'rubberband'

needed for How to change pitch and tempo together, reliably with ffmpeg

workaround: use the rubberband executable note: rubberband requires files, not pipes, because it runs in 2 passes

ffmpeg -i src.flac src.wav
rubberband --time 0.9438743126816935 --frequency 0.9438743126816935 src.wav dst.wav
ffmpeg -i dst.wav dst.flac

alternatives to rubberband

use other ffmpeg filters ...

atempo to change tempo

# change tempo from 25fps to 24000/1001fps
src=src.flac
ffmpeg -i "$src" \
  -af atempo="(24000/1001)/25" \
  dst.flac

asetrate and aresample to change tempo and pitch

# change tempo and pitch from 25fps to 24000/1001fps
src=src.flac
streams=a:0
src_sr=$(ffprobe -loglevel error -select_streams $streams -show_entries stream=sample_rate -of default=nw=1:nk=1 "$src")
dst_sr=48000
ffmpeg -i "$src" \
  -af asetrate="$src_sr*(24000/1001)/25,aresample=resampler=soxr:out_sample_rate=$dst_sr" \
  dst.flac