如何从 youtube-dl --write-auto-sub 下载转换混乱的 .vtt 子文件?

per*_*hon 4 ffmpeg subtitle youtube-dl video-subtitles

我的目标是在单独的文件中下载带有自动生成字幕的 YouTube 视频,例如.vtt.srt等。

我目前正在努力实现这一目标youtube-dl但如果需要,我愿意接受其他解决方案。

当我运行以下命令时,它将视频下载为.mp4(这很好)和一个单独的.vtt文件,但.vtt似乎不知何故搞砸了,并立即显示整个剪辑的所有文本,而不是指定的时间。

我正在运行的命令:

youtube-dl --write-auto-sub https://www.youtube.com/watch?v=Roc89oOZOF4&list=PLJBo3iyb1U0eNNN4Dij3N-d0rCJpMyAKQ&index=45
Run Code Online (Sandbox Code Playgroud)

下载此 .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%
 



Run Code Online (Sandbox Code Playgroud)

我了解到这可能是 YouTube 故意为之。

即使这是真的,有没有办法将其转换.vtt为可用的格式,或者只是从 YouTube 下载格式正确的自动生成的字幕?

Python、FFMPEG、命令行是首选,但任何东西都有帮助!

谢谢!非常感谢任何和所有的帮助!

Ala*_*A45 6

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是 youtube-dl 的分支
  • 要转换ttmlsrtor vtt,您必须添加--convert-subs srtor--convert-subs vtt