funasr自动化备忘

  |   0 评论   |   0 浏览

背景

记录一些常用的操作。

备忘

mp4转16k wav

ffmpeg -i input.mp4 -ar 16000 -ac 1 output.wav

音频按时长切分

ffmpeg -i input.wav -ss 0 -to 500 -y ai-0-500.wav
ffmpeg -i input.wav -ss 500 -to 1000 -y ai-500-1000.wav
ffmpeg -i input.wav -ss 1000 -to 1500 -y ai-1000-1500.wav
ffmpeg -i input.wav -ss 1500 -to 2000 -y ai-1500-2000.wav
ffmpeg -i input.wav -ss 2000 -to 2500 -y ai-2000-2500.wav
ffmpeg -i input.wav -ss 2500 -to 3000 -y ai-2500-3000.wav

版本二

ffmpeg -i input.wav -ss 0 -to 300 -y ai-0-500.wav
ffmpeg -i input.wav -ss 300 -to 600 -y ai-300-600.wav
ffmpeg -i input.wav -ss 600 -to 900 -y ai-600-900.wav
ffmpeg -i input.wav -ss 900 -to 1200 -y ai-900-1200.wav
ffmpeg -i input.wav -ss 1200 -to 1500 -y ai-1200-1500.wav
ffmpeg -i input.wav -ss 1500 -to 1800 -y ai-1500-1800.wav
ffmpeg -i input.wav -ss 1800 -to 2100 -y ai-1800-2100.wav
ffmpeg -i input.wav -ss 2100 -to 2400 -y ai-2100-2400.wav
ffmpeg -i input.wav -ss 2400 -to 2700 -y ai-2400-2700.wav
ffmpeg -i input.wav -ss 2700 -to 3000 -y ai-2700-3000.wav

进行ASR

find /home/fw/work/AI_Bot/ | grep wav$ > ai_bot.txt

LD_LIBRARY_PATH=lib ./oai-asr-test "test" model/ ai_bot.list result_ai_bot.list > output_ai_bot.log 2>&1

加标点

cd ~/work/05.funasr/FunASR/funasr/runtime/onnxruntime/build/bin

./funasr-onnx-offline-punc --txt-path /home/fw/work/02.asr/asr_engine/result_ai_bot.list --model-dir ../../model/punc_ct-transformer_zh-cn-common-vocab272727-pytorch/damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch/ > ai_bot.list 2>&1