Open jcjordyn130 opened 4 years ago
I have been trying to find a work around for this for days now. Saw you posted this days ago, was hoping it would have a fix by now.
The issue for me is with youtube livestream videos. ydl will not recognize the auto subs until the video is finished streaming AND once youtube has converted it to a non HLS video container, usually taking hours for longer videos on youtube's end.
Have you found any useful way to grab them in the interim?
I have found my own hacky workaround. Here is a description of it with the old code and my new code: https://gist.github.com/jegfish/6aa9337516f213ed18b8145abedd87e4 Here is a git diff of it, which may be easier to read: https://gist.github.com/jegfish/90f605bd55b239215036996e478acfdf
Essentially I keep track of the subtitle languages that fail to download in the list failed_sub_langs
, then delete those sub_lang
s from the dictionary info_dict['requested_subtitles']
.
I have never looked at nor touched the youtube-dl code base before this, so I will not pretend that this is the right solution or even a good one. I don't like the idea of changing the 'requested_subtitles'
to something it's not, and that may cause issues somewhere else in the code that I don't know about.
The real problem here might be the code that tries to download certain subtitle languages that runs into a 404. Maybe it is generating the wrong URL. Maybe it's YouTube's fault. I haven't looked at that bit of code, so I don't know. I just hope that my workaround might be helpful to others.
I can confirm this bug.
While trying to download player.vimeo.com video 294967001
with --all-subs --embed-subs
arguments, the tool will fail to download one of the subtitle languages (the server returns 404, even if I open the video in the browser), and then it crashes when trying to embed the subtitles into a single file.
WARNING: Unable to download subtitle for "es": Unable to download webpage: HTTP Error 404: Not Found (caused by <HTTPError 404: 'Not Found'>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
…
[ffmpeg] Embedding subtitles in 'foobar-294967001.mp4'
Traceback (most recent call last):
File "/usr/lib/python-exec/python3.7/youtube-dl", line 11, in <module>
load_entry_point('youtube-dl==2020.7.28', 'console_scripts', 'youtube-dl')()
File "/usr/lib/python3.7/site-packages/youtube_dl/__init__.py", line 474, in main
_real_main(argv)
File "/usr/lib/python3.7/site-packages/youtube_dl/__init__.py", line 464, in _real_main
retcode = ydl.download(all_urls)
File "/usr/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2019, in download
url, force_generic_extractor=self.params.get('force_generic_extractor', False))
File "/usr/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 808, in extract_info
return self.process_ie_result(ie_result, download, extra_info)
File "/usr/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 863, in process_ie_result
return self.process_video_result(ie_result, download=download)
File "/usr/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 1644, in process_video_result
self.process_info(new_info)
File "/usr/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2000, in process_info
self.post_process(filename, info_dict)
File "/usr/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2065, in post_process
files_to_delete, info = pp.run(info)
File "/usr/lib/python3.7/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 426, in run
self.run_ffmpeg_multiple_files(input_files, temp_filename, opts)
File "/usr/lib/python3.7/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 210, in run_ffmpeg_multiple_files
os.stat(encodeFilename(path)).st_mtime for path in input_paths)
File "/usr/lib/python3.7/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 210, in <genexpr>
os.stat(encodeFilename(path)).st_mtime for path in input_paths)
FileNotFoundError: [Errno 2] No such file or directory: 'foobar-294967001.es.vtt'
I can confirm the workaround from the previous comment works: the not-found subtitle is correctly ignored and the final file is assembled correctly. @jegfish, how about you submit your little patch as a pull request?
Checklist
Verbose log
Description
Whenever I tell youtube-dl to download all automatic subtitles and embed them into the resulting video file if any of them fail to download the whole process fails. Would it be possible to either figure out why these URLs are returning HTTP 404 or adding a command line switch for youtube-dl to ignore them? The video URL that I'm trying to download is https://www.youtube.com/watch?v=DO-euhzk4dQ.