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

Is there any way to determine the length of a video without downloading it? #474

Closed
ghost opened this issue Oct 18, 2012 · 9 comments
Closed

Comments

@ghost
Copy link

@ghost ghost commented Oct 18, 2012

I was looking at the output of --write-info-json but could not determine the parameter (if there is any) that says the length of a video.

@phihag
Copy link
Contributor

@phihag phihag commented Oct 22, 2012

Currently, we do not determine the length (in seconds, I assume you don't mean in bytes) of the video, but we certainly could.

@ghost
Copy link
Author

@ghost ghost commented Oct 22, 2012

@phihag Yes - you're correct, I meant seconds. I use ffmpeg to determine the length of a video after it's done downloading.

Are you saying there's a way to determine either the length in seconds or bytes without downloading the entire video? That'd be really cool and I'd be interested in knowing how you would go about approaching that!

@Plaque-fcc
Copy link

@Plaque-fcc Plaque-fcc commented Oct 22, 2012

There is a way a webplayer knows it. Thus, there may be an info on that
available before we finished downloading.

@Tailszefox
Copy link
Contributor

@Tailszefox Tailszefox commented Oct 22, 2012

The YouTube API provides a "duration" field for each media:content, and there's also a "yt:duration" tag, both providing the length of the video in seconds, so extracting that info shouldn't be too hard.

@ghost
Copy link
Author

@ghost ghost commented Oct 22, 2012

@Tailszefox Do you know if the "yt:duration" information is available in the output of --write-info-json (I wasn't able to find it there)?

@Tailszefox
Copy link
Contributor

@Tailszefox Tailszefox commented Oct 22, 2012

@ledzeppelin No, it's only available through YouTube's API. I just made a pull request that adds it to the json file, though, and more generally makes it accessible to the rest of the program if needed.

@ghost
Copy link
Author

@ghost ghost commented Oct 22, 2012

@Tailszefox Awesome - Looking forward to it in the next release

@phil2508
Copy link

@phil2508 phil2508 commented Nov 4, 2012

Is there an ETA when this will be included in the python built?

@FiloSottile
Copy link
Collaborator

@FiloSottile FiloSottile commented Nov 4, 2012

A new version is near, but you can make youtube-dl yourself.

@FiloSottile FiloSottile closed this Nov 4, 2012
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.

5 participants
You can’t perform that action at this time.