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

Get frame timestamp #29

Closed
zacharynevin opened this issue Mar 26, 2017 · 3 comments
Closed

Get frame timestamp #29

zacharynevin opened this issue Mar 26, 2017 · 3 comments

Comments

@zacharynevin
Copy link

zacharynevin commented Mar 26, 2017

Hello,

I am using skvideo.io.vreader to read a file as a stream:

videogen = skvideo.io.vreader(video_url) # s3 path to the video
for frame in videogen:
        # do stuff
        # get timestamp of frame

I want to get the timestamp of the frame relative to the start of the video. I couldn't find anything in the API docs related to this. Is it possible?

@beyondmetis
Copy link
Member

I actually never tested loading URL paths. Does that part work?

If you multiply the frame number by the frame rate, you can get the number of seconds that elapsed since the beginning of the video. You could then convert the seconds to a timestamp. The frame rate (if it exists in the video metadata) can be read using the skvideo.io.ffprobe function.

@zacharynevin
Copy link
Author

That was my bad - I assumed that you could use URL paths. You can't, so I just download the file first and then load it in.

I will try this. Thanks!

@zacharynevin
Copy link
Author

It works, thanks!

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

No branches or pull requests

2 participants