Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metadata while downloading files #4341

Open
indahud opened this issue Sep 28, 2020 · 41 comments
Open

Add metadata while downloading files #4341

indahud opened this issue Sep 28, 2020 · 41 comments
Labels
downloader Issue is related to the downloader feature request Issue is related to a feature in the app

Comments

@indahud
Copy link

indahud commented Sep 28, 2020

Add metadata and thumbnail while downloading files

There is no option to embed metadata and thumbnails while downloading files.

Is your feature request related to a problem? Please describe it

No

How will you/everyone benefit from this feature?

Metadata information like chapters, artist, album name, genre, year and thumbnail can organize audio files easily. Similarly for video files.

@indahud indahud added the feature request Issue is related to a feature in the app label Sep 28, 2020
@opusforlife2
Copy link
Collaborator

I'm surprised this isn't a duplicate. There is literally no issue asking for metadata to be added to downloads. O.o

How does youtube-dl do it?

Regarding thumbnails, they can only be added to the mp4 container, not ogg. (Technically they can, but it needs a hack; the image needs to be converted to base64 or something.)

@opusforlife2 opusforlife2 added the downloader Issue is related to the downloader label Sep 28, 2020
@opusforlife2 opusforlife2 changed the title Add metadata while downloading audio files Add metadata while downloading files Sep 28, 2020
@opusforlife2
Copy link
Collaborator

Metadata can and should be added for audio as well as video files.

@B0pol
Copy link
Member

B0pol commented Sep 28, 2020

youtube-dl doesn't add metadata by default, but you can with --add-metadata option.

@indahud
Copy link
Author

indahud commented Sep 28, 2020

It uses these flags --embed-thumbnail --add-metadata

@MD77MD
Copy link

MD77MD commented Sep 28, 2020

this would be very cool... especially for audio files

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented Sep 29, 2020

@B0pol And it will add the image too? In full quality?

I'm here from a request I wrote here, btw:
#1014

@opusforlife2
Copy link
Collaborator

It would not be a good idea to add a very high quality image to the downloaded file. If your file is 4 MB and you add another 2 MB just to get a thumbnail, for example, it would bloat your media library very fast.

@AndroidDeveloperLB
Copy link

@opusforlife2 I don't think I ever saw a ridiculously large image for it that it takes this much space, from YouTube, and I use "mediahuman youtube to mp3 converter" on many videos from there.
In fact I never even saw a 4k image from there, so I think it should be safe.

You could always have a setting for protecting it, if you really want:

  1. Disable adding image
  2. add image, only if up to widthxheight resolution. Downscale if needed.
  3. add image, only if up to x MB. Downscale if needed.
  4. add image, only if up to x MP. Downscale if needed.
  5. always add image. No downscaling.

And because I really never saw such an issue.

@opusforlife2
Copy link
Collaborator

https://support.google.com/youtube/answer/72431?hl=en

I got the 2 MB figure from here. So it is possible that an uploader uses an image of that size.

But Youtube provides thumbnails in several sizes. From very small to full sized. That's what I was referring to. We could get an optimum sized image that looks good but is still small.

And yes, we should definitely have a setting to control this. Users who don't want thumbnails shouldn't have to pay for them in data.

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented Sep 29, 2020

@opusforlife2 It's the guidelines, and even then, it's incredibly rare for an image of size 1280x720 to take this much space.
It will probably need to have such random content that the compression of JPG/PNG will fail to compress it well.

I don't think you need to worry about this much.
We could have a generous default setting and you wouldn't notice it.

If you want, you can try to upload the largest thing you can, and I can test what I get from it.

@opusforlife2
Copy link
Collaborator

I'm surprised Youtube doesn't recommend WebP for thumbnails yet. Or even AVIF.

@AndroidDeveloperLB
Copy link

@opusforlife2 I don't know how it's saved behind the scenes.
Does YouTube have the videos saved in a format that has the image inside? Or it's separate?
If it's separate, they might save it on WEBP themselves. If it's inside the video file, maybe it's limited...

@opusforlife2
Copy link
Collaborator

Does YouTube have the videos saved in a format that has the image inside? Or it's separate?

It's separate, probably. They only need thumbnails for embedded videos.

@AndroidDeveloperLB
Copy link

@opusforlife2 So maybe it's webp?

@AndroidDeveloperLB
Copy link

@opusforlife2 Are there rules about the format, when it's inside the video file? It could be WEBP?

@opusforlife2
Copy link
Collaborator

WebP has a different container called RIFF. https://en.wikipedia.org/wiki/WebP

It doesn't seem to support being contained in WebM or MP4.

So maybe it's webp?

https://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api

This shows several URLs which have thumbnails in the webp format. So Youtube does use them already.

@AndroidDeveloperLB
Copy link

@opusforlife2 So on YouTube it's saved as WEBP, but on the output of creating MP4/WEBM, we can't have WEBP inside .

Too bad.
So what can be inside MP4/WEBM ? JPG/PNG ? Something else?

@opusforlife2
Copy link
Collaborator

Why would you need embedded thumbnails for videos? They are generally automatically generated by media players like VLC, and file explorers as well.

To answer your question, JPGs and PNGs can be embedded in both those containers. But a likely use for an embedded thumbnail is only audio files, which rules out WebM. This is because Youtube contains only Opus and AAC audio streams, which are downloaded by Newpipe in Ogg and MP4 containers respectively.

I've already written about Ogg here #4341 (comment).

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented Sep 29, 2020

@opusforlife2 When you download as an audio file, though, I don't think apps will generate it for you.
The request here is more about audio, not video. I just asked this as a side note, because it's interesting for both video and audio.
It could be nice to have an option for video, too, though.

The same restrictions are for audio? Can't put WEBP into audio files? Only PNG/JPG?

@opusforlife2
Copy link
Collaborator

Nothing matters here except the container. MP4 allows images, and so does WebM (it is based on Matroska - MKV). But not Ogg. In Newpipe's case, only MP4 matters, because you have the option of downloading AAC streams in that container.

@AndroidDeveloperLB
Copy link

@opusforlife2 Odd that OGG doesn't support it, as it's supposed to be newer and more modern...
I'm sorry if I made you upset.
So as you said, whether it's audio or video file, we are restricted to PNG/JPG to be inside?

@opusforlife2
Copy link
Collaborator

What made you think I'm upset?

Odd that OGG doesn't support it

It is indeed weird.

we are restricted to PNG/JPG to be inside?

Yup.

@AndroidDeveloperLB
Copy link

@opusforlife2 I see. Thanks.

@gl-dev
Copy link

gl-dev commented Oct 11, 2020

Hi there,
I'd also give this feature +1.

It would be very helpful to support and integrate metadata into downloaded files for e.g. a video to podcast scenario including a cover screenshot at a definable position within a video file.
The MP4 to M4A conversion is sufficient for me, so I use ffmpeg to achieve that goal.

Save the following commands in a batch file and put a link into the "SendTo" folder (%appdata%\Microsoft\Windows\SendTo) to be able to choose MP4 files in the file-explorer.

REM rip audio track from video file
ffmpeg.exe -i %%a -vn -acodec copy "%%~dpa%%~na".tmp.m4a

REM rip frame at 5s of video with quality 5 to jpg
ffmpeg.exe -i %%a -ss 00:00:05 -vframes 1 -q:v 5 "%%~dpa%%~na".jpg

REM integrate jpg into m4a file and cleanup, if the conversion is executed without errors
ffmpeg.exe -i "%%~dpa%%~na".tmp.m4a -i "%%~dpa%%~na".jpg -map 0:0 -map 1:0 -codec copy -disposition:v:0 attached_pic "%%~dpa%%~na".m4a && del "%%~dpa%%~na".tmp.m4a && del "%%~dpa%%~na".jpg

I'm happy with this, however if NewPipe could do the job automatically, that would be a nice time saver ;)

@BruceMustache
Copy link

+1 for that feature

@AndroidDeveloperLB
Copy link

@mangoepic By "cover" it means "album cover" , right? Meaning it could get the image from YouTube of the video, and put it into the output file?

@tellmewhy12
Copy link

@AndroidDeveloperLB Yes there needs to be some method for it. I know that youtube-dl can download youtube thumbnails with ffmpeg but i am not sure how well this is supported/customizable without it and if it supports all of newpipes platforms like soundcloud etc.

@tellmewhy12
Copy link

https://github.com/mangoepic/NewPipe i tried starting to add a cover image feature here but i have honestly no idea what i am doing so feel free to help or overtake if you're interested

@Mhowser
Copy link

Mhowser commented Sep 19, 2021

Is it possible to bundle youtube-dl and ffmpeg with newpipe? (Or they can be downloaded and installed via option in settings). Then there could be an "advanced download" section where users can add their own custom youtube-dl command.

@opusforlife2
Copy link
Collaborator

@Mhowser You can search for those keywords. This has already been discussed.

@tellmewhy12
Copy link

tellmewhy12 commented Sep 22, 2021

My current idea was to use jaudiotagger (or similiar) for tagging and getting the current youtube thumbnail as cover + inserting the channel as artist and the video title as Music title.

@iBabu007

This comment was marked as spam.

@eric-ayllon

This comment was marked as spam.

@khimaros
Copy link
Contributor

khimaros commented Dec 2, 2023

this is a subset of the issue described here, but it would be helpful to embed the original download URI into the metadata as well. this is helpful for archival/provenance.

@rajarshikhatua100

This comment was marked as off-topic.

@khimaros
Copy link
Contributor

khimaros commented May 10, 2024

workaround: install YTDLNis (available from Github or IzzyOnDroid) and use the android share dialog to share to YTDLNis. from there you can control all parameters of the download including custom yt-dlp flags.

@rajarshikhatua100

This comment was marked as off-topic.

@iam-amazing

This comment was marked as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
downloader Issue is related to the downloader feature request Issue is related to a feature in the app
Projects
None yet
Development

Successfully merging a pull request may close this issue.

16 participants