解决silk-v3-decoder-master转换wav时,百度语音解析问题

$cur_dir/silk/decoder "$1" "$1.pcm" > /dev/null 2>&1
if [ ! -f "$1.pcm" ]; then
        /usr/local/ffmpeg/bin/ffmpeg -y -i "$1" "${1%.*}.$2" > /dev/null 2>&1 &
        ffmpeg_pid=$!
        while kill -0 "$ffmpeg_pid"; do sleep 1; done > /dev/null 2>&1
        [ -f "${1%.*}.$2" ]&&echo -e "${GREEN}[OK]${RESET} Convert $1 to ${1%.*}.$2 success, ${YELLOW}but not a silk v3 encoded file.${RESET}"&&exit
        echo -e "${YELLOW}[Warning]${RESET} Convert $1 false, maybe not a silk v3 encoded file."&&exit
fi
/usr/local/ffmpeg/bin/ffmpeg -y -f s16le -ar 24000 -ac 2 -i "$1.pcm" -f $2 -ar 16000  -ac 1 "${1%.*}.$2" > /dev/null 2>&1
#/usr/local/ffmpeg/bin/ffmpeg -y -f s16le -ar 24000 -ac 2 -i "$1.pcm" -f $2 -ar 16000 -b:a 16 -ac 1 "${1%.*}.$2" > /dev/null 2>&1
#/usr/local/ffmpeg/bin/ffmpeg  -f s16le -v 8 -y -ar 16000 -ac 2 -i "$1.pcm" "${1%.*}_play.$2" > /dev/null 2>&1
ffmpeg_pid=$!
while kill -0 "$ffmpeg_pid"; do sleep 1; done > /dev/null 2>&1
rm "$1.pcm"
[ ! -f "${1%.*}.$2" ]&&echo -e "${YELLOW}[Warning]${RESET} Convert $1 false, maybe ffmpeg no format handler for $2."&&exit
echo -e "${GREEN}[OK]${RESET} Convert $1 To ${1%.*}.$2 Finish."
exit

解决silk-v3-decoder-master转换wav时,百度语音解析问题

posted @ 2017-11-10 17:44  云龙笔记  阅读(3187)  评论(0编辑  收藏  举报