mirror of
https://github.com/alexta69/metube.git
synced 2026-09-21 13:35:01 +00:00
Cookbook: scope the metadata recipe to video, document what MeTube already sets
The Embed metadata recipe sets writethumbnail, which suppresses MeTube's own audio thumbnail chain (ExtractAudio -> ThumbnailsConvertor -> Metadata -> EmbedThumbnail): the guard tests whether the key is present rather than its value, so 'true' disables the chain exactly as 'false' would. Following the recipe on an audio download therefore produced worse results than no configuration at all, and reintroduced the failure that #188 was fixed for (issue #811 was closed against yt-dlp on that basis). Adds a 'What MeTube already sets for you' section and a cli_to_api.py note warning against pasting converter output wholesale, with the #589 square-cropped cover as the worked example.
+81
-1
@@ -9,7 +9,7 @@ Embeds English subtitles and chapter markers (for videos that have them), change
|
|||||||
- 'YTDL_OPTIONS={"writesubtitles":true,"subtitleslangs":["en","-live_chat"],"updatetime":false,"postprocessors":[{"key":"Exec","exec_cmd":"chmod 0664","when":"after_move"},{"key":"FFmpegEmbedSubtitle","already_have_subtitle":false},{"key":"FFmpegMetadata","add_chapters":true}]}'
|
- 'YTDL_OPTIONS={"writesubtitles":true,"subtitleslangs":["en","-live_chat"],"updatetime":false,"postprocessors":[{"key":"Exec","exec_cmd":"chmod 0664","when":"after_move"},{"key":"FFmpegEmbedSubtitle","already_have_subtitle":false},{"key":"FFmpegMetadata","add_chapters":true}]}'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Embed metadata
|
### Embed metadata and a cover image in **video** downloads
|
||||||
|
|
||||||
Contributed by [@PikuZheng](https://github.com/PikuZheng).
|
Contributed by [@PikuZheng](https://github.com/PikuZheng).
|
||||||
|
|
||||||
@@ -20,6 +20,12 @@ NOTE: May cause errors for non-Youtube videos.
|
|||||||
- 'YTDL_OPTIONS={ "ignoreerrors":true, "writethumbnail":true, "postprocessors":[ {"key":"FFmpegMetadata","add_metadata":true,"add_chapters":true,"add_infojson":"if_exists"}, {"key":"EmbedThumbnail"}]}'
|
- 'YTDL_OPTIONS={ "ignoreerrors":true, "writethumbnail":true, "postprocessors":[ {"key":"FFmpegMetadata","add_metadata":true,"add_chapters":true,"add_infojson":"if_exists"}, {"key":"EmbedThumbnail"}]}'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> ⚠️ **Do not apply this to audio downloads.** Picking Audio in the UI already
|
||||||
|
> embeds a cover image, and the `writethumbnail` above *switches that off* — see
|
||||||
|
> [What MeTube already sets for you](#what-metube-already-sets-for-you). To use
|
||||||
|
> this for video only, define it as a named preset via `YTDL_OPTIONS_PRESETS`
|
||||||
|
> instead of setting it globally.
|
||||||
|
|
||||||
### Automatically marking MeTube downloads with SponsorBlock chapters
|
### Automatically marking MeTube downloads with SponsorBlock chapters
|
||||||
|
|
||||||
Contributed by [@loomweaver](https://github.com/loomweaver).
|
Contributed by [@loomweaver](https://github.com/loomweaver).
|
||||||
@@ -89,3 +95,77 @@ To convert the video container instead (e.g. everything as MKV):
|
|||||||
(Note: yt-dlp's option is really spelled `preferedformat`, with one `r`.)
|
(Note: yt-dlp's option is really spelled `preferedformat`, with one `r`.)
|
||||||
Define these as named presets via `YTDL_OPTIONS_PRESETS` to pick them
|
Define these as named presets via `YTDL_OPTIONS_PRESETS` to pick them
|
||||||
per-download in the UI instead of applying them globally.
|
per-download in the UI instead of applying them globally.
|
||||||
|
|
||||||
|
## What MeTube already sets for you
|
||||||
|
|
||||||
|
MeTube builds part of the yt-dlp configuration itself from what you pick in the
|
||||||
|
UI, then merges your `YTDL_OPTIONS` on top. Options it already handles are best
|
||||||
|
left out of `YTDL_OPTIONS` — setting them again is at best redundant, and in one
|
||||||
|
case actively harmful.
|
||||||
|
|
||||||
|
Picking **Audio** (any format except `wav`) makes MeTube add all of this:
|
||||||
|
|
||||||
|
| Option | Purpose |
|
||||||
|
|---|---|
|
||||||
|
| `writethumbnail` | download the cover image |
|
||||||
|
| `FFmpegExtractAudio` | extract to your chosen format and quality |
|
||||||
|
| `FFmpegThumbnailsConvertor` | convert the cover to jpg **before** embedding |
|
||||||
|
| `FFmpegMetadata` | write tags |
|
||||||
|
| `EmbedThumbnail` | embed the cover |
|
||||||
|
|
||||||
|
Picking **Video** adds no postprocessors at all, which is why the metadata
|
||||||
|
recipe above is useful there and unnecessary for audio.
|
||||||
|
|
||||||
|
> ⚠️ **The `writethumbnail` trap.** MeTube adds that audio chain only when
|
||||||
|
> `writethumbnail` is *absent* from your options. The intent was to let you turn
|
||||||
|
> cover art off with `"writethumbnail": false`, but the check looks at whether the
|
||||||
|
> key is present rather than at its value — so setting it to **`true`** switches
|
||||||
|
> the chain off just the same:
|
||||||
|
>
|
||||||
|
> ```
|
||||||
|
> Audio + mp3, no YTDL_OPTIONS -> ExtractAudio, ThumbnailsConvertor, Metadata, EmbedThumbnail
|
||||||
|
> Audio + mp3, "writethumbnail": true -> ExtractAudio
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> Without `FFmpegThumbnailsConvertor` the cover stays in its original format
|
||||||
|
> (webp, from YouTube). Embedding that into an mp3 fails with *"Supported
|
||||||
|
> filetypes for thumbnail embedding are: mp3..."*, or leaves the image sitting
|
||||||
|
> next to the audio file as a separate `.webp`. If cover art has stopped working
|
||||||
|
> on your audio downloads, this is almost always why — remove `writethumbnail`
|
||||||
|
> from `YTDL_OPTIONS`.
|
||||||
|
|
||||||
|
## Converting a yt-dlp command line into JSON
|
||||||
|
|
||||||
|
yt-dlp ships [`devscripts/cli_to_api.py`](https://github.com/yt-dlp/yt-dlp/blob/master/devscripts/cli_to_api.py),
|
||||||
|
which turns command-line flags into the API options that `YTDL_OPTIONS` expects.
|
||||||
|
It is the right starting point, but **do not paste its output in wholesale** — it
|
||||||
|
emits everything, including the keys MeTube manages from the UI. Delete those and
|
||||||
|
keep only what remains.
|
||||||
|
|
||||||
|
For example, a square-cropped cover image:
|
||||||
|
|
||||||
|
```
|
||||||
|
yt-dlp -x --audio-format mp3 --embed-thumbnail --convert-thumbnail jpg \
|
||||||
|
--ppa "EmbedThumbnail+ffmpeg_o:-c:v mjpeg -vf crop=\"'if(gt(ih,iw),iw,ih)':'if(gt(iw,ih),ih,iw)'\""
|
||||||
|
```
|
||||||
|
|
||||||
|
The converter turns that into a block containing `format`, `writethumbnail`,
|
||||||
|
`final_ext`, `FFmpegExtractAudio`, `FFmpegThumbnailsConvertor` and
|
||||||
|
`EmbedThumbnail` — every one of which MeTube already does when you pick Audio +
|
||||||
|
mp3, and one of which (`writethumbnail`) would break it. The only part MeTube
|
||||||
|
does not provide is the postprocessor argument, so that is all you need:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"postprocessor_args": {
|
||||||
|
"embedthumbnail+ffmpeg_o": [
|
||||||
|
"-c:v", "mjpeg",
|
||||||
|
"-vf", "crop='if(gt(ih,iw),iw,ih)':'if(gt(iw,ih),ih,iw)'"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The `--ppa` prefix becomes the lowercased key `embedthumbnail+ffmpeg_o`, and the
|
||||||
|
arguments become a list rather than a single string, which removes the shell
|
||||||
|
quoting problem entirely.
|
||||||
|
|||||||
Reference in New Issue
Block a user