Your use of the information on Hobbs Knowledge Base is at your own risk and I accept no responsibility for any damage caused. More info here.

How To Speed Up Video Without Changing Pitch

From Hobbs Knowledge Base

Jump to: navigation, search

Summary

submit to reddit Reddit
Delicious Delicious
Slashdot Slashdot It!


A while ago, I needed to speed up a 51 minute long MP4 H264-encoded video without increasing the audio pitch (which, of course, makes everyone sound like chipmunks!).

Here are the basic commands I ran:

# Make a temp directory
mkdir temp/

# Extract audio and generate screenshots of video
ffmpeg -i original.mp4 -vn -acodec pcm_s16le temp/original.wav
ffmpeg -i original.mp4 -r 4 -f image2 temp/%06d.png

# Generate a new (faster) video from the screenshots (with no audio)
ffmpeg -i temp/%06d.png -vcodec libx264 -s 640x480 -b 896k -bt 896k -f mp4 temp/fast.mp4

# Get 'mediainfo' of new video to find out the exact duration
mediainfo temp/fast.mp4

# Copy the original audio into temp directory and run 'audacity' to change "tempo"
cp original.wav temp/fast.wav
audacity temp/fast.wav

# Get 'mediainfo' of the new video and new audio to check that the durations match
mediainfo temp/fast.mp4
mediainfo temp/fast.wav

# If the durations match, combine the two files together into the final video
ffmpeg -i temp/fast.mp4 -i fast.wav -acodec libfaac -ab 128k -vcodec copy fast.mp4

# Remove the temp directory
rm -rf temp/

Image:Notepad.gif NOTE: There are obviously a few assumptions in the example above... My video was 640x480 resolution and I wanted a video bitrate of 896k and an audio bitrate of 128k. These variable may well be customizable, or perhaps left out altogether, but I wanted to include them here for future reference on the basis that they can be left out or altered if necessary.


Image:Envelope.gif If the information on this page is either out-of-date, incorrect, or if you'd just like more information then please Contact Me.
Personal tools
Help