PL | EN

Easy and useful tricks with ffmpeg

Too quiet center channel, voiceover (convert multichannel audio to stereo + loud center channel)

Too quiet voiceover (convert multichannel audio to stereo + loud center channel)? Do you have a movie where you cannot hear the voiceover because it is in the quiet center channel? Do you hate surround sound that stuns instead of giving joy from the movie? With ffmpeg you can easily convert an MKV file so that the center channel is much louder. Install ffmpeg and then issue the command:

For 6.1 sound (join into one line):
    ffmpeg -i INPUT.mkv  
           -c:v copy 
           -acodec ac3
           -ac 2 
           -af "pan=stereo|FL=1.5*FC+0.40*FL+0.40*BL+0.1*LFE|FR=1.5*FC+0.40*FR+0.40*BR+0.1*LFE" 
           OUTPUT.mkv
  
For 5-channel sound (join into one line):
    ffmpeg -i INPUT.mkv 
           -c:v copy 
           -acodec ac3
           -ac 2 
           -af "pan=stereo|FL=FC+0.30*FL+0.30*BL|FR=FC+0.30*FR+0.30*BR" 
           OUTPUT.mkv
  
More information is HERE. ou can play around with the multipliers. FL is Front Left, BL is Back Left, FC is central, etc... Useful CMD script convert6chaudio.cmd (converts whole current folder).



Variable dialogue volume (to silent sometimes) - dynamic range compression

If you want to equalize volume levels try compression as below. You can find more information here. Unfortunately I don't know how to combine the range compression with the above channel merging. Ffmpeg does not allow it in some simple way. Issue the command below in one line.
  ffmpeg -i INPUT.avi 
         -c:v copy 
         -acodec ac3
         -ac 2  
         -filter_complex "compand=attacks=.1:points=-80/-900|-65/-25|-27/-9|-15/-5|-5/-10|0/-7|20/-6:gain=-3" 
         OUTPUT.avi
  
But for some reason some of my old DVB-T decoders don't read these files afterwards (unsupported audio codec). But just convert them again ffmpeg -i output.avi -c:v copy -acodec ac3 -ac 2 new_output.avi and it works. I don't know why.


Convert audio files to AAC, WAV, MP3

The following command will convert any audio file or even extract audio track from movie using ffmpeg. To convert to:

ACC:
      ffmpeg -i INPUT.mp3 -c:a aac -q:a 3 output.aac 
  
WAV:
      ffmpeg -i INPUT.mp3 -acodec pcm_s16le -ar 44100 output.aac 
  
MP3:
      ffmpeg -i INPUT.wav -codec:a libmp3lame -qscale:a 2 output.mp3
  
Useful CMD scripts: convert2aac.cmd, convert2wav.cmd.txt, convert2mp3.cmd (converts whole current folder).



Convert movie format, cut parts, cut (crop) beginning and end (avidemux GUI)

And for lazies there is a super GUI - avidemux. It helps you cut the middle of a movie (e.g. from a decoder), cut commercials without recompression, etc. There are many tutorials on the net.


Main page