ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.34k stars 9.95k forks source link

If --convert-subs is used and subtitle file is 404 - ffmpeg dies with FileNotFoundError #19921

Open Phr33d0m opened 5 years ago

Phr33d0m commented 5 years ago

Please follow the guide below


Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2019.02.18. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

Before submitting an issue make sure you have:

What is the purpose of your issue?


The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add the -v flag to your command line you run youtube-dl with (youtube-dl -v <your command line>), copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', '-4', '-u', 'PRIVATE', '-p', 'PRIVATE', '-o', '%(playlist)s/%(title)s.%(ext)s', '--all-subs', '--embed-subs', '--convert-subs', 'srt', '--merge-output-format', 'mkv', '--no-mtime', '--http-chunk-size', '50M', '--sleep-interval', '15', '--playlist-start', '14', '--referer', 'https://www.viki.com/tv/20503c-my-love-from-the-star', '--verbose', 'https://www.viki.com/tv/20503c-my-love-from-the-star']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.02.18
[debug] Python version 3.7.2 (CPython) - Linux-4.20.11-x86_64-with-arch
[debug] exe versions: ffmpeg 4.1.1, ffprobe 4.1.1, phantomjs 2.1.1, rtmpdump 2.4
[debug] Proxy map: {}
[viki:channel] Logging in
[viki:channel] 20503c: Downloading channel JSON
[viki:channel] 20503c: Downloading episodes JSON page #1
[viki:channel] 20503c: Downloading clips JSON page #1
[viki:channel] 20503c: Downloading movies JSON page #1
[download] Downloading playlist: My Love From the Star
[viki:channel] playlist My Love From the Star: Collected 33 video ids (downloading 20 of them)
[download] Downloading video 1 of 20
[viki] Logging in
[viki] 1031059v: Downloading video JSON
[viki] 1031059v: Downloading video streams JSON
[debug] Default format spec: bestvideo+bestaudio/best
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.ar.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.bg.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.ca.vtt
WARNING: Unable to download subtitle for "ca": 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.
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.cs.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.da.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.de.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.el.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.en.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.es.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.et.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.fi.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.fr.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.he.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.hr.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.hu.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.id.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.it.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.ja.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.ko.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.lt.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.nl.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.pl.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.pt.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.ro.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.ru.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.sk.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.sr.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.sv.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.th.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.tl.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.tr.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.vi.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.zh.vtt
[info] Writing video subtitles to: My Love From the Star/My Love From the Star - Episode 14.zt.vtt
[debug] Invoking downloader on 'https://v4.viki.io/1031059v/1031059v_high_720p_1708160653.mp4?e=1551050922&h=37bc939e6ee24b388ef9524df5de0899'
[download] My Love From the Star/My Love From the Star - Episode 14.mp4 has already been downloaded
[download] 100% of 806.56MiB
[ffmpeg] Converting subtitles
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:My Love From the Star/My Love From the Star - Episode 14.ar.vtt' -f srt 'file:My Love From the Star/My Love From the Star - Episode 14.ar.srt'
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:My Love From the Star/My Love From the Star - Episode 14.bg.vtt' -f srt 'file:My Love From the Star/My Love From the Star - Episode 14.bg.srt'
Traceback (most recent call last):
  File "/usr/bin/youtube-dl", line 11, in <module>
    load_entry_point('youtube-dl==2019.2.18', 'console_scripts', 'youtube-dl')()
  File "/usr/lib/python3.7/site-packages/youtube_dl/__init__.py", line 472, in main
    _real_main(argv)
  File "/usr/lib/python3.7/site-packages/youtube_dl/__init__.py", line 462, in _real_main
    retcode = ydl.download(all_urls)
  File "/usr/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2006, 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 805, 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 1004, in process_ie_result
    extra_info=extra)
  File "/usr/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 866, in process_ie_result
    extra_info=extra_info)
  File "/usr/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 805, 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 859, 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 1640, in process_video_result
    self.process_info(new_info)
  File "/usr/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 1987, in process_info
    self.post_process(filename, info_dict)
  File "/usr/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2052, in post_process
    files_to_delete, info = pp.run(info)
  File "/usr/lib/python3.7/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 638, in run
    self.run_ffmpeg(old_file, new_file, ['-f', new_format])
  File "/usr/lib/python3.7/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 239, in run_ffmpeg
    self.run_ffmpeg_multiple_files([path], out_path, 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: 'My Love From the Star/My Love From the Star - Episode 14.ca.vtt'

Description of your issue, suggested solution and other information

Hi, if the website url provides a list of subtitles files but youtube-dl is unable to download a certain subtitle file (because of a server 404 error), after that youtube-dl does not remember this happened and tries to convert the subtitle file anyways (because of --convert-subs) thus making ffmpeg dies with a FileNotFoundError error.

My proposed solution would be for youtube-dl to remember if a file wasn't available through the download process and ignore the following actions like converting the subtitles (and even trying to embed them inside the container).

Regards.

jcjordyn130 commented 5 years ago

I'd say also make youtube-dl retry downloading of video info, subtitles, etc according to the --retries option if it isn't a HTTP 404 error.