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

相关推荐
EasyNVR1 天前
EasyNVR,让视频接入更简单,让集成开发更自由
音视频
Nautiluss1 天前
一起调试XVF3800麦克风阵列(二)
大数据·人工智能·嵌入式硬件·音频·语音识别·dsp开发
电商API_180079052471 天前
淘宝商品视频提取API全解析:从授权到落地实战
爬虫·python·信息可视化·数据分析·音视频
TMT星球1 天前
欧瑞博推出全新集成方案,用谷电做空调,一晚只需一度电
人工智能·语音识别
aqi001 天前
FFmpeg开发笔记(九十五)国产的开源视频美颜工具VideoEditorForAndroid
android·ffmpeg·音视频·直播·流媒体
却道天凉_好个秋1 天前
音视频学习(七十八):行程编码
音视频·视频压缩
EasyDSS1 天前
解析RTMP视频推流平台EasyDSS如何实现无人机推流直播
音视频·无人机
专业开发者1 天前
‌蓝牙低功耗音频(Bluetooth LE Audio)的幕后解析
音视频
EasyCVR1 天前
视频汇聚平台EasyCVR筑牢智慧物流全场景可视化安全防线
大数据·安全·音视频
子夜江寒1 天前
OpenCV 入门:图像与视频的基础操作
python·opencv·音视频