我的目标是在单独的文件中下载带有自动生成字幕的 YouTube 视频,例如.vtt
,.srt
, etc.
我目前正在努力实现这一目标youtube-dl
但如果需要的话,我愿意接受其他解决方案。
当我运行以下命令时,它将视频下载为.mp4
(这很好)和一个单独的.vtt
文件,但是.vtt
似乎有点混乱,并且一次显示整个剪辑的所有文本,而不是指定的时间。
我正在运行的命令:
youtube-dl --write-auto-sub https://www.youtube.com/watch?v=Roc89oOZOF4&list=PLJBo3iyb1U0eNNN4Dij3N-d0rCJpMyAKQ&index=45
下载此 .vtt:
WEBVTT
Kind: captions
Language: en
00:00:05.960 --> 00:00:08.290 align:start position:0%
thank <00:00:06.003><c>you </c><00:00:06.046><c>ah </c><00:00:06.089><c>crap </c><00:00:06.132><c>well </c><00:00:06.175><c>looks </c><00:00:06.218><c>like </c><00:00:06.261><c>the </c><00:00:06.304><c>good </c><00:00:06.347><c>Lord </c><00:00:06.390><c>just </c><00:00:06.433><c>sent </c><00:00:06.476><c>me </c><00:00:06.519><c>a </c><00:00:06.562><c>conversation </c><00:00:06.605><c>starter </c><00:00:06.648><c>come </c><00:00:06.691><c>here </c><00:00:06.734><c>Jesse </c><00:00:06.777><c>come </c><00:00:06.820><c>get </c><00:00:06.863><c>the </c><00:00:06.906><c>ball </c><00:00:06.949><c>hmm</c>
00:00:08.290 --> 00:00:10.549 align:start position:0%
thank you ah crap well looks like the good Lord just sent me a conversation starter come here Jesse come get the ball hmm
00:00:10.549 --> 00:00:13.070 align:start position:0%
00:00:13.070 --> 00:00:15.470 align:start position:0%
00:00:15.470 --> 00:00:23.750 align:start position:0%
00:00:23.750 --> 00:00:23.760 align:start position:0%
00:00:23.760 --> 00:00:26.480 align:start position:0%
我了解到这可能是 YouTube 故意为之。
即使这是真的,有什么办法可以将其转换为.vtt
转换为可用的格式或只是从 YouTube 下载格式正确的自动生成的字幕?
Python、FFMPEG、命令行是首选,但任何东西都有帮助!
谢谢!非常感谢任何和所有的帮助!
In ttml
格式,字幕是功能性的。尝试 :
yt-dlp --write-auto-subs --sub-format ttml --no-playlist "https://www.youtube.com/watch?v=Roc89oOZOF4&list;=PLJBo3iyb1U0eNNN4Dij3N-d0rCJpMyAKQ&index;=45"
-
yt-dlp https://github.com/yt-dlp/yt-dlp是一个 youtube-dl 分支
- 转换
ttml
to srt
or vtt
,你必须添加--convert-subs srt
or --convert-subs vtt
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)