Repository: yt-dlp
Issue: Check for existing attachment before embedding (subtitles, thumbnail)
Labels: enhancement,PR-needed,core:post-processor

### Checklist

- [X] I'm reporting a bug unrelated to a specific site
- [X] I've verified that I'm running yt-dlp version **2022.03.08.1**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
- [X] I've checked that all provided URLs are alive and playable in a browser
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/ytdl-org/youtube-dl#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)

### Description

`yt-dlp -vU 'https://www.youtube.com/watch?v=Ofge6a3gGis' --ignore-config --embed-thumbnail`

1- Run the above command
2- Verify that that the downloaded video file has an embedded thumbnail
3- Run the command again, and observe that the thumbnail is being downloaded again, and re-embedded into the video file

Expected behaviour: If a video file already has an embedded thumbnail, yt-dlp should not try to embed a new thumbnail.

Why is the current behaviour undesirable:
1- Downloading an unneeded thumbnail causes unnecessary network traffic
2- It re-writes files unnecessarily, updating the file's ctime
3- It re-writes files unnecessarily, changing the file's hash/checksum
4- It re-writes files unnecessarily, introducing opportunities for file corruption

If the requested audio/video file has previously been downloaded, there should be a "sanity check" for the presence of an embedded thumbnail, before a thumbnail is downloaded and re-written to the file.


### Verbose log

```shell
[debug] Command-line config: ['-vU', 'https://www.youtube.com/watch?v=Ofge6a3gGis', '--ignore-config', '--embed-thumbnail']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, err utf-8, pref UTF-8
[debug] yt-dlp version 2022.03.08.1 [c0c2c57d3] (zip)
[debug] Python version 3.8.10 (CPython 64bit) - Linux-5.4.0-105-generic-x86_64-with-glibc2.29
[debug] exe versions: ffmpeg 4.2.4, ffprobe 4.2.4, phantomjs 2.1.1, rtmpdump 2.4
[debug] Optional libraries: Crypto, secretstorage, mutagen, sqlite
[debug] Proxy map: {}
Latest version: 2022.03.08.1, Current version: 2022.03.08.1
yt-dlp is up to date (2022.03.08.1)
[debug] [youtube] Extracting URL: https://www.youtube.com/watch?v=Ofge6a3gGis
[youtube] Ofge6a3gGis: Downloading webpage
[youtube] Ofge6a3gGis: Downloading android player API JSON
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, codec:vp9.2, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), acodec, lang, proto, filesize, fs_approx, tbr, vbr, abr, asr, vext, aext, hasaud, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] Ofge6a3gGis: Downloading 1 format(s): 244+251
[info] Downloading video thumbnail 41 ...
WARNING: Unable to download video thumbnail 41: HTTP Error 404: Not Found
[info] Downloading video thumbnail 40 ...
WARNING: Unable to download video thumbnail 40: HTTP Error 404: Not Found
[info] Downloading video thumbnail 39 ...
WARNING: Unable to download video thumbnail 39: HTTP Error 404: Not Found
[info] Downloading video thumbnail 38 ...
WARNING: Unable to download video thumbnail 38: HTTP Error 404: Not Found
[info] Downloading video thumbnail 37 ...
[info] Writing video thumbnail 37 to: The funniest kitten in the world [Ofge6a3gGis].webp
WARNING: webm doesn't support embedding a thumbnail, mkv will be used
[download] The funniest kitten in the world [Ofge6a3gGis].mkv has already been downloaded
[ThumbnailsConvertor] Converting thumbnail "The funniest kitten in the world [Ofge6a3gGis].webp" to png
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -f image2 -pattern_type none -i 'file:The funniest kitten in the world [Ofge6a3gGis].webp' -movflags +faststart 'file:The funniest kitten in the world [Ofge6a3gGis].png'
[debug] ffprobe command line: ffprobe -hide_banner -show_format -show_streams -print_format json 'file:The funniest kitten in the world [Ofge6a3gGis].mkv'
[EmbedThumbnail] ffmpeg: Adding thumbnail to "The funniest kitten in the world [Ofge6a3gGis].mkv"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:The funniest kitten in the world [Ofge6a3gGis].mkv' -map 0 -dn -ignore_unknown -c copy -map -0:2 -attach 'The funniest kitten in the world [Ofge6a3gGis].png' -metadata:s:2 mimetype=image/png -metadata:s:2 filename=cover.png -movflags +faststart 'file:The funniest kitten in the world [Ofge6a3gGis].temp.mkv'
Deleting original file The funniest kitten in the world [Ofge6a3gGis].webp (pass -k to keep)
Deleting original file The funniest kitten in the world [Ofge6a3gGis].png (pass -k to keep)
```