yt-dlp / yt-dlp

A feature-rich command-line audio/video downloader
https://discord.gg/H5MNcFW63r
The Unlicense
86.4k stars 6.73k forks source link

Download the subtitles generated by automatic translation on Youtube, the first large period of time will create blanks #5792

Closed DOSforever closed 1 year ago

DOSforever commented 1 year ago

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

Checklist

Please make sure the question is worded well enough to be understood

在 Youtube 上下载自动翻译生成的字幕,前一大段时间会产生空白

使用 --write-subs --write-auto-subs --sub-langs "en-en,zh-hans-en" 选项下载英文和自动翻译生成的中文字幕,所下载的英文 .vtt 字幕文件没问题,但是中文的 .vtt 文件内容有问题,前面一大段时间时间轴正常,但完全没有任何字幕,直到后面某个时间开始才有字幕,而且似乎是前一段时间的字幕都集中在一起了。比如总的时长是10分钟,前3分钟没有任何字幕,从第3分钟开始有字幕了,但从这 00:03:10 --> 00:03:30 的这段时间集中了前面3分钟的所有字幕,但从这之后时间的字幕都正常了。 我猜想是不是由于下载开始,但网站的自动翻译结果还未出来的延时造成的?


Download the subtitles generated by automatic translation on Youtube, the first large period of time will create blanks

Use the --write-subs --write-auto-subs --subs --subs "en-en,zh-hans-en" option to download the Chinese subtitles generated by English and automatic translation, the downloaded English .vtt subtitle file is fine, but there is a problem with the content of the .vtt file in the Chinese, the previous large timeline is normal, but there are no subtitles at all, and there are no subtitles until a later time, And it seems that the subtitles from a while ago are all concentrated together. For example, the total duration is 10 minutes, there are no subtitles in the first 3 minutes, and there are subtitles from the 3rd minute, but all the subtitles of the first 3 minutes are concentrated from the time period of 00:03:10 --> 00:03:30, but the subtitles of the time are normal from then on. I guess it's caused by the delay when the download starts, but the automatic translation results of the website are not yet available?

Provide verbose output that clearly demonstrates the problem

Complete Verbose Output

yt-dlp -v -f bv+ba -S tbr -I 5 https://www.youtube.com/playlist?list=PLy7Kah3WzqrEerJ0VPNWVaR4CYHMr4wmV
[debug] Command-line config: ['--proxy', 'https://127.0.0.1:8580', '-v', '-f', 'bv+ba', '-S', 'tbr', '-I', '5', 'https://www.youtube.com/playlist?list=PLy7Kah3WzqrEerJ0VPNWVaR4CYHMr4wmV']
[debug] Portable config "D:\X64\yt-dlp\yt-dlp.conf": ['--buffer-size', '4M', '--write-link', '--write-subs', '--write-auto-subs', '--sub-langs', 'en-en,zh-hans-en', '--write-description', '--ffmpeg-location', 'D:/X64/ffmpeg-N-109398-g7e8b539389-win64-gpl-shared/bin']
[debug] Encodings: locale cp936, fs utf-8, pref cp936, out utf-8 (No VT), error utf-8 (No VT), screen utf-8 (No VT)
[debug] yt-dlp version 2022.11.11 [8b64402] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-7-6.1.7601-SP1 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg N-109398-g7e8b539389-20221210 (setts), ffprobe N-109398-g7e8b539389-20221210
[debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2022.09.24, mutagen-1.46.0,sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {'http': 'https://127.0.0.1:8580', 'https': 'https://127.0.0.1:8580'}
[debug] Loaded 1723 extractors
[debug] [youtube:tab] Extracting URL: https://www.youtube.com/playlist?list=PLy7Kah3WzqrEerJ0VPNWVaR4CYHMr4wmV
[youtube:tab] PLy7Kah3WzqrEerJ0VPNWVaR4CYHMr4wmV: Downloading webpage
[youtube:tab] PLy7Kah3WzqrEerJ0VPNWVaR4CYHMr4wmV: Redownloading playlist API JSON with unavailable videos
[download] Downloading playlist: LibreOffice Base
[info] Writing playlist description to: LibreOffice Base [PLy7Kah3WzqrEerJ0VPNWVaR4CYHMr4wmV].description
[youtube:tab] Playlist LibreOffice Base: Downloading 1 videos of 94
[download] Downloading video 1 of 1
[debug] [youtube] Extracting URL: https://www.youtube.com/watch?v=HbDuEEv3gOk
[youtube] HbDuEEv3gOk: Downloading webpage
[youtube] HbDuEEv3gOk: Downloading android player API JSON
[debug] Sort order given by user: tbr
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, tbr, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, filesize, fs_approx, vbr, abr, asr, vext, aext, hasaud, id
[info] HbDuEEv3gOk: Downloading subtitles: en-en, zh-Hans-en
[info] HbDuEEv3gOk: Downloading 1 format(s): 137+140
[info] Writing video description to: LibreOffice Base (05) Registry and Export Data to a Calc File [HbDuEEv3gOk].description
[info] Writing video subtitles to: LibreOffice Base (05) Registry and Export Data to a Calc File [HbDuEEv3gOk].en-en.vtt
[debug] Invoking http downloader on "https://www.youtube.com/api/timedtext?v=HbDuEEv3gOk&xoaf=5&hl=en&ip=0.0.0.0&ipbits=
0&expire=1670878450&sparams=ip%2Cipbits%2Cexpire%2Cv%2Cxoaf&signature=28F5C78F84C8095D40E9EE28A03BD3B0C8277D88.E4596185F
F76D083DBD63C90C61B1894188286CA&key=yt8&lang=en&fmt=vtt"
[debug] File locking is not supported. Proceeding without locking
[download] Destination: LibreOffice Base (05) Registry and Export Data to a Calc File [HbDuEEv3gOk].en-en.vtt
[download] 100% of    7.55KiB in 00:00:00 at 8.19KiB/s
[info] Writing video subtitles to: LibreOffice Base (05) Registry and Export Data to a Calc File [HbDuEEv3gOk].zh-Hans-en.vtt
[debug] Invoking http downloader on "https://www.youtube.com/api/timedtext?v=HbDuEEv3gOk&xoaf=5&hl=en&ip=0.0.0.0&ipbits=
0&expire=1670878450&sparams=ip%2Cipbits%2Cexpire%2Cv%2Cxoaf&signature=28F5C78F84C8095D40E9EE28A03BD3B0C8277D88.E4596185F
F76D083DBD63C90C61B1894188286CA&key=yt8&lang=en&tlang=zh-Hans-en&fmt=vtt"
[download] Destination: LibreOffice Base (05) Registry and Export Data to a Calc File [HbDuEEv3gOk].zh-Hans-en.vtt
[download] 100% of    7.40KiB in 00:00:00 at 8.54KiB/s
[info] Writing internet shortcut (.url) to: LibreOffice Base (05) Registry and Export Data to a Calc File [HbDuEEv3gOk].url
[debug] Invoking http downloader on "https://rr4---sn-o097znzk.googlevideo.com/videoplayback?expire=1670874852&ei=hDKXY-
usDteZsfIPx_ONkAs&ip=65.49.38.138&id=o-ALUQKpbviCZSCu_Pu9BazDWfk0WSW8qF23RUGN7k6TwO&itag=137&source=youtube&requiressl=yes&mh=XJ&mm=31%2C26&mn=sn-o097znzk%2Csn-a5mekn6s&ms=au%2Conr&mv=m&mvi=4&pl=19&initcwndbps=350000&spc=SFxXNj6cvQtwS1tZxokMfG2jbixCAmI&vprv=1&svpuc=1&mime=video%2Fmp4&gir=yes&clen=48683974&dur=376.644&lmt=1393668635988046&mt=1670852944&fvip=1&keepalive=yes&fexp=24001373%2C24007246&c=ANDROID&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIhAIVXZEPjPm9u0ApyEA2tmJPS_WzZ_esbrotsv7RJLIwLAiAJQhd_AjEHP2QLQVn030btBrAT12GF1tzkQHOhs3vGCA%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAJw9U2LyaeoIQySzYnFah9nvCb6Gw5BF6YCcY8nunCUnAiAGDYRuwpo1AmXwKnvz_B4PB6nOoWUFlQITlwh6uq4M2A%3D%3D"
[download] Destination: LibreOffice Base (05) Registry and Export Data to a Calc File [HbDuEEv3gOk].f137.mp4
[download] 100% of   46.43MiB in 00:03:19 at 238.30KiB/s
[debug] Invoking http downloader on "https://rr4---sn-o097znzk.googlevideo.com/videoplayback?expire=1670874852&ei=hDKXY-usDteZsfIPx_ONkAs&ip=65.49.38.138&id=o-ALUQKpbviCZSCu_Pu9BazDWfk0WSW8qF23RUGN7k6TwO&itag=140&source=youtube&requiressl=yes&mh=XJ&mm=31%2C26&mn=sn-o097znzk%2Csn-a5mekn6s&ms=au%2Conr&mv=m&mvi=4&pl=19&initcwndbps=350000&spc=SFxXNj6cvQtwS1tZxokMfG2jbixCAmI&vprv=1&svpuc=1&mime=audio%2Fmp4&gir=yes&clen=5984105&dur=376.743&lmt=1393668655085706&mt=1670852944&fvip=1&keepalive=yes&fexp=24001373%2C24007246&c=ANDROID&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIhAObK7OroQMhd2diUBROezJ-EhjR_OTlJPuugQ7oK4TdtAiARsWYfk3QVW-9jTYquNA3ZHxi2Tde-vf0i3TGXTgK1IQ%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAJw9U2LyaeoIQySzYnFah9nvCb6Gw5BF6YCcY8nunCUnAiAGDYRuwpo1AmXwKnvz_B4PB6nOoWUFlQITlwh6uq4M2A%3D%3D"
[download] Destination: LibreOffice Base (05) Registry and Export Data to a Calc File [HbDuEEv3gOk].f140.m4a
[download] 100% of    5.71MiB in 00:00:10 at 567.88KiB/s
[Merger] Merging formats into "LibreOffice Base (05) Registry and Export Data to a Calc File [HbDuEEv3gOk].mp4"
[debug] ffmpeg command line: "D:/X64/ffmpeg-N-109398-g7e8b539389-win64-gpl-shared/bin\ffmpeg" -y -loglevel "repeat+info" -i "file:LibreOffice Base (05) Registry and Export Data to a Calc File [HbDuEEv3gOk].f137.mp4" -i "file:LibreOffice Base (05) Registry and Export Data to a Calc File [HbDuEEv3gOk].f140.m4a" -c copy -map "0:v:0" -map "1:a:0" -movflags "+faststart" "file:LibreOffice Base (05) Registry and Export Data to a Calc File [HbDuEEv3gOk].temp.mp4"
Deleting original file LibreOffice Base (05) Registry and Export Data to a Calc File [HbDuEEv3gOk].f140.m4a (pass -k to keep)
Deleting original file LibreOffice Base (05) Registry and Export Data to a Calc File [HbDuEEv3gOk].f137.mp4 (pass -k to keep)
[download] Finished downloading playlist: LibreOffice Base
pukkandan commented 1 year ago

Does the same subtitle appear correctly in browser?

weisenhan commented 1 year ago

D_W-FAT3XE4 as a test case, the auto-translate function makes the subtitles appear the same as "all the subtitles of the first 3 minutes are concentrated". This doesn't seem to be a yt-dlp problem. https://litter.catbox.moe/4laa4w.png

pukkandan commented 1 year ago

If the subtitles on youtube are broken, nothing we can do about it