Skip to content

yt-dlp: Expanded media tags support - #31

Merged
Rafostar merged 9 commits into
mainfrom
ytdlp-tags
Dec 20, 2025
Merged

Rafostar merged 9 commits into
mainfrom
ytdlp-tags

Conversation

@Rafostar

Copy link
Copy Markdown
Owner

Add more media item tags support to yt-dlp based enhancer. Allows apps to access more video data such as: channel name, media description, genre and preview image.

In cases of playlist extraction, use preview image URI as a sample that contains "text/uri-list". This does not require us to do additional multiple requests to fetch each playlist item image and GStreamer officially supports (according to its documentation) URIs as image sample too.

Due to the above, also add sample artwork in the form of URI (instead of image data) handling in MPRIS, to make all this work together.

We can use channel info as "artist" tag (like Chrome does), so
it shows up in MPRIS for example. Also extract description in case
some other app wants it.
Use Gio file APIs to fetch best quality thumbnail. Afterwards, create
an image sample from downloaded data and add it to tags as preview image.

This change allows MPRIS enhancer to use it as media artwork, which is
the same as what Chrome browser shows in its own MPRIS implementation.
Have a separate function for it, so main extract function is cleaner
Since extraction tags are also added there, lets have all similar logic in single place
Allows apps to read "artist" tag on a queued item
Using "gst_tag_image_data_to_image_sample" makes few things easier
and does not require us to parse the mimetype from URI, as it does
this by checking the data instead.

Fixes issue where preview image would not be generated for URIs
that do not have file extension in them.
GStreamer supports "text/uri-list" as image sample
(see gst_tag_image_data_to_image_sample docs), so lets avoid
fetching image for each playlist item when parsing a playlist
When image sample holds an URI, we can use it as-is with
MPRIS clients. In cases where media image gets updated, keep
a reference on sample inside each track data. Use it to compare
object pointers and determine whether art needs unpacking again.
@Rafostar
Rafostar merged commit 46e2b50 into main Dec 20, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant