Repository: yt-dlp
Issue: Can you add an option to not only remux but transcode if the target container doesn't support the current format?
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 requesting a feature unrelated to a specific site
- [X] I've looked through the [README](https://github.com/yt-dlp/yt-dlp#readme)
- [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 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

```
yt-dlp -vU --merge-output-format mov "https://www.youtube.com/watch?v=PorfLSr3DDI&pp=ygULY3BwIGNvbiBnZGI%3D"
[mov @ 0x7f961a705fc0] vp9 only supported in MP4.
```
Can you add an option to not only remux but transcode if the target container doesn't support the current format?

### 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] 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', '--merge-output-format', 'mov', 'https://www.youtube.com/watch?v=PorfLSr3DDI&pp=ygULY3BwIGNvbiBnZGI%3D']
[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 stable@2024.07.09 from yt-dlp/yt-dlp [7ead7332a] (pip)
[debug] Python 3.12.4 (CPython x86_64 64bit) - macOS-14.5-x86_64-i386-64bit (OpenSSL 3.3.1 4 Jun 2024)
[debug] exe versions: ffmpeg 7.0.1 (setts), ffprobe 7.0.1, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.07.04, mutagen-1.47.0, requests-2.32.3, sqlite3-3.46.0, urllib3-2.2.2, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Loaded 1834 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
[debug] Downloading _update_spec from https://github.com/yt-dlp/yt-dlp/releases/latest/download/_update_spec
Current version: stable@2024.07.09 from yt-dlp/yt-dlp
Latest version: stable@2024.07.16 from yt-dlp/yt-dlp
ERROR: You installed yt-dlp with pip or using the wheel from PyPi; Use that to update
[youtube] Extracting URL: https://www.youtube.com/watch?v=PorfLSr3DDI&pp=ygULY3BwIGNvbiBnZGI%3D
[youtube] PorfLSr3DDI: Downloading webpage
[youtube] PorfLSr3DDI: Downloading ios player API JSON
[youtube] PorfLSr3DDI: Downloading player d60b0ef9
[debug] Saving youtube-nsig.d60b0ef9 to cache
[debug] [youtube] Decrypted nsig 2x4BhYI6aWIcaR5Q => OvOFku7bHADBIQ
[debug] Loading youtube-nsig.d60b0ef9 from cache
[debug] [youtube] Decrypted nsig Roy6tDfqsovS8axq => X9oQP2vlOxOI6A
[youtube] PorfLSr3DDI: Downloading m3u8 information
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, size, br, asr, vext, aext, hasaud, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] PorfLSr3DDI: Downloading 1 format(s): 248+251
[debug] Invoking http downloader on "https://rr4---sn-25glenld.googlevideo.com/videoplayback?expire=1721316328&ei=iN-YZvz1GYmHhcIPt_OAkAk&ip=2a01%3Acb00%3Ab1d%3A1400%3A9903%3A61fe%3Aaada%3A9107&id=o-AFhcokix9ALF3O0H09e4SHdX9yt5T70iAzwaRng2CQUC&itag=248&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278%2C394%2C395%2C396%2C397%2C398%2C399&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&mh=__&mm=31%2C26&mn=sn-25glenld%2Csn-4g5e6nzl&ms=au%2Conr&mv=m&mvi=4&pl=43&initcwndbps=1727500&bui=AXc671LXQpI7_1nBQosZu0NEqLgy-3QMXDfH5Udi7co10Na2TObNfJF1pZ53U8Mv5be3fgFTyJ2xclL7&spc=NO7bAdBg7SN1hVp9GOLpP3PNCa-Et6sZsoPvxB7FiyOtRF0_Js4D7jRXlvI9&vprv=1&svpuc=1&mime=video%2Fwebm&ns=6HTbdWTRMc3udzxbeUkROvEQ&rqh=1&gir=yes&clen=128486702&dur=886.052&lmt=1445417381187105&mt=1721294465&fvip=4&keepalive=yes&c=WEB&sefc=1&n=X9oQP2vlOxOI6A&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cxpc%2Cbui%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Crqh%2Cgir%2Cclen%2Cdur%2Clmt&sig=AJfQdSswRAIgMPB_bOdYrBV_9N_FaeqsB_v_SxLPnvjNJRehIU6ZZ0YCIEfqMPDL_jmiuAOZEvnVWGDFSI_WNmYVPrVh-MnADFR4&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHlkHjAwRgIhAJ2VN_bLKPNIE2hWagk4QdswCzuihIV7dV3ETtGXun3KAiEAu7Rw5qw10GuJ462TBIlNRGMmvr1xJM1Jzhl5jZO16UU%3D"
[download] CppCon 2015： Greg Law ＂ Give me 15 minutes & I'll change your view of GDB＂ [PorfLSr3DDI].f248.webm has already been downloaded

[download] 100% of  122.53MiB
[debug] Invoking http downloader on "https://rr4---sn-25glenld.googlevideo.com/videoplayback?expire=1721316328&ei=iN-YZvz1GYmHhcIPt_OAkAk&ip=2a01%3Acb00%3Ab1d%3A1400%3A9903%3A61fe%3Aaada%3A9107&id=o-AFhcokix9ALF3O0H09e4SHdX9yt5T70iAzwaRng2CQUC&itag=251&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&mh=__&mm=31%2C26&mn=sn-25glenld%2Csn-4g5e6nzl&ms=au%2Conr&mv=m&mvi=4&pl=43&initcwndbps=1727500&bui=AXc671LXQpI7_1nBQosZu0NEqLgy-3QMXDfH5Udi7co10Na2TObNfJF1pZ53U8Mv5be3fgFTyJ2xclL7&spc=NO7bAdBg7SN1hVp9GOLpP3PNCa-Et6sZsoPvxB7FiyOtRF0_Js4D7jRXlvI9&vprv=1&svpuc=1&mime=audio%2Fwebm&ns=6HTbdWTRMc3udzxbeUkROvEQ&rqh=1&gir=yes&clen=13017178&dur=886.101&lmt=1445417007612292&mt=1721294465&fvip=4&keepalive=yes&c=WEB&sefc=1&n=X9oQP2vlOxOI6A&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cxpc%2Cbui%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Crqh%2Cgir%2Cclen%2Cdur%2Clmt&sig=AJfQdSswRQIhAJT-DJeqHSbWsPyIFym-AkhXtuZq8xjdWEJlPieoAucGAiAc6z0QxEB4A-Jr-dSPUSVGBM5cdRHbwXZ2E62DjX1keA%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHlkHjAwRgIhAJ2VN_bLKPNIE2hWagk4QdswCzuihIV7dV3ETtGXun3KAiEAu7Rw5qw10GuJ462TBIlNRGMmvr1xJM1Jzhl5jZO16UU%3D"
[download] CppCon 2015： Greg Law ＂ Give me 15 minutes & I'll change your view of GDB＂ [PorfLSr3DDI].f251.webm has already been downloaded

[download] 100% of   12.41MiB
[Merger] Merging formats into "CppCon 2015： Greg Law ＂ Give me 15 minutes & I'll change your view of GDB＂ [PorfLSr3DDI].mov"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:CppCon 2015： Greg Law ＂ Give me 15 minutes & I'"'"'ll change your view of GDB＂ [PorfLSr3DDI].f248.webm' -i 'file:CppCon 2015： Greg Law ＂ Give me 15 minutes & I'"'"'ll change your view of GDB＂ [PorfLSr3DDI].f251.webm' -c copy -map 0:v:0 -map 1:a:0 -movflags +faststart 'file:CppCon 2015： Greg Law ＂ Give me 15 minutes & I'"'"'ll change your view of GDB＂ [PorfLSr3DDI].temp.mov'
[debug] ffmpeg version 7.0.1 Copyright (c) 2000-2024 the FFmpeg developers
  built with Apple clang version 15.0.0 (clang-1500.3.9.4)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/7.0.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
Input #0, matroska,webm, from 'file:CppCon 2015： Greg Law ＂ Give me 15 minutes & I'll change your view of GDB＂ [PorfLSr3DDI].f248.webm':
  Metadata:
    encoder         : google
  Duration: 00:14:46.05, start: 0.000000, bitrate: 1160 kb/s
  Stream #0:0(eng): Video: vp9 (Profile 0), yuv420p(tv), 1920x1080, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 1k tbn (default)
Input #1, matroska,webm, from 'file:CppCon 2015： Greg Law ＂ Give me 15 minutes & I'll change your view of GDB＂ [PorfLSr3DDI].f251.webm':
  Metadata:
    encoder         : google
  Duration: 00:14:46.10, start: -0.007000, bitrate: 117 kb/s
  Stream #1:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
[mov @ 0x7fd507209040] vp9 only supported in MP4.
[out#0/mov @ 0x7fd507208cc0] Could not write header (incorrect codec parameters ?): Invalid argument
Conversion failed!

ERROR: Postprocessing: Conversion failed!
Traceback (most recent call last):
  File "/usr/local/Cellar/yt-dlp/2024.7.9/libexec/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 3556, in process_info
    replace_info_dict(self.post_process(dl_filename, info_dict, files_to_move))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/yt-dlp/2024.7.9/libexec/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 3738, in post_process
    info = self.run_all_pps('post_process', info, additional_pps=info.get('__postprocessors'))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/yt-dlp/2024.7.9/libexec/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 3720, in run_all_pps
    info = self.run_pp(pp, info)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/yt-dlp/2024.7.9/libexec/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 3698, in run_pp
    files_to_delete, infodict = pp.run(infodict)
                                ^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/yt-dlp/2024.7.9/libexec/lib/python3.12/site-packages/yt_dlp/postprocessor/common.py", line 23, in run
    ret = func(self, info, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/yt-dlp/2024.7.9/libexec/lib/python3.12/site-packages/yt_dlp/postprocessor/common.py", line 128, in wrapper
    return func(self, info)
           ^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/yt-dlp/2024.7.9/libexec/lib/python3.12/site-packages/yt_dlp/postprocessor/ffmpeg.py", line 840, in run
    self.run_ffmpeg_multiple_files(info['__files_to_merge'], temp_filename, args)
  File "/usr/local/Cellar/yt-dlp/2024.7.9/libexec/lib/python3.12/site-packages/yt_dlp/postprocessor/ffmpeg.py", line 330, in run_ffmpeg_multiple_files
    return self.real_run_ffmpeg(
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/yt-dlp/2024.7.9/libexec/lib/python3.12/site-packages/yt_dlp/postprocessor/ffmpeg.py", line 368, in real_run_ffmpeg
    raise FFmpegPostProcessorError(stderr.strip().splitlines()[-1])
yt_dlp.postprocessor.ffmpeg.FFmpegPostProcessorError: Conversion failed!
```