Repository: yt-dlp
Issue: `--add-metadata` fails on unknown video extensions.
Labels: enhancement,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 that a **supported** site is broken
- [X] I've verified that I'm running yt-dlp version **2023.03.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 [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)
- [ ] I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required

### Region

_No response_

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

`--add-metadata` doesn't work when downloading from [stiftung-imai.de](https://stiftung-imai.de/en/video/catalogue). This has to be caused by the video extensions just being derived from the numerical video IDs (filename example: `Schnittpunkte ｜ Stiftung imai (1) [1012-1].1012`), because the issue doesn't appear when the videos are downloaded as `mkv`.

### 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', '--ffmpeg-location', 'C:\\Program Files\\ffmpeg-master-latest-win64-gpl\\bin', '--add-metadata', 'https://stiftung-imai.de/en/videos/katalog/medium/1012']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8 (No VT), error utf-8 (No VT), screen utf-8 (No VT)
[debug] yt-dlp version stable@2023.03.04 [392389b7d] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-8.1-6.3.9600-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg N-109995-g358588c820-20230312 (setts), ffprobe N-109995-g358588c820-20230312
[debug] Optional libraries: Cryptodome-3.17, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1786 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.03.04, Current version: stable@2023.03.04
Current Build Hash: 5590c57bd0433ed239a2deaaf92e2ad6f37fe50f53664c821575cafe106a9421
yt-dlp is up to date (stable@2023.03.04)
[generic] Extracting URL: https://stiftung-imai.de/en/videos/katalog/medium/1012
[generic] 1012: Downloading webpage
WARNING: [generic] Falling back on generic information extractor
[generic] 1012: Extracting information
[debug] Looking for embeds
[debug] Identified a html5 embed
[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
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 1012-1: Downloading 1 format(s): 0
[debug] Invoking http downloader on "https://api.stiftung-imai.de/api/v1/vid/IMAI.W.1012"
[debug] File locking is not supported. Proceeding without locking
[download] Destination: Schnittpunkte | Stiftung imai (1) [1012-1].1012
[download] 100% of  111.16MiB in 00:00:16 at 6.58MiB/s
[Metadata] Adding metadata to "Schnittpunkte | Stiftung imai (1) [1012-1].1012"
[debug] ffmpeg command line: "C:\Program Files\ffmpeg-master-latest-win64-gpl\bin\ffmpeg" -y -loglevel "repeat+info" -i "file:Schnittpunkte | Stiftung imai (1) [1012-1].1012" -map 0 -dn -ignore_unknown -c copy -write_id3v1 1 -metadata "title=Schnittpunkte | Stiftung imai (1)" -metadata "purl=https://stiftung-imai.de/en/videos/katalog/medium/1012" -metadata "comment=https://stiftung-imai.de/en/videos/katalog/medium/1012" -movflags "+faststart" "file:Schnittpunkte | Stiftung imai (1) [1012-1].temp.1012"
[debug] ffmpeg version N-109995-g358588c820-20230312 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (crosstool-NG 1.25.0.90_cf9beb1)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags=
 --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20230312
  libavutil      58.  3.100 / 58.  3.100
  libavcodec     60.  6.101 / 60.  6.101
  libavformat    60.  4.100 / 60.  4.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  4.100 /  9.  4.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:Schnittpunkte | Stiftung imai (1) [1012-1].1012':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.76.100
  Duration: 00:13:44.96, start: 0.000000, bitrate: 1130 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 540x406, 995 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
[NULL @ 00000007a30a2780] Unable to find a suitable output format for 'file:Schnittpunkte | Stiftung imai (1) [1012-1].temp.1012'
file:Schnittpunkte | Stiftung imai (1) [1012-1].temp.1012: Invalid argument

ERROR: Postprocessing: file:Schnittpunkte | Stiftung imai (1) [1012-1].temp.1012: Invalid argument
Traceback (most recent call last):
  File "yt_dlp\YoutubeDL.py", line 3323, in process_info
  File "yt_dlp\YoutubeDL.py", line 3502, in post_process
  File "yt_dlp\YoutubeDL.py", line 3484, in run_all_pps
  File "yt_dlp\YoutubeDL.py", line 3462, in run_pp
  File "yt_dlp\postprocessor\common.py", line 24, in run
  File "yt_dlp\postprocessor\common.py", line 129, in wrapper
  File "yt_dlp\postprocessor\ffmpeg.py", line 705, in run
  File "yt_dlp\postprocessor\ffmpeg.py", line 324, in run_ffmpeg_multiple_files
  File "yt_dlp\postprocessor\ffmpeg.py", line 362, in real_run_ffmpeg
yt_dlp.postprocessor.ffmpeg.FFmpegPostProcessorError: file:Schnittpunkte | Stiftung imai (1) [1012-1].temp.1012: Invalid argument


# Downloading as mkv
[debug] Command-line config: ['-vU', '--ffmpeg-location', 'C:\\Program Files\\ffmpeg-master-latest-win64-gpl\\bin', '--add-metadata', '--parse-metadata', 'video: mkv: %(ext)s', 'https://stiftung-imai.de/en/videos/katalog/medium/1012']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8 (No VT), error utf-8 (No VT), screen utf-8 (No VT)
[debug] yt-dlp version stable@2023.03.04 [392389b7d] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-8.1-6.3.9600-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg N-109995-g358588c820-20230312 (setts), ffprobe N-109995-g358588c820-20230312
[debug] Optional libraries: Cryptodome-3.17, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1786 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.03.04, Current version: stable@2023.03.04
Current Build Hash: 5590c57bd0433ed239a2deaaf92e2ad6f37fe50f53664c821575cafe106a9421
yt-dlp is up to date (stable@2023.03.04)
[generic] Extracting URL: https://stiftung-imai.de/en/videos/katalog/medium/1012
[generic] 1012: Downloading webpage
WARNING: [generic] Falling back on generic information extractor
[generic] 1012: Extracting information
[debug] Looking for embeds
[debug] Identified a html5 embed
[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
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 1012-1: Downloading 1 format(s): 0
[debug] Searching for '\\ (?P<ext>.+)' in ' mkv'
[MetadataParser] Parsed ext from ' mkv': 'mkv'
[debug] Invoking http downloader on "https://api.stiftung-imai.de/api/v1/vid/IMAI.W.1012"
[debug] File locking is not supported. Proceeding without locking
[download] Destination: Schnittpunkte | Stiftung imai (1) [1012-1].mkv
[download] 100% of  111.16MiB in 00:00:16 at 6.60MiB/s
[Metadata] Adding metadata to "Schnittpunkte | Stiftung imai (1) [1012-1].mkv"
[debug] ffmpeg command line: "C:\Program Files\ffmpeg-master-latest-win64-gpl\bin\ffmpeg" -y -loglevel "repeat+info" -i "file:Schnittpunkte | Stiftung imai (1) [1012-1].mkv" -map 0 -dn -ignore_unknown -c copy -write_id3v1 1 -metadata "title=Schnittpunkte | Stiftung imai (1)" -metadata "purl=https://stiftung-imai.de/en/videos/katalog/medium/1012" -metadata "comment=https://stiftung-imai.de/en/videos/katalog/medium/1012" -movflags "+faststart" "file:Schnittpunkte | Stiftung imai (1) [1012-1].temp.mkv"
```