question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OSError on `get_frame(__some_existing_large_index__)

See original GitHub issue

Expected Behavior

> clip = VideoFileClip(str(video_path))
> clip.duration * clip.fps
252723.60000000003
> clip.get_frame(10000) # Should return 10000th frame

Actual Behavior

> clip = VideoFileClip(str(video_path))
> frame = clip.get_frame(0)   # works
> clip.duration * clip.fps
63229.799999999996    # The duration is '17min 34sec'
> clip.get_frame(63220) # Throws OSError even though the given frame 
                                       # number is  before the end of the video.
> clip.get_frame(6322)   # Throws OSError
> clip.get_frame(632)     # Works.

Here’s the error message:

OSError: MoviePy error: failed to read the first frame of video file /app/data/streams/unravel1/unravel1_cropped.mp4. That might mean that the file is corrupted. That may also mean that you are using a deprecated version of FFMPEG. On Ubuntu/Debian for instance the version in the repos is deprecated. Please update to a recent version from the website.

Steps to Reproduce the Problem

Run the above code with the video: https://www.dropbox.com/s/27mie3v8kvo30fz/unravel16_cropped.mp4?dl=0

Specifications

  • Python Version: ‘3.6.8 (default, Jan 14 2019, 11:02:34) \n[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]]’
  • Moviepy Version: ‘1.0.0’
  • Platform Name: Ubuntu
  • Platform Version: 16.04LTS. Linux 4f9e6923e339 4.15.0-58-generic

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7

github_iconTop GitHub Comments

1reaction
keikorocommented, Oct 4, 2020

@SuperShinyEyes Did the above info help you resolve your problem?

1reaction
billopcommented, Mar 8, 2020

.get_frame’s input is seconds, not frame no.

I use this:

vid.get_frame((n / (vid.duration * vid.fps)) * vid.duration)
vid.get_frame(n / vid.fps)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Capture axes or figure as movie frame - MATLAB getframe
This MATLAB function captures the current axes as it appears on the screen as a movie frame.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found