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

Incorrect video framerate #3

Closed
dvschultz opened this issue Mar 21, 2021 · 3 comments
Closed

Incorrect video framerate #3

dvschultz opened this issue Mar 21, 2021 · 3 comments

Comments

@dvschultz
Copy link

dvschultz commented Mar 21, 2021

A video that is 50seconds @ 24fps appears to be 20s @ 60fps in mediapy

Screen Shot 2021-03-21 at 3 35 06 AM

Screen Shot 2021-03-21 at 3 34 50 AM

@hhoppe
Copy link
Collaborator

hhoppe commented Mar 21, 2021

Could you please share the input video and the mediapy call(s) so that we can investigate? Thanks.

@hhoppe
Copy link
Collaborator

hhoppe commented Mar 22, 2021

Please try including fps=24 in the media.show_video() call.
(The issue is that the video retrieved using read_video() is a simple numpy array without the framerate information.)

Programmatically, one can use:

with media.VideoReader('https://github.com/hhoppe/data/raw/main/video.mp4') as reader:
  fps = reader.fps
  video = np.array(tuple(reader))
media.show_video(video, fps=fps)

or

with media.VideoReader('https://github.com/hhoppe/data/raw/main/video.mp4') as reader:
  media.show_video(reader, fps=reader.fps)

@hhoppe
Copy link
Collaborator

hhoppe commented Apr 2, 2021

This should be fixed in 21d54f3

Now the framerate should carry through even in the simple case below:

import mediapy as media
url = 'https://github.com/hhoppe/data/raw/main/video.mp4'
media.show_video(media.read_video(url))

@hhoppe hhoppe closed this as completed Apr 2, 2021
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