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

REQ: Flag to get duration of video without downloading #859

Closed
msegar opened this issue May 28, 2013 · 5 comments
Closed

REQ: Flag to get duration of video without downloading #859

msegar opened this issue May 28, 2013 · 5 comments
Labels

Comments

@msegar
Copy link

@msegar msegar commented May 28, 2013

The ability to quickly get the duration of the requested video without downloading would be a very helpful feature. Currently, the only way (to my knowledge) to get the video duration is to download a JSON file for the video and parse out the 'duration' entry.

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented May 29, 2013

You can get the JSON without downloading the video with youtube-dl "BaW_jenozKc" --skip-download --write-info-json.
But I guess you want an option like --get-duration, am I right?

@msegar
Copy link
Author

@msegar msegar commented May 29, 2013

Yes, a --get-duration flag would be helpful.

I currently use the JSON flag without downloading the video like you suggested, but for repeatedly finding videos of a certain length this method can be time consuming.

@FiloSottile
Copy link
Collaborator

@FiloSottile FiloSottile commented May 30, 2013

ref: #826

@Elite
Copy link

@Elite Elite commented Dec 16, 2013

Any updates to this? This is something which will be very helpful.

@phihag
Copy link
Contributor

@phihag phihag commented Dec 16, 2013

In youtube-dl 2013.12.16 and newer, you can use the --get-duration flag.

$ youtube-dl --get-duration O6w6GCm8wJI
30:59

It is meant for interactive use. In an automated process, you should use -j instead, and parse that result, for example with jq:

$ youtube-dl -j O6w6GCm8wJI | jq .duration
1859
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
5 participants
You can’t perform that action at this time.