Repository: yt-dlp
Issue: Change extension of metadata files
Labels: enhancement

### 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'm running yt-dlp version **2023.10.13** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [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

As the title ~~says~~ said ("no way to write to extension-less thumbnails"), there doesn't seem to be a way to write thumbnails to a file without an extension (or with the "wrong" extension). Ultimately, I care about this because I want to write a thumbnail to `/dev/stdout` and do nothing else. 

using the syntax I would expect:

```
⎛/tmp                                                                                                                                                                     
⎝$ yt-dlp -vU --write-thumbnail -f none --ignore-no-formats-error -o /dev/stdout https://www.youtube.com/watch\?v\=XwoFTcpI2ME                                            
[debug] Command-line config: ['-vU', '--write-thumbnail', '-f', 'none', '--ignore-no-formats-error', '-o', '/dev/stdout', 'https://www.youtube.com/watch?v=XwoFTcpI2ME']  
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8                                             
[debug] yt-dlp version stable@2023.10.13 [b634ba742]                                                                                    
[debug] Python 3.11.5 (CPython x86_64 64bit) - Linux-6.1.60-1-lts-x86_64-with-glibc2.38 (OpenSSL 3.1.4 24 Oct 2023, glibc 2.38)         
[debug] exe versions: ffmpeg 6.0 (setts), ffprobe 6.0, rtmpdump 2.4                                                                     
[debug] Optional libraries: Cryptodome-3.12.0, brotlicffi-1.1.0.0, certifi-2023.07.22, sqlite3-3.43.2                                   
[debug] Proxy map: {}                                                                                                                   
[debug] Loaded 1890 extractors                                                                                                          
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest                                               
Available version: stable@2023.10.13, Current version: stable@2023.10.13                                                                
yt-dlp is up to date (stable@2023.10.13)                                                                                                                                  
[youtube] Extracting URL: https://www.youtube.com/watch?v=XwoFTcpI2ME                                                                   
[youtube] XwoFTcpI2ME: Downloading webpage                                                                       
[youtube] XwoFTcpI2ME: Downloading ios player API JSON                                                           
[youtube] XwoFTcpI2ME: Downloading android player API JSON                                                       
[youtube] XwoFTcpI2ME: 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                                                           
WARNING: Requested format is not available                                                                       
[info] Downloading video thumbnail 41 ...                                                                        
[info] Writing video thumbnail 41 to: /dev/stdout.webp                                                           
ERROR: [Errno 13] Permission denied: '/dev/stdout.webp'                                                          
Traceback (most recent call last):                                                                               
  File "/usr/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1567, in wrapper                                                                                                                                              
    return func(self, *args, **kwargs)                                                                           
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                           
  File "/usr/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1723, in __extract_info                                                                                                                                       
    return self.process_ie_result(ie_result, download, extra_info)                                               
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                               
  File "/usr/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 1782, in process_ie_result                                                                                                                                    
    ie_result = self.process_video_result(ie_result, download=download)                                                                                                                                                            
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                            
  File "/usr/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 2921, in process_video_result                                                                                                                                 
    self.process_info(new_info)                         
  File "/usr/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 3180, in process_info                                                                                                                                         
    thumb_files = self._write_thumbnails(                                                                        
                  ^^^^^^^^^^^^^^^^^^^^^^^                                                                        
  File "/usr/lib/python3.11/site-packages/yt_dlp/YoutubeDL.py", line 4260, in _write_thumbnails                                                                                                                                    
    with open(encodeFilename(thumb_filename), 'wb') as thumbf:                                                   
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                              
PermissionError: [Errno 13] Permission denied: '/dev/stdout.webp'                                                

exit 1                                                  
```

As you can see, it tries to outsmart the user by attempting to write to `/dev/stdout.webp` instead of `/dev/stdout`,  disobeying what's explicitly specified in the `-o` option. 

Inconsistently, `-o foo.png` results in a write to `foo.webp` instead of `foo.png.webp`,  `-o foo.webp` writes to `foo.webp` rather than `foo.webp.webp`, and `-o -` writes to `-.webp` rather than `/dev/stdout`. Of these four different behaviors, only the third one is briefly mentioned in the man page or README, simply stating : 

> The simplest usage of -o is not to set any template arguments when downloading a single file, like in yt-dlp -o funny_video.flv "https://some/video" (hard-coding file extension like this is not recommended and could break some post-processing).

The inconvenience/inconsistency of this behavior is arguably less important/serious than the fact that it's undocumented behavior. The documentation makes it sound like `-o foo` would write to `foo` and `-o foo.%(ext)s` would write to `foo.webp` (or whatever the extension may be). IMHO, this is how yt-dlp *should* behave. It *should* do exactly what the user specifies in `-o` without trying to second-guess us. 

This is similar to #3106, but not a duplicate. (I suspect @pukkandan 's diagnosis was a bit off there, since this output behavior seems to impact video outputs too.) 

### 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

_No response_