You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
450 B

#!/bin/bash
if [ ${#} -ne "2" ] ; then
echo "Usage: ${0} <input file> <output file>"
exit 1
fi
TMPFILE="convert.tmp"
ffmpeg -i "${1}" -f u16be -ar 16k -ac 1 -acodec pcm_u16be ${TMPFILE}
SIZE=$(( $(stat -c "%s" ${TMPFILE} ) / 2 ))
echo -ne "\0$(printf %o $(($SIZE % 256)) )\0$(printf %o $(( ($SIZE / 256) % 256)) )\0$(printf %o $(( ($SIZE / 256**2) % 256)) )\0$(printf %o $(( ($SIZE / 256**3) % 256)) )" | cat - ${TMPFILE} > "${2}"
rm ${TMPFILE}