Repository: yt-dlp
Issue: unable to download HLS streamed subtitles via ffmpeg
Labels: bug,core:downloader

### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting a bug unrelated to a specific site
- [X] I've verified that I'm running yt-dlp version **2022.10.04** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#video-url-contains-an-ampersand--and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)

### Provide a description that is worded well enough to be understood

When downloading subtitles with ffmpeg using m3u8 protocol, yt-dlp assumes the output file is an mpeg media and adds `-f mp4` to the ffmpeg output flags.

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['https://ef3d709f657e5d20b2d142c51a026680-httpcache0-90107-cacheod0.dna.ip-only.net/90107-cacheod0/_definst_/smil:assets/d8/d8ab4607-00090107/EM_HT20_117_roslund_v2.mp4_swe_1611826609386/playlist.m3u8', '--skip-download', '--write-subs', '--no-config', '--downloader', 'm3u8:ffmpeg', '-v']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8 (No ANSI), error utf-8 (No ANSI), screen utf-8 (No ANSI)
[debug] yt-dlp version 2022.10.04 [4e0511f] (pip) API
[debug] Python 3.10.6 (CPython 64bit) - Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.31 (glibc 2.31)
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] exe versions: ffmpeg 4.2.7, ffprobe 4.2.7
[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.3
[debug] Proxy map: {}
[debug] Loaded 1690 extractors
[debug] [generic] Extracting URL: https://ef3d709f657e5d20b2d142c51a026680-httpcache0-90107-cacheod0.dna.ip-only.net/90107-cacheod0/_definst_/smil:assets/d8/d8ab4607-00090107/EM_HT20_117_roslund_v2.mp4_swe_1611826609386/playlist.m3u8
[generic] playlist: Downloading webpage
[debug] Identified a direct video link
[generic] playlist: Downloading m3u8 information
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[info] playlist: Downloading subtitles: swe
[debug] Default format spec: bestvideo*+bestaudio/best
[info] playlist: Downloading 1 format(s): 3628
[info] Writing video subtitles to: playlist [playlist].swe.vtt
[debug] Invoking ffmpeg downloader on "https://ef3d709f657e5d20b2d142c51a026680-httpcache0-90107-cacheod0.dna.ip-only.net/90107-cacheod0/_definst_/smil:assets/d8/d8ab4607-00090107/EM_HT20_117_roslund_v2.mp4_swe_1611826609386/subtitlelist_lswe_b2496000_cfYXNzZXRzL2Q4L2Q4YWI0NjA3LTAwMDkwMTA3LzkwMTA3MTYwODI4Nzc3NTUwNi52dHQ=.m3u8"
[download] Destination: playlist [playlist].swe.vtt
[debug] ffmpeg command line: ffmpeg -y -loglevel verbose -headers 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Sec-Fetch-Mode: navigate
' -i https://ef3d709f657e5d20b2d142c51a026680-httpcache0-90107-cacheod0.dna.ip-only.net/90107-cacheod0/_definst_/smil:assets/d8/d8ab4607-00090107/EM_HT20_117_roslund_v2.mp4_swe_1611826609386/subtitlelist_lswe_b2496000_cfYXNzZXRzL2Q4L2Q4YWI0NjA3LTAwMDkwMTA3LzkwMTA3MTYwODI4Nzc3NTUwNi52dHQ=.m3u8 -c copy -f mp4 'file:playlist [playlist].swe.vtt.part'
ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[tcp @ 0x55c8acff2640] Starting connection attempt to 213.132.98.195 port 443
[tcp @ 0x55c8acff2640] Successfully connected to 213.132.98.195 port 443
[hls @ 0x55c8acfef3c0] Skip ('#EXT-X-VERSION:3')
[hls @ 0x55c8acfef3c0] HLS request for url 'https://ef3d709f657e5d20b2d142c51a026680-httpcache0-90107-cacheod0.dna.ip-only.net/90107-cacheod0/_definst_/smil:assets/d8/d8ab4607-00090107/EM_HT20_117_roslund_v2.mp4_swe_1611826609386/subtitlechunk_lswe_b2496000_cfYXNzZXRzL2Q4L2Q4YWI0NjA3LTAwMDkwMTA3LzkwMTA3MTYwODI4Nzc3NTUwNi52dHQ=_0.webvtt', offset 0, playlist 0
[hls @ 0x55c8acfef3c0] Opening 'https://ef3d709f657e5d20b2d142c51a026680-httpcache0-90107-cacheod0.dna.ip-only.net/90107-cacheod0/_definst_/smil:assets/d8/d8ab4607-00090107/EM_HT20_117_roslund_v2.mp4_swe_1611826609386/subtitlechunk_lswe_b2496000_cfYXNzZXRzL2Q4L2Q4YWI0NjA3LTAwMDkwMTA3LzkwMTA3MTYwODI4Nzc3NTUwNi52dHQ=_0.webvtt' for reading
[tcp @ 0x55c8ad2c3280] Starting connection attempt to 213.132.98.195 port 443
[tcp @ 0x55c8ad2c3280] Successfully connected to 213.132.98.195 port 443
[hls @ 0x55c8acfef3c0] HLS request for url 'https://ef3d709f657e5d20b2d142c51a026680-httpcache0-90107-cacheod0.dna.ip-only.net/90107-cacheod0/_definst_/smil:assets/d8/d8ab4607-00090107/EM_HT20_117_roslund_v2.mp4_swe_1611826609386/subtitlechunk_lswe_b2496000_cfYXNzZXRzL2Q4L2Q4YWI0NjA3LTAwMDkwMTA3LzkwMTA3MTYwODI4Nzc3NTUwNi52dHQ=_25.webvtt', offset 0, playlist 0
[hls @ 0x55c8acfef3c0] Opening 'https://ef3d709f657e5d20b2d142c51a026680-httpcache0-90107-cacheod0.dna.ip-only.net/90107-cacheod0/_definst_/smil:assets/d8/d8ab4607-00090107/EM_HT20_117_roslund_v2.mp4_swe_1611826609386/subtitlechunk_lswe_b2496000_cfYXNzZXRzL2Q4L2Q4YWI0NjA3LTAwMDkwMTA3LzkwMTA3MTYwODI4Nzc3NTUwNi52dHQ=_25.webvtt' for reading
[tcp @ 0x55c8ad2e0840] Starting connection attempt to 213.132.98.195 port 443
[tcp @ 0x55c8ad2e0840] Successfully connected to 213.132.98.195 port 443
[hls @ 0x55c8acfef3c0] HLS request for url 'https://ef3d709f657e5d20b2d142c51a026680-httpcache0-90107-cacheod0.dna.ip-only.net/90107-cacheod0/_definst_/smil:assets/d8/d8ab4607-00090107/EM_HT20_117_roslund_v2.mp4_swe_1611826609386/subtitlechunk_lswe_b2496000_cfYXNzZXRzL2Q4L2Q4YWI0NjA3LTAwMDkwMTA3LzkwMTA3MTYwODI4Nzc3NTUwNi52dHQ=_50.webvtt', offset 0, playlist 0
[https @ 0x55c8ad2bb680] Opening 'https://ef3d709f657e5d20b2d142c51a026680-httpcache0-90107-cacheod0.dna.ip-only.net/90107-cacheod0/_definst_/smil:assets/d8/d8ab4607-00090107/EM_HT20_117_roslund_v2.mp4_swe_1611826609386/subtitlechunk_lswe_b2496000_cfYXNzZXRzL2Q4L2Q4YWI0NjA3LTAwMDkwMTA3LzkwMTA3MTYwODI4Nzc3NTUwNi52dHQ=_50.webvtt' for reading
[hls @ 0x55c8acfef3c0] HLS request for url 'https://ef3d709f657e5d20b2d142c51a026680-httpcache0-90107-cacheod0.dna.ip-only.net/90107-cacheod0/_definst_/smil:assets/d8/d8ab4607-00090107/EM_HT20_117_roslund_v2.mp4_swe_1611826609386/subtitlechunk_lswe_b2496000_cfYXNzZXRzL2Q4L2Q4YWI0NjA3LTAwMDkwMTA3LzkwMTA3MTYwODI4Nzc3NTUwNi52dHQ=_75.webvtt', offset 0, playlist 0
[https @ 0x55c8ad2e69c0] Opening 'https://ef3d709f657e5d20b2d142c51a026680-httpcache0-90107-cacheod0.dna.ip-only.net/90107-cacheod0/_definst_/smil:assets/d8/d8ab4607-00090107/EM_HT20_117_roslund_v2.mp4_swe_1611826609386/subtitlechunk_lswe_b2496000_cfYXNzZXRzL2Q4L2Q4YWI0NjA3LTAwMDkwMTA3LzkwMTA3MTYwODI4Nzc3NTUwNi52dHQ=_75.webvtt' for reading
[hls @ 0x55c8acfef3c0] HLS request for url 'https://ef3d709f657e5d20b2d142c51a026680-httpcache0-90107-cacheod0.dna.ip-only.net/90107-cacheod0/_definst_/smil:assets/d8/d8ab4607-00090107/EM_HT20_117_roslund_v2.mp4_swe_1611826609386/subtitlechunk_lswe_b2496000_cfYXNzZXRzL2Q4L2Q4YWI0NjA3LTAwMDkwMTA3LzkwMTA3MTYwODI4Nzc3NTUwNi52dHQ=_100.webvtt', offset 0, playlist 0
[https @ 0x55c8ad2bb680] Opening 'https://ef3d709f657e5d20b2d142c51a026680-httpcache0-90107-cacheod0.dna.ip-only.net/90107-cacheod0/_definst_/smil:assets/d8/d8ab4607-00090107/EM_HT20_117_roslund_v2.mp4_swe_1611826609386/subtitlechunk_lswe_b2496000_cfYXNzZXRzL2Q4L2Q4YWI0NjA3LTAwMDkwMTA3LzkwMTA3MTYwODI4Nzc3NTUwNi52dHQ=_100.webvtt' for reading
[hls @ 0x55c8acfef3c0] HLS request for url 'https://ef3d709f657e5d20b2d142c51a026680-httpcache0-90107-cacheod0.dna.ip-only.net/90107-cacheod0/_definst_/smil:assets/d8/d8ab4607-00090107/EM_HT20_117_roslund_v2.mp4_swe_1611826609386/subtitlechunk_lswe_b2496000_cfYXNzZXRzL2Q4L2Q4YWI0NjA3LTAwMDkwMTA3LzkwMTA3MTYwODI4Nzc3NTUwNi52dHQ=_125.webvtt', offset 0, playlist 0
[https @ 0x55c8ad2e69c0] Opening 'https://ef3d709f657e5d20b2d142c51a026680-httpcache0-90107-cacheod0.dna.ip-only.net/90107-cacheod0/_definst_/smil:assets/d8/d8ab4607-00090107/EM_HT20_117_roslund_v2.mp4_swe_1611826609386/subtitlechunk_lswe_b2496000_cfYXNzZXRzL2Q4L2Q4YWI0NjA3LTAwMDkwMTA3LzkwMTA3MTYwODI4Nzc3NTUwNi52dHQ=_125.webvtt' for reading
Input #0, hls, from 'https://ef3d709f657e5d20b2d142c51a026680-httpcache0-90107-cacheod0.dna.ip-only.net/90107-cacheod0/_definst_/smil:assets/d8/d8ab4607-00090107/EM_HT20_117_roslund_v2.mp4_swe_1611826609386/subtitlelist_lswe_b2496000_cfYXNzZXRzL2Q4L2Q4YWI0NjA3LTAwMDkwMTA3LzkwMTA3MTYwODI4Nzc3NTUwNi52dHQ=.m3u8':
  Duration: 00:23:49.12, bitrate: 0 kb/s
  Program 0 
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Subtitle: webvtt
    Metadata:
      variant_bitrate : 0
Output #0, mp4, to 'file:playlist [playlist].swe.vtt.part':
Output file #0 does not contain any stream
[AVIOContext @ 0x55c8ad5d4e40] Statistics: 13328 bytes read, 0 seeks
[AVIOContext @ 0x55c8ad2eae40] Statistics: 14717 bytes read, 0 seeks
[AVIOContext @ 0x55c8ad2c61c0] Statistics: 836 bytes read, 0 seeks


ERROR: ffmpeg exited with code 1
  File "../bin/yt-dlp", line 8, in <module>
    sys.exit(main())
  File "python3.10/site-packages/yt_dlp/__init__.py", line 966, in main
    _exit(*variadic(_real_main(argv)))
  File "python3.10/site-packages/yt_dlp/__init__.py", line 958, in _real_main
    return ydl.download(all_urls)
  File "python3.10/site-packages/yt_dlp/YoutubeDL.py", line 3318, in download
    self.__download_wrapper(self.extract_info)(
  File "python3.10/site-packages/yt_dlp/YoutubeDL.py", line 3293, in wrapper
    res = func(*args, **kwargs)
  File "python3.10/site-packages/yt_dlp/YoutubeDL.py", line 1466, in extract_info
    return self.__extract_info(url, self.get_info_extractor(key), download, extra_info, process)
  File "python3.10/site-packages/yt_dlp/YoutubeDL.py", line 1477, in wrapper
    return func(self, *args, **kwargs)
  File "python3.10/site-packages/yt_dlp/YoutubeDL.py", line 1574, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "python3.10/site-packages/yt_dlp/YoutubeDL.py", line 1632, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "python3.10/site-packages/yt_dlp/YoutubeDL.py", line 2733, in process_video_result
    self.process_info(new_info)
  File "python3.10/site-packages/yt_dlp/YoutubeDL.py", line 2979, in process_info
    sub_files = self._write_subtitles(info_dict, temp_filename)
  File "python3.10/site-packages/yt_dlp/YoutubeDL.py", line 3936, in _write_subtitles
    self.dl(sub_filename, sub_copy, subtitle=True)
  File "python3.10/site-packages/yt_dlp/YoutubeDL.py", line 2920, in dl
    return fd.download(name, new_info, subtitle)
  File "python3.10/site-packages/yt_dlp/downloader/common.py", line 446, in download
    ret = self.real_download(filename, info_dict)
  File "python3.10/site-packages/yt_dlp/downloader/external.py", line 73, in real_download
    self.report_error('%s exited with code %d' % (
  File "python3.10/site-packages/yt_dlp/YoutubeDL.py", line 996, in report_error
    self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}', *args, **kwargs)
  File "python3.10/site-packages/yt_dlp/YoutubeDL.py", line 925, in trouble
    tb_data = traceback.format_list(traceback.extract_stack())
```