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

Streamable.com reports two formats, only one gets downloaded #33007

Open
tansy opened this issue Dec 29, 2024 · 5 comments
Open

Streamable.com reports two formats, only one gets downloaded #33007

tansy opened this issue Dec 29, 2024 · 5 comments
Labels

Comments

@tansy
Copy link

tansy commented Dec 29, 2024

Checklist

  • [x ] I'm reporting a broken site support
  • [x ] I've verified that I'm running youtube-dl version 2024.12.17
  • [x ] I've checked that all provided URLs are alive and playable in a browser
  • [x ] I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • [x ] I've searched the bugtracker for similar issues including closed ones

Verbose log

Description

Streamable.com reports two formats, only one gets downloaded.

Streamable reports two formats, only one gets downloaded - bottom one.
It happens when they are reported in this, particular order: 'mp4, mp4-mobile'.

$ youtube-dl --version
youtube-dl 2024.12.17
$ youtube-dl -F https://streamable.com/fh3uim
[Streamable] fh3uim: Downloading JSON metadata
[info] Available formats for fh3uim:
format code  extension  resolution note
mp4          mp4        460x612     321k, 30fps, 4.61MiB
mp4-mobile   mp4        359x478     383k, 30fps, 5.49MiB (best)

$ youtube-dl -f mp4 -o fh3uim.mp4 https://streamable.com/fh3uim
[Streamable] fh3uim: Downloading JSON metadata
[download] Destination: fh3uim.mp4
[download] 100% of 5.49MiB in 00:07

$ youtube-dl -f mp4-mobile -o fh3uim.mp4-mobile https://streamable.com/fh3uim
[Streamable] fh3uim: Downloading JSON metadata
[download] Destination: fh3uim.mp4-mobile
[download] 100% of 5.49MiB in 00:17

$ wc -c fh3uim.mp4*
 5759085 fh3uim.mp4
 5759085 fh3uim.mp4-mobile

Checked with other videos (id: 315u24, 2fu687) and the result is the same.

Funny thing is - it's not always the case, like for these: 62pbzs, bibj5o, work fine.
This time the formats are reported as 'mp4-mobile, mp4', and they both get downloaded.

$ youtube-dl -F https://streamable.com/bibj5o
[Streamable] bibj5o: Downloading JSON metadata
[info] Available formats for bibj5o:
format code  extension  resolution note
mp4-mobile   mp4        639x358     699k, 30fps, 5.25MiB
mp4          mp4        828x464    1046k, 30fps, 7.85MiB (best)

$ youtube-dl -f mp4 -o bibj5o.mp4 https://streamable.com/bibj5o
[Streamable] bibj5o: Downloading JSON metadata
[download] Destination: bibj5o.mp4
[download] 100% of 7.85MiB in 00:18

$ youtube-dl -f mp4-mobile -o bibj5o.mp4-mobile https://streamable.com/bibj5o
[Streamable] bibj5o: Downloading JSON metadata
[download] Destination: bibj5o.mp4-mobile
[download] 100% of 5.25MiB in 00:08

$ wc -c bibj5o.mp4*
 8228271 bibj5o.mp4
 5503856 bibj5o.mp4-mobile

It may not be our fault. If so, feel free to close it without notice.

@dirkf
Copy link
Contributor

dirkf commented Dec 30, 2024

This looks like the expected behaviour, for a slightly non-obvious reason.

yt-dl downloads what it considers to be the best version of the content (preferring the best separate video and audio streams if available).

Here we have mp4 and mp4-mobile which are both combined AV formats, with the former being preferred.

In the first case we seem to be getting the wrong format, but actually any extension such as mp4 is a special format parameter that means

... download the best quality format of a particular file extension served as a single file ...

and that is actually the format mp4-mobile in this case (probably a wrong choice resulting from a low-res original being scaled to a standard mobile resolution). This would have been more obvious if your test examples used %(format_id)s in the output template

$ youtube-dl-20241217 -f '[format_id=mp4]' 'https://streamable.com/fh3uim'
[Streamable] fh3uim: Downloading JSON metadata
[download] Destination: unnamed-fh3uim.mp4
[download] 100% of 4.61MiB in 00:05
$ 

@tansy
Copy link
Author

tansy commented Dec 30, 2024

yt-dl downloads what it considers to be the best version of the content (preferring the best separate video and audio streams if available).

When I specify format I choose, and I choose 'not to be chosen' automatically.
Also when I choose format I don't get anything like:

$ youtube-dl -v https://streamable.com/fh3uim
(...)
[Streamable] fh3uim: Downloading JSON metadata
[debug] Default format spec: best/bestvideo+bestaudio

which is specific to automatic choice.

Here we have mp4 and mp4-mobile which are both combined AV formats, with the former being preferred.

As above - I did prefer, not a program. So program should not tech me what to do.

In the first case we seem to be getting the wrong formats

I don't think so, as in case of wrong format I would get an error

$ youtube-dl -f wrong-format https://streamable.com/fh3uim
ERROR: requested format not available

So, clearly, 'mp4' is not 'wrong format' - otherwise it would issue an error.

-f '[format_id=mp4]'

I don't get that - what's the difference between -f 'mp4' and -f '[format_id=mp4]'?. In both cases it will be assigned to 'format_id' variable.

@dirkf
Copy link
Contributor

dirkf commented Dec 30, 2024

Read the quoted excerpt from the Manual above: -f mp4 means f [ext=mp4] and not -f [format_id=mp4], while -f mp4-mobile does mean -f [format_id=mp4-mobile].

Basically, this issue is the same as yt-dlp/yt-dlp#1282; we should implement a similar additional format ID sanitisation step to avoid the case that a format_id could have an ext value.

@tansy
Copy link
Author

tansy commented Dec 30, 2024

-f mp4 means f [ext=mp4] and not -f [format_id=mp4], while -f mp4-mobile does mean -f [format_id=mp4-mobile].

Understood.

@dirkf
Copy link
Contributor

dirkf commented Dec 31, 2024

So with a suitable patch:

$ python -m youtube_dl -vF 'https://streamable.com/fh3uim'
[debug] System config: [u'--prefer-ffmpeg']
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-vF', u'https://streamable.com/fh3uim']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Git HEAD: d55d1f423
[debug] Python 2.7.18 (CPython i686 32bit) - Linux-4.4.0-210-generic-i686-with-Ubuntu-16.04-xenial - OpenSSL 1.1.1w  11 Sep 2023 - glibc 2.15
[debug] exe versions: avconv 4.3, avprobe 4.3, ffmpeg 4.3, ffprobe 4.3
[debug] Proxy map: {}
[Streamable] fh3uim: Downloading JSON metadata
[info] Available formats for fh3uim:
format code  extension  resolution note
fmp4         mp4        460x612     321k, 30fps, 4.61MiB
mp4-mobile   mp4        359x478     383k, 30fps, 5.49MiB (best)
$ python -m youtube_dl -f mp4 --get-format 'https://streamable.com/fh3uim'
mp4-mobile - 359x478
$ python -m youtube_dl -f fmp4 --get-format 'https://streamable.com/fh3uim'
fmp4 - 460x612
$

@dirkf dirkf added the bug label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants