Monday, June 15, 2009

dumpaudio

I was having all sorts of trouble trying to figure out how to extract audio from any video file into a WAV (signed 16-bit, little-endian) format. I was fortunate enough to find something that worked universally, so here it is:

dumpaudio

#!/bin/sh
if [ $# -ge 1 ]; then
IN=$1
OUT=$1.wav
if [ $# -ge 2 ]; then
OUT=$2
fi
ffmpeg -i "$IN" -f wav -acodec pcm_s16le "$OUT"
else
echo "Usage: $0 in [ out ]" >&2
fi
Post a Comment