Easily Reduce or Increase FLV Video Audio Levels Using ffmpeg

October 6th, 2010 | Tags: , , , , , , , ,

Found a very simple mechanism to reduce (or increase) audio levels in FLV video files. Historically this has always been a pain to work as we would normally need to demux the files and work on the audio and then remux them.

This technique uses the open-source ffmpeg package, you don’t really need to know exactly how ffmpeg works suffice to say it’s an extremely powerful command-line application that allows you to work directly on files, but I will try and explain a little of how it works here. This article is intended as a simple guide as to how easily you could amend a file’s attributes, this process for a 15s video will take approx 5s to process which would free up significant time and stop a lot of too-ing/fro-ing between Ops & Creative Agency.

To reduce (or increase) audio levels is a one line command like this:

ffmpeg -i myinputfile.flv -vcodec copy -acodec copy -vol 128 myoutputfile.flv

The above command is saying to the system – “Run ffmpeg using myinputfile.flv as the input file, copy all video and audio streams to the new file but amend the audio levels to be 50% of the original file”. This isn’t as complex as it looks, I’ll explain what this does:

ffmpeg -i myinputfile.flv -vcodec copy -acodec copy -vol 128 myoutputfile.flv
This runs the program and tells it the file you want to convert is called myinputfile.flv (or whatever you’ve called the file), the -i stands for ‘inputfile’.

ffmpeg -i myinputfile.flv -vcodec copy -acodec copy -vol 128 myoutputfile.flv
This part of the command is telling ffmpeg that you want to simply copy the video stream directly top the output file, ie; you don;t want to convert it or treat it in anyway

ffmpeg -i myinputfile.flv -vcodec copy -acodec copy -vol 128 myoutputfile.flv
This is the same as -vcodec but instead is telling ffmpeg that you simply want to copy the audio stream to the new file (don’t worry we’ll work with audio levels next)

ffmpeg -i myinputfile.flv -vcodec copy -acodec copy -vol 128 myoutputfile.flv
The -vol flag sets the output file’s volume relative to the input volume. To copy the audio at the exact same level as the input file you would write:
-vol 256
To set it to 50% of the input file you would put
-vol 128
To Set it at 150% of the input file’s audio levels you would put
-vol 384

ffmpeg -i myinputfile.flv -vcodec copy -acodec copy -vol 128 myoutputfile.flv
Lastly you need to specify the output file’s filename.

ffmpeg is an extremely powerful tool but the learning curve can be steep, however, it is open-source, there are plenty of training and informational resources available and best of all, it’s free.

Related links and tutorials:
http://ffmpeg.org/
http://linuxers.org/tutorial/ffmpeg-tutorial-beginners
http://www.wikihow.com/Use-FFmpeg
http://www.bala-krishna.com/convert-video-files-to-flv-using-ffmpeg-command/
http://www.tuxradar.com/content/ffmpeg-made-easy

No comments yet.
You must be logged in to post a comment.