Seeking by frame is inexact and inconsistent #2115
Labels
bug
Issues that report (apparent) bugs.
lib-FFmpeg
Issues pertaining to dependency FFmpeg.
video
Related to VideoClip and related classes, or handling of video in general.
Expected Behavior
clip.make_frame(0)
returns frame 0,clip.make_frame(1 / clip.fps)
returns frame 1,clip.make_frame(2 / clip.fps)
returns frame 2, etc.Actual Behavior
moviepy largely treats "get the frame at time x" as shorthand for "get the frame displayed at time x", so "get the frame at time 0.00001" should mean "get frame 0". But ffmpeg treats "get the frame at time x" as "skip all frames until reaching time x", so sometimes
clip.make_frame(0.00001)
will return frame 1, and sometimes it will return frame 0, depending on what's been cached inlast_read
.Steps to Reproduce the Problem
Load a video clip which has a different image every frame. (Some clips will have the same image for multiple consecutive frames, which will make it seem like it works correctly)
Here is a clip you can use:
colorbars.mp4
Specifications
Testing note
test_unusual_order_frame_pos()
intest/test_ffmpeg_reader.py
is insufficient to detect this bug, as the test video used runs at 1 frame per second exactly. The inconsistency between "moviepy seek" and "ffmpeg seek" does not appear if the timestamps of all frames can be represented exactly in decimal!The text was updated successfully, but these errors were encountered: