| 12345678910111213141516171819202122232425262728293031 |
- #!/bin/bash
- set -e
- URL=$(cd /data/ai/audio/server && node -e '
- const { PrismaClient } = require("@prisma/client");
- const p = new PrismaClient();
- p.bookChapter.findUnique({ where: { id: 394 } }).then(c => { console.log(c.audioUrl); p.$disconnect(); });
- ')
- echo "新音频 URL: $URL"
- curl -sS -m 30 -o /tmp/audio394-new.mp3 "$URL"
- ls -la /tmp/audio394-new.mp3
- echo
- echo '=== 验证时长 / 码率 ==='
- file /tmp/audio394-new.mp3 | head -1
- ffmpeg -i /tmp/audio394-new.mp3 -f null - 2>&1 | grep -E 'Duration|Stream' | head -3
- echo
- echo '=== 文本字数 + 新语速 ==='
- CHAR=$(cd /data/ai/audio/server && node -e '
- const { PrismaClient } = require("@prisma/client");
- const p = new PrismaClient();
- p.bookChapter.findUnique({ where: { id: 394 } }).then(c => { console.log(c.content.length); p.$disconnect(); });
- ')
- SEC=$(ffmpeg -i /tmp/audio394-new.mp3 -f null - 2>&1 | grep Duration | head -1 | sed 's/Duration: //; s/,.*//' | awk -F: '{print ($1*3600+$2*60+$3)}')
- echo "文本字数: $CHAR 字"
- echo "时长: $SEC 秒 ($(echo "scale=1; $SEC/60" | bc) 分钟)"
- echo "对比旧音频: 580 秒 (9:39), 现在 $SEC 秒"
- python3 -c "
- sec=$SEC; ch=$CHAR; old=580
- print(f'提升: {old-sec:.0f} 秒 ({old/sec:.2f}x 加速)')
- print(f'新语速: {ch/sec:.2f} 字/秒')
- print(f'正常参考: 3.5-4.5 字/秒')
- "
|