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

Video Download Quality Options #775

Open
1 task done
bverkron opened this issue Dec 27, 2024 · 4 comments
Open
1 task done

Video Download Quality Options #775

bverkron opened this issue Dec 27, 2024 · 4 comments
Labels
feature request New feature or request

Comments

@bverkron
Copy link

bverkron commented Dec 27, 2024

Describe the feature you'd like

It would be great to have more control over the videos downloaded. So far it appears the only option for controlling video quality (or any aspects of video really) is CRAWLER_VIDEO_DOWNLOAD_MAX_SIZE which is very limiting and I’m not sure it’s working as intended / implied (more on that later)

The CRAWLER_VIDEO_DOWNLOAD_MAX_SIZE option currently states the following:

The maximum file size for the downloaded video. The quality will be chosen accordingly. Use -1 to disable the limit.

My understanding of that would be that any video, regardless of length, would be compressed (and maybe down-scaled?) to fit into the specified file size. The default is 50 (megabytes?) so a video of 30 minutes would be compressed as much as necessary to fit into the size of 50 (MB?)?

There is also no mention of how the -1 / unlimited setting works, does it download the video at the highest available resolution (in the case of something like YouTube) and with unlimited file size?

This makes it very difficult to find a one-size fits all setting and limits the users ability to control the quality of the videos.

As for the current CRAWLER_VIDEO_DOWNLOAD_MAX_SIZE I don’t really know if it’s working as implied by the doc. For example I saved this youtube video page / video in Hoarder and the resulting video that was downloaded by hoarder was 11 MB and 320 x 640px. The quality is awful due to the resolution (and probably some compression as well?).

Screenshot of video full-size on a 1440p monitor
Screenshot 2024-12-27 at 3 07 41 PM

Screenshot of the assed that Hoarder downloaded via the /api/assets url
Screenshot 2024-12-27 at 3 07 52 PM

If the default value for CRAWLER_VIDEO_DOWNLOAD_MAX_SIZE is “50” then I don’t understand why the video is 11 MB. That’s about 1/5th of 50 MB and orders of magnitude larger than 50 KB. Was it downloaded at 320 x 640 in order to try and make it under 50 MB (rather than using compression) and it happened to end up at 11 MB? In Pinchflat the same video is 75MB at 1080p resolution for context and it looks every bit as clear as the original video at 1440p. So I'd imagine 1080p could easily be set under 50MB with some minor compression or even 720p if really necessary. So not sure why it's so low res and high compression in this example in Hoarder.

Pinchflat also uses yt-dlp and at least has a resolution option which I would say is am much better option if you only provide a single option as it allows you to get a roughly predictable bitrate or MB / second of video (and thus quality) regardless of the video length. Ideally though I’d say having a resolution and quality option would be best. “Quality” option could be bitrate or something similar.

As-is the video download feature is semi-useless for me which is a shame because I love the idea of having an all-in-one internet archiver too for pages and videos. It would really fit my use case well.

Looking forward to the discussion to better understand the current implementation and come up with ways to improve it :D

Describe the benefits this would bring to existing Hoarder users

Videos should be of usable quality (i.e. not heavily artifacted) and users should have the option to choose their resolution and possibly quality settings. File-size is a pretty arbitrary option when downloading videos that vary in resolution, length, etc. for various sources.

Can the goal of this request already be achieved via other means?

Not that I can see since the current options download very low quality videos and thus they cannot be "fixed" in any way even outside of Hoarder with custom scripts.

Have you searched for an existing open/closed issue?

  • I have searched for existing issues and none cover my fundamental request

Additional context

I search the Issues and Discussion sections for "video", "quality", and "resolution" separately and did not find any discussion of this, though maybe I missed it.

@bverkron
Copy link
Author

I did some digging and I think in order to get anything better than 360p video (640 x 360) you need ffmpeg. At least that's what it seems like according to this Reddit thread and the wiki on the youtubedl subreddit wiki.

There is a bit of info about ffmpeg in relation to yt-dlp in the readme here:
https://github.com/yt-dlp/yt-dlp?tab=readme-ov-file#dependencies

I was going to look at putting in a simple PR for this because I thought it might just require adding some options to the yt-dlp command but this will be more involved than I thought. Not sure I'll have time for this in the near future. :/

@MohamedBassem
Copy link
Collaborator

@bverkron As I was saying in #792 do you think it'll help to give you full control over the full argument list of ytld to customize it as you please? I feel like there are so many things to customize in ytdl.

@MohamedBassem MohamedBassem added the feature request New feature or request label Dec 31, 2024
@bverkron
Copy link
Author

I think that’s a sensible starting point yes and could, in theory, give full control to the users.

However it seems, at least based on my current findings, that unless ffmpeg is available in the container we may still be limited to 640 x 360 resolution or the original resolution video in AV1 format. So basically no different than now.

When I find some time I can try to read more doc and experiment but I think the options will be very limited without ffmpeg.

@bverkron
Copy link
Author

Actually @MohamedBassem it looks like ffmpeg is already available in the image. I had done a quick search through the code in Github and didn't see any mention of it so didn't think it was included. So then I definitely think providing a mechanism to inject additional arguments would be a very powerful start.

I still think eventually it would make sense to include some basic settings in the GUI like resolution or format like MP4, etc but for now this would be a huge step forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants