制作语音数据集: 爬取B站音视频+基于whisper语音识别标注

本文以制作小学课堂音频数据集为例子

1. 搜索关键字获取音视频链接

python 复制代码
if __name__ == "__main__":
    
    with sync_playwright() as playwright:
        searcher = BLVideoSearch(playwright, headless=True)
        url = searcher.make_url(keyword=["小学公开课"])
        searcher.run(url, outfile="videos_url.txt")

得到链接列表

2. 批量下载和实时视频转音频

you-get: 根据链接下载视频文件

ffmpeg: 将视频实时转音频

subprocess: 通过子进程执行上述命令

2.1 多线程批量下载 (you-get)

you-get 子进程:

python 复制代码
command = [YOUGET, "-o", self.video_dir, "-O", utt, task]
                    subprocess.run(command, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

2.2 实时视频转音频

ffmpeg 子进程:

python 复制代码
command = [FFMPEG, "-i", video_file, '-ac', '1', '-ar', '16000', audio_file]
                    subprocess.run(command, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

下载视频文件信息如下:

最终保存为音频文件

3. 使用whisper进行断句和语音识别

相关推荐
迈火5 小时前
SD - Latent - Interposer:解锁Stable Diffusion潜在空间的创意工具
人工智能·gpt·计算机视觉·stable diffusion·aigc·语音识别·midjourney
陈天伟教授8 小时前
人工智能应用- 语言理解:01. 写作与对话
人工智能·深度学习·语音识别
liliangcsdn8 小时前
文本视频音频分块工具 - Semantic Chunkers
人工智能·音视频
风栖柳白杨10 小时前
【语音识别】一些音频的使用方法
人工智能·音视频·语音识别
普通网友10 小时前
极致压缩:Whisper.cpp 量化版本清单与 ggml 格式模型下载
whisper
天空中最亮的一颗星10 小时前
如何下载、安装whisper、faster_whisper?
whisper
Black蜡笔小新14 小时前
国密GB35114平台EasyGBS筑牢安防安全防线,GB28181/GB35114无缝接入
网络·安全·音视频·gb35114
风栖柳白杨14 小时前
【语音识别】Qwen3-ASR原理及部署
人工智能·python·语音识别·xcode·audiolm
启友玩AI15 小时前
方言守护者:基于启英泰伦CI-F162GS02J芯片的“能听懂乡音”的智能夜灯DIY全攻略
c语言·人工智能·嵌入式硬件·ai·语音识别·pcb工艺