Add cover art and other metadata to downloaded files#13023
Add cover art and other metadata to downloaded files#13023TobiGr wants to merge 16 commits intoTeamNewPipe:refactorfrom
Conversation
dbdd1dc to
3ebf7c7
Compare
3ebf7c7 to
c5b1737
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
|
Using the debug build of NewPipe with this commit resulted in the following exception, perhaps due to thumbnail size overflowing the limits of an OGG page. Exception
Crash log
|
c5b1737 to
9e97b67
Compare
|
thanks for testing. I added thumbnail compression and resizing to make thumbnails always fit into one page. Another solution would be to make the metadata spread over multiple pages. I tried to implement this, but was not successful. I ended up receiving corrupted files which does not make things better). |
a2ff809 to
1eea521
Compare
|
Maybe compressing thumbnails isn't the best idea, and we should rather span the data across multiple Ogg pages? That would be on par what libraries like mutagen do, which is used in yt-dlp. |
|
Besides, it would be neat if we could extract song metadata from the description (with regular expressions) to support YouTube Music. YTDLnis for example does this already using yt-dlp underneath. |
cef47ae to
9e6454f
Compare
It turned out that I did not fill the last comment page correctly. This works now as expected and high res thumbnails / cover arts are used. |
100e315 to
95d1997
Compare
|
As a preliminary example, this regular expression could be used to extract information from the description of YouTube Music videos. YTMUSIC_RE = r'''Provided to YouTube by (?P<label>.+)
.+\u00b7\s(?P<artist>\w+)
(?P<title>.+)
.+
Released on: (?P<date>[\d-]+)''') |
f17b5ae to
1de6b44
Compare
1de6b44 to
9b1e177
Compare
|
I now added support for non-dash mp4 downloads which are e.g. served by PeerTube. Metadata for songs from YouTube are used now, too. However, YouTube does not provide sqaure thumbnails for YouTube Music streams. |
282fced to
41c6bb0
Compare
|
Metadata and cover art are now added to mp3 files, too |
| fun getGenre(): String? = if (songInfo?.genre?.isEmpty() == false) { | ||
| songInfo.genre | ||
| } else { | ||
| streamInfo.category | ||
| } |
There was a problem hiding this comment.
I know it is raw and it is not time for review and etc. I probably just won't open it again so comment now.
All these if which checks for isEmpty/isBlank providing default value can be replaced with ifEmpty/ifBlank one liners sonfInfo?.genre?.ifEmpty { songInfo.category }
|
What media player is recommended for testing? Because vlc weirdly doesn't see cover (while stock gallery app sees it) |
|
I can see thumbnails for video and audio files in VLC. Are they enabled in your VLC settings (settings > Interface > Video thumbnails)? |
height x width was used before which is an uncommon order.
Copyright, record label, album, label, ...
Extract MP4 metadata (udta) generation into separate helper class
Serialization is attempted if something crashes. Bitmap cannot be serialized.
Metadata embedding is disabled by default across all post-processing algorithms. A new parameter and variable is introduced although there is the parameter 'args' already. The information on whether the metadata is going to be embedded needs to be parsed by every audio or video post-processing algorithm anyway. Getting it from the list is more difficult and less error-prone than creating a new param.
Update NewPipe Extractor for SongMetadata support
ee5f52e to
eb36bca
Compare
Yeah it is enabled. I also hope we are both talking about androids vlc If you previously read the message or read it on email from github notifications, don't mind it. Your PR wasn't guilty for the crash |
What is it?
refactorbranchDescription of the changes in your PR
This PR adds support for thumbnails / cover arts for downloaded mp3, mp4 and opus/ogg files.
Metadata support for mp3 and mp4 files is also added. Side note: mp4/MPEG-4 sucks implementation wise because there are a lot of magic bytes.
This PR fixes the image tags in
DescriptionFragments which previously displayed the image dimensions usingheight x width. This has been changed to the commonly used formatwidth x height.To do
Before/After Screenshots/Screen Record
Fixes the following issue(s)
Closes #4341
Relies on the following changes
APK testing
The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.
Due diligence
Notice regarding AI usage
AI (ChatGPT 5 mini) was used to generate some helpers and especially to write
Mp4Metadatato correctly adjust the existing udta and following boxes when inserting new data into udta.