Changing audio pitch in a video

I managed to end up with a few videos that had incorrect audio pitch. At first I thought the video speed was incorrect, but the time and play rate of the video seemed fine. After a little searching I came across a solution.

  1. Split source into separate video and audio files (various distros use ffmpeg or avconv)
    ffmpeg -i  -vcodec copy -an 1.mp4
    ffmpeg -i  1.wav
  2. Change audio pitch (install rubberband-cli, could also use audacity or similar). Experiment with the pitch shift (-p option), negative shifts down, positive up.
    rubberband -p -2 1.wav 1a.wav
  3. Recombine into a single file
    ffmpeg -i 1.mp4 -i 1a.wav -vcodec copy -strict experimental out.m4v


for i in *.m4v
 do avconv -i "$i" -vcodec copy -an 1.mp4
 avconv -i "$i" 1.wav
 rubberband -p -2 1.wav 1a.wav
 avconv -i 1.mp4 -i 1a.wav -vcodec copy -strict experimental out/"$i"
 rm -f 1.mp4 1.wav 1a.wav

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s