Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE


This forum has not been maintained for a long time and will probably get deleted in the near future.
For faster responses to your questions, please use StackOverflow instead and tag your questions with "FFmpeg".
If you need a backup of the posts from this forum, please contact me directly.

How to change audio volume up / down with FFmpeg?

A collection of useful tutorials for some common tasks.

How to change audio volume up / down with FFmpeg?

Postby burek » Fri Apr 27, 2012 4:30 pm

To turn the audio volume up or down, you may use FFmpeg's Audio Filter named volume, like in the following example, if we wan't our volume to be half of the input volume:
Code: Select all
ffmpeg -f lavfi -i "amovie=input.wav,volume=0.5" output.wav


Many of us have expected that the proper use would be:
Code: Select all
ffmpeg -i input.wav -af 'volume=0.5' output.wav

but that's not the case, because the option -af was never implemented for audio filters, like the option -vf was implemented for video filters, so you would simply get the error like: Unrecognized option 'af'.
Also, you can't use -vf volume=0.5 because it would get ignored, since it is not a video filter.

Long story short, if you need to use any of FFmpeg's Audio Filters, you'll have to use it via lavfi input device.
A little bit tricky, but it works :)

More info here: http://ffmpeg.org/trac/ffmpeg/ticket/720
burek
 
Posts: 864
Joined: Mon May 09, 2011 10:16 pm
Location: Serbia

Re: How to change audio volume up / down with FFmpeg?

Postby mmsa12 » Sat Sep 21, 2013 8:14 pm

Hi,

I spent last 4 days trying to acheive that but with no luck,

I am trying to detect volume of streaming link or save audio file, using the FFmpeg I tried every single command line.

Code: Select all
ffmpeg -f lavfi -i amovie=sample1.aac,volumedetect -f null -y test.txt


Out put :

Code: Select all
There was a problem! Array ( [0] => FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers [1] => built on Jan 29 2012 17:52:15 with gcc 4.4.5 20110214 (Red Hat 4.4.5-6) [2] => configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --enable-avfilter --enable-avfilter-lavf --enable-libdc1394 --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab [3] => libavutil 50.15. 1 / 50.15. 1 [4] => libavcodec 52.72. 2 / 52.72. 2 [5] => libavformat 52.64. 2 / 52.64. 2 [6] => libavdevice 52. 2. 0 / 52. 2. 0 [7] => libavfilter 1.19. 0 / 1.19. 0 [8] => libswscale 0.11. 0 / 0.11. 0 [9] => libpostproc 51. 2. 0 / 51. 2. 0 [10] => Unknown input format: 'lavf' )


Basically I had this
Code: Select all
 Unknown input format: 'lavf'


any advise
mmsa12
 
Posts: 1
Joined: Sat Sep 21, 2013 8:10 pm

Re: How to change audio volume up / down with FFmpeg?

Postby burek » Sat Sep 28, 2013 5:18 pm

It is "lavfi" not "lavf" :)
burek
 
Posts: 864
Joined: Mon May 09, 2011 10:16 pm
Location: Serbia

Re: How to change audio volume up / down with FFmpeg?

Postby screenshaper » Thu Oct 16, 2014 6:50 pm

This thread is OUTDATED
Later -af option has been implemented!

Now this command
Code: Select all
ffmpeg -i input.wav -af volume=-3dB output.wav
is perfectly working

See ticket #725
screenshaper
 
Posts: 7
Joined: Wed Oct 15, 2014 3:33 pm


Return to Tutorials

Who is online

Users browsing this forum: Google [Bot] and 1 guest