ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.04k stars 10.01k forks source link

[coub] Best format improperly detected #25520

Open SebiderSushi opened 4 years ago

SebiderSushi commented 4 years ago

Checklist

Verbose log

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '-F', 'https://coub.com/view/1ovvj6']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2020.05.29
[debug] Python version 3.8.3 (CPython) - Linux-5.4.43-1-MANJARO-x86_64-with-glibc2.2.5
[debug] exe versions: ffmpeg 4.2.3, ffprobe 4.2.3, rtmpdump 2.4
[debug] Proxy map: {}
[Coub] 1ovvj6: Downloading JSON metadata
[info] Available formats for 1ovvj6:
format code         extension  resolution note
html5-audio-med     mp3        audio only 992.11KiB
html5-audio-high    mp3        audio only 1.32MiB
html5-video-higher  mp4        unknown    1.95MiB
html5-video-med     mp4        unknown    572.39KiB
html5-video-high    mp4        unknown    1.37MiB (best)

Description

On coub.com, videos might be served in a higher resolution, titled html5-video-higher. Contrary to the expected, youtube-dl does not recognize this fromat as (best).

FelixKainz commented 3 years ago

Just stumbled upon this too. However, when comparing the high and higher videos side by side, the difference in quality is almost non existant, although higher has 30% higher bitrate and a greater resolution (high: 1280x720, higher: 1600x900; for https://coub.com/view/2lvna0). Here is a diff of what MediaInfo had to say about those two: https://www.diffchecker.com/liquiq9J Higher simply seems to ba a lazily upscaled version of high. However, higher has the advantage that the coub watermark takes up less space than in the lower resolution high version.

Whatever you do, do not download from COUB using their download button, because those versions are garbage...

HelpSeeker commented 3 years ago

Higher simply seems to ba a lazily upscaled version of high.

The same problem can apply to med/high as well. In theory you want the resolution closest to the one of the input video, but detecting that is hardly in the scope of youtube-dl.

FelixKainz commented 3 years ago

In theory you want the resolution closest to the one of the input video, but detecting that is hardly in the scope of youtube-dl

That is exactly why I argued that higher should be the one ytdl chooses. It's quality is not worse than the others, yet has a smaller COUB watermark.

SebiderSushi commented 3 years ago

Off topic: I cherish all the coubs i have downloaded before the platform started burning in watermarks. That thing really breaks the vibe of a well-executed coub.

HelpSeeker commented 3 years ago

Sure, I just wanted to point out that their decision to upscale videos can apply to "high" as well. In general the extractor needs an overhaul.

FelixKainz commented 3 years ago

In general the extractor needs an overhaul.

Sure, but first we need to agree on a format pick hierarchy. Given that higher is always equal in subjective quality to high, the only real advantage it has is that it has a smaller watermark. So someone would need to test across multiple COUBs comparing the same frames of different quality settings in order to give an accurate picture of how the different versions compare. Even if higher has a smaller watermark, it might not be the best if it turns out that med is the original from which the high and higher verisions are derifed from since that would mean that high and higher are reencoded versions of high. So given the lazy upscaling, high and higher should contain less real image data than the original med version because they got reencoded once more.

HelpSeeker commented 3 years ago

So someone would need to test across multiple COUBs comparing the same frames of different quality settings in order to give an accurate picture of how the different versions compare.

I've done this for a few dozen coubs, when they first rolled out the higher version. The one thing I can say right away is that only one time I felt like higher had an ever so slight advantage over high. I personally haven't bothered with them since.

high vs med is more interesting, because there are two more factors to consider. For one med has slightly different colors than high and higher (colormatrix change?). The other factor is that (as far as I can tell) Coub encodes med at a lower quality than the other versions. So what you lose in detail because of an upscale to high might still be less than what you lose by med's lower quality. For completeness sake I have to mention that med coubs have on average the highest bits per pixel value (med > high > higher), but of course that doesn't factor in the encoding settings and how well those bits are ultimately used.

Another thing you have to consider is the aspect ratio. Each version has a max resolution box (640x480, 1280x960, 1600x1200). Videos will be scaled so that they fill these boxes, while respecting the videos' aspect ratios. But these boxes aren't squares. Vertical videos tend to get downscaled more aggressively. For example, a 16:9 video would have the following resolutions available: 640x360, 1280x720, 1600x900, while a 9:16 video would come in 270x480, 540x960, 675x1200.

So yeah... no idea if there's a satisfying answer to the question which format to pick. But perhaps these infos can help others to decide or look further into it.

FelixKainz commented 3 years ago

So you would agree that the quality differences are neglectable? So for me it seems that it comes down to the watermark size then. Thus, I would prefer higher.

HelpSeeker commented 3 years ago

For the average coub? Yes.