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
447 B

#!/bin/bash
if [ ${#} -ne "2" ] ; then
echo "Usage: ${0} <input file> <output file>"
return 1
fi
TMPFILE="convert.tmp"
ffmpeg -i ${1} -f s16be -ar 16k -ac 1 -acodec pcm_s16be ${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}