Repository: yt-dlp
Issue: --embed-info-json will not remux to a compatible format
Labels: enhancement,triage,core:post-processor

### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

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

### Checklist

- [X] I'm reporting a bug unrelated to a specific site
- [X] I've verified that I have **updated yt-dlp to nightly or master** ([update instructions](https://github.com/yt-dlp/yt-dlp#update-channels))
- [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 [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and 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

The `--embed-info-json` parameter will simply not perform its intended function if the video is not automatically remuxed for some other reason (`--remux-video` or `--embed-thumbnail` auto-upgrading to a more flexible container, etc.).

IMO the best fix would be to copy the behavior of `--embed-thumbnail`, which gives a message like:
```
WARNING: webm doesn't support embedding a thumbnail, mkv will be used
```
when the container is not compatible with the parameters provided, & then changes the container to something which is compatible.

The `--embed-info-json` behavior is quite explicitly the opposite of this; it simply does not do its job if the container is not Matroska:
```
[Metadata] The info-json can only be attached to mkv/mka files
```
That's great info & all, but ideally instead of just warning you, it would respond to that by changing the container to Matroska so it can do the thing it's meant to do.

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [ ] If using API, add `'verbose': True` to `YoutubeDL` params instead
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['-vU', '-i', 'https://www.twitch.tv/videos/2015520063']
[debug] User config "/home/sfundt/.config/yt-dlp/config": ['--embed-metadata', '--embed-chapters', '--embed-info-json', '--embed-subs', '--embed-thumbnail', '--sponsorblock-mark', 'all']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version local@2023.12.28 [225cf2b83]
[debug] Python 3.11.4 (CPython x86_64 64bit) - Linux-6.5.11-ns-vtn-msf17-x86_64-Intel-R-_Xeon-R-_CPU_E5-2420_0_@_1.90GHz-with-libc (OpenSSL 1.1.1u  30 May 2023, libc)
[debug] exe versions: ffmpeg present (needs_adtstoasc,setts), ffprobe present
[debug] Optional libraries: brotli-1.0.9, certifi-3021.03.16, mutagen-1.46.0, pycrypto-3.18.0, requests-2.31.0, sqlite3-3.40.1, urllib3-2.0.3
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests
[debug] Loaded 1798 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: stable@2023.11.16 from yt-dlp/yt-dlp
yt-dlp is up to date (local@2023.12.28)
[twitch:vod] Extracting URL: https://www.twitch.tv/videos/2015520063
[twitch:vod] 2015520063: Downloading stream metadata GraphQL
[twitch:vod] 2015520063: Downloading video access token GraphQL
[twitch:vod] 2015520063: Downloading m3u8 information
[twitch:vod] 2015520063: Downloading storyboard metadata JSON
[info] v2015520063: Downloading subtitles: rechat
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[SponsorBlock] SponsorBlock is not supported for TwitchVod
[debug] Default format spec: bestvideo*+bestaudio/best
[info] v2015520063: Downloading 1 format(s): 360p-1
[info] Writing video subtitles to: Wanderlust-v2015520063.rechat.json
[debug] Invoking http downloader on "https://api.twitch.tv/v5/videos/2015520063/comments?client_id=ue6666qo983tsx6so1t0vnawi233wa"
WARNING: Unable to download video subtitles for 'rechat': HTTP Error 410: Gone
[info] Downloading video thumbnail 1 ...
[info] Writing video thumbnail 1 to: Wanderlust-v2015520063.jpg
[debug] Invoking hlsnative downloader on "https://d1ymi26ma8va5x.cloudfront.net/e700afa0115aa959ac57_yggdrasiface_41596675608_1703718209/chunked/index-dvr.m3u8"
[download] Wanderlust-v2015520063.mp4 has already been downloaded
[download] 100% of    1.29GiB
WARNING: Skipping embedding rechat subtitle because the file is missing
[debug] ffprobe command line: ffprobe -hide_banner -show_format -show_streams -print_format json file:Wanderlust-v2015520063.mp4
[Metadata] The info-json can only be attached to mkv/mka files
[Metadata] Adding metadata to "Wanderlust-v2015520063.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i file:Wanderlust-v2015520063.mp4 -i file:Wanderlust-v2015520063.meta -map 0 -dn -ignore_unknown -c copy -map_metadata 1 -write_id3v1 1 -metadata title=Wanderlust -metadata date=20231227 -metadata purl=https://www.twitch.tv/videos/2015520063 -metadata comment=https://www.twitch.tv/videos/2015520063 -metadata artist=Yggdrasiface -movflags +faststart file:Wanderlust-v2015520063.temp.mp4
[EmbedThumbnail] mutagen: Adding thumbnail to "Wanderlust-v2015520063.mp4"
```