Skip to content

Instantly share code, notes, and snippets.

@konrad
Created July 16, 2012 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save konrad/3122195 to your computer and use it in GitHub Desktop.
Save konrad/3122195 to your computer and use it in GitHub Desktop.
Script to convert videos to mp3 with higher speed
SPEED=1.5
for FILE in $@
do
WAV_FILE=$(basename $FILE .mp4).wav
WAV_FILE_SPED_UP=$(basename $FILE .mp4)_spedup.wav
MP3_FILE=$(basename $FILE .mp4)_spedup.mp3
ffmpeg -i $FILE -vn $WAV_FILE
sox $WAV_FILE $WAV_FILE_SPED_UP tempo $SPEED
lame $WAV_FILE_SPED_UP $MP3_FILE
rm $WAV_FILE $WAV_FILE_SPED_UP
done
Copy link

ghost commented Apr 7, 2014

These days you can do all at once with just "sox", although I don't know all the syntax/the exact command.

The only downside is that with lame you can have more control over the final mp3 encoding. Sox defaults to a minimum of ~30 kbps on vbr or something like vbr. Which isn't extremely high, but still.

At very least one can ditch totally the ffmpeg/avconv part and do the speed-up wav in a single step.

Just switch the "$WAV_FILE" for "$FILE" on the sox line, comment/erase the ffmpeg one, and that will do it.

Thanks for the script though, I've shrunk substantially my podcast collection, with the added benefit of speeding up. Now everyone sounds kind of drunk when I hear them on normal speed, though.

Copy link

ghost commented Apr 7, 2014

Ops, just now I noticed "convert video". Then what I said may not really apply totally. I've only used it for converting mp3 to smaller and faster mp3. Never noticed it was more than that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment