Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One option to address missing frames when reading an mp4 file with varying frame rates using sk-video in python is to use the delta_time parameter in the vreader function. This parameter specifies the time offset between each frame and can be used to skip missing frames or duplicate frames, depending on the value of the delta_time parameter.

For example, let's say you have an mp4 video file with a frame rate of 30 fps but there are some missing frames. You can use sk-video to read the video file and skip missing frames by setting the delta_time parameter to the inverse of the frame rate:

import skvideo.io

filename = 'video.mp4'
video_frames = []

# read video frames with skipped missing frames
with skvideo.io.vreader(filename, delta_time=1/30) as reader:
    for frame in reader:
        video_frames.append(frame)

In this example, the vreader function reads in frames with a time offset of 1/30 seconds between each frame, effectively skipping any missing frames. You can then process the video frames as needed.