hipporion/conv_ring.sh
2019-10-01 19:01:56 +02:00

8 lines
310 B
Bash
Executable file

#!/bin/sh -e
if test "$#" != "1"; then echo "Usage: $0 sound_file.ext"; exit 1; fi
file="${1%.*}.pcm"
ffmpeg -loglevel fatal -y -i "$1" -f u8 -c pcm_mulaw -ar 8000 -ac 1 "$file"
size=`du -b "$file" | cut -f1`
size=$(($size/240*240))
if test "$size" -gt "16080"; then size=16080; fi
truncate -s "$size" "$file"