B站下载助手_Python_whisper_PotPlayer 实现字幕倍速学习

B站下载助手_Python_whisper_PotPlayer 实现字幕倍速学习

目的是想倍速学习,但是倍速学习的时候容易听不清楚老师在讲什么,所以得需要字幕的存在 ,但是有些视频没有字幕所以想出来下面这个方法!!!!!

小电视B站视频批量下载工具,edge 扩展

image-20230505170446147

因为b站上面的视频有很多是又分集的,批量下载之后需要合并,我在实验的时候,使用一般的合并视频的方法时,所需要的时间比较多,所以想出了用python进行合并下面时代码!!

python

import os
import subprocess

# 设置输入和输出目录
input_dir = 'E:/downbzhan/DownKyi-1.5.6/Media/qinafeng_jihe'
output_file = 'E:\\downbzhan\\DownKyi-1.5.6\\Media\\qinafeng_jihe\\vedio.mp4'

# 获取文件目录下的所有视频文件
video_files = [f for f in os.listdir(input_dir) if f.endswith(('.mp4', '.avi', '.mov', '.mkv'))]
# video_files.sort()  # 按文件名排序,如果需要

# 将视频文件列表写入 concat.txt 文件
# concat_file = "concat.txt"
# with open(os.path.join(input_dir, concat_file), "w") as f:
#     for video_file in video_files:
#         file_path = video_file.replace('\\', '/')
#         f.write(f"file '{file_path}'\n")
concat_file= "concat.txt"
# 使用 subprocess 运行 FFmpeg 命令以合并视频
subprocess.run(["ffmpeg", "-f", "concat", "-safe", "0", "-i", concat_file, "-c", "copy", output_file], cwd=input_dir)

在这之前可以改一下所有文件的名字,有利于合并可以使用wps的批量重命名

image-20230505172029878

concat.txt中的内容 如下
file '1.mp4'
file '2.mp4'
file '3.mp4'
file '4.mp4'
file '5.mp4'
file '6.mp4'
file '7.mp4'
file '8.mp4'
file '9.mp4'
file '10.mp4'
file '11.mp4'
file '12.mp4'
file '13.mp4'
file '14.mp4'
file '15.mp4'
file '16.mp4'
file '17.mp4'
file '18.mp4'
file '19.mp4'
file '20.mp4'
file '21.mp4'
file '22.mp4'
file '23.mp4'
file '24.mp4'
file '25.mp4'
file '26.mp4'
file '27.mp4'
file '28.mp4'
file '29.mp4'
file '30.mp4'
file '31.mp4'
file '32.mp4'
file '33.mp4'
file '34.mp4'
file '35.mp4'
file '36.mp4'
file '37.mp4'
file '38.mp4'
file '39.mp4'
file '40.mp4'
file '41.mp4'
file '42.mp4'
file '43.mp4'
file 'video.mp4'  
concat.txt 中最后一行是你最后生成的文件的名字 要和代码中的一一对应
output_file = 'E:\\downbzhan\\DownKyi-1.5.6\\Media\\qinafeng_jihe\\vedio.mp4' 就是这一行

最后的话会得到一个大的合并的视频,这个视频是没有字幕的,得需要生成字幕,使用的方法是:WhisperDesktop 使用方法如下

WhisperDesktop

[Whisper - 本地语音转文字工具,支持 GPU、支持实时语音转换Windows] - 小众软件 (appinn.com)

image-20230505171134284

选定导出的格式为srt,txt是不可以!!!
所需要的时间比较多大概是1:3.8

image-20230505172609607

PotPlayer

image-20230505171326726

添加字幕是在PotPlayer中进行添加的

接下来就是开始学习了

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值