制作语音数据集: 爬取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进行断句和语音识别

相关推荐
ldccorpora20 小时前
Multiple-Translation Arabic (MTA) Part 2数据集介绍,官网编号LDC2005T05
人工智能·深度学习·自然语言处理·动态规划·语音识别
EasyGBS20 小时前
EasyGBS算法算力融合架构:GB28181标准平安乡村智能视频监控建设方案设计
架构·音视频
科技小E21 小时前
EasyGBS算法算力融合架构:标准平安乡村智能视频监控建设方案设计
架构·音视频
雾江流1 天前
小喵播放器 1.1.5| 视频超分提升画质,支持网页视频,B站番剧
音视频·软件工程
li星野1 天前
OpenCV4.X学习-视频相关
学习·音视频
雪风飞舞1 天前
python根据音频生成柱状图
开发语言·python·音视频
狗狗学不会1 天前
RK3588 极致性能:使用 Pybind11 封装 MPP 实现 Python 端 8 路视频硬件解码
人工智能·python·音视频
ldccorpora1 天前
Chinese News Translation Text Part 1数据集介绍,官网编号LDC2005T06
数据结构·人工智能·python·算法·语音识别
知南x1 天前
【物联网视频监控系统----韦东山老师视频总结】(4)流媒体方案的实现之ffmpeg
ffmpeg·音视频
老兵发新帖1 天前
基于Label Studio的视频标注与YOLO模型训练全流程指南
python·yolo·音视频