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

How youtube-dl extracts (knows) frames per secont (fps) from Youtube video? #11758

Closed
cristalix opened this issue Jan 18, 2017 · 4 comments
Closed

Comments

@cristalix
Copy link

@cristalix cristalix commented Jan 18, 2017

Hi, this is not an issue, this is a question:

How youtube-dl knows which video format (possible video link) has frames per second (fps)? How it does get the info?

In _formats array, there's no fps col, or, better say, just few formats has fps defined: 298, 299, 302, 303, 308, 315 (60 fps). In final json, some video formats has defined fps (format 278 has 13 fps, format 242 has 25 fps) and some has empty fps value.

I found out this piece of code:

  more_fields = {
      'filesize': int_or_none(url_data.get('clen', [None])[0]),
      'tbr': float_or_none(url_data.get('bitrate', [None])[0], 1000),
      'width': width,
      'height': height,
      'fps': int_or_none(url_data.get('fps', [None])[0]),
      'format_note': url_data.get('quality_label', [None])[0] or url_data.get('quality', [None])[0],
  }

Can somebody explain me how youtube-dl extract info about number of video frames?

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jan 18, 2017

Two places:

  1. _formats table
  2. YouTube provided metadata. Usually they can be found on the webpage
@yan12125 yan12125 closed this Jan 18, 2017
@cristalix
Copy link
Author

@cristalix cristalix commented Jan 18, 2017

What do you think under "Youtube provide metadata" in this case? On which webpage? May you be please more specific?

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jan 18, 2017

In most cases the info is in https://www.youtube.com/watch?v=[video_id]&gl=US&hl=en&has_verified=1&bpctr=9999999999. In some cases they are in DASH manifests. URLs to DASH manifests are dynamically generated by YouTube. Use --dump-pages to get real URLs for them.

@cristalix
Copy link
Author

@cristalix cristalix commented Jan 18, 2017

OK, still pretty technical answer but I helped me to make everything clean. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.