5

Using ffmpeg can i filter out the voice frequency? I checked the voice frequency is somewhere in 300 Hz to 3000 Hz. i just want the music from a mp3 file!

shrw
  • 1,531
  • 4
  • 22
  • 42
  • Also see [How to use the equalizer audio filter in `ffmpeg`](http://superuser.com/a/696187/110524). The syntax is similar to other related audio filters such as `bandpass`, `bandreject`, `highpass`, and `lowpass`. – llogan Feb 09 '14 at 19:02

1 Answers1

6

What you're looking for is the bandreject filter I suppose:

ffmpeg.exe -i song.wav -c:a pcm_s16le -af "bandreject=f=900:width_type=h:w=600" out.wav -y

This command attenuates everything between 900 - 600 = 300 Hz and 900 + 600 = 1500 Hz.For some reason the width value can't be higher than 999 Hz... Bear in mind that the attenuation is not perfect so if you want more attenuation you can chain the filter as many time as you want:

ffmpeg.exe -i song.wav -c:a pcm_s16le -af "bandreject=f=900:width_type=h:w=600, bandreject=f=900:width_type=h:w=600" out.wav -y

I couldn't filter the voice out by applying these numbers though, you'll need to tweak the values.

AJ29
  • 1,085
  • 9
  • 9
  • getting error : Unrecognized option 'c:a' Failed to set value 'pcm_s16le' for option 'c:a' – shrw Feb 09 '14 at 15:09
  • `-c:a` is used to specify the audio codec. Did you put the `-` before `c:a` ? – AJ29 Feb 09 '14 at 15:15
  • yes i did .. here is my command .. ffmpeg -i A1.wav -c:a pcm_s16le -af "bandreject=f=900:width_type=h:w=900" AS.wav -y – shrw Feb 09 '14 at 15:18
  • if i try to remove -c:a .. with command ..ffmpeg -i A1.wav -af "bandreject=f=900:width_type=h:w=900" AS.wav -y.. Unrecognized option 'af' Failed to set value 'bandreject=f=900:width_type=h:w=900' for option 'af' .. i am using ffmpeg on ubuntu .. am i missing something trivial/or version mismatch .. (BTW i am able to work with other files) – shrw Feb 09 '14 at 15:26
  • @naveen: If you are using an Ubuntu ffmpeg then it is not the real ffmpeg and/or is quite old. See http://stackoverflow.com/a/9477756/112212 and http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=729203 – mark4o Feb 09 '14 at 15:34
  • is avconv upto date or and other linux distribution works for this .. any other workaround ? – shrw Feb 10 '14 at 09:36
  • This has very little effect. – Ken Sharp Jan 08 '18 at 21:01
  • You can use http://ffmpeg.org/ffmpeg-filters.html#bandpass bandpass for the opposite, letting only voice through – Caridorc Apr 06 '20 at 09:06