Skip to content

Number of frames interpreted by Lintel is not correct #31

@HaoMood

Description

@HaoMood

Dear Brendan,

Thanks for this wonderful project for video loading. It saves great amount of space and time consumption.

However, I found that Lintel may not parse the number of frames of a video correctly. I install Lintel by conda install:
conda install -c conda-forge lintel

Case 1: AVI data.

import cv2, lintel
path = 'v_ApplyEyeMakeup_g01_c01.avi'
video = cv2.VideoCapture(path)
num_frames = int(video.get(cv2.CAP_PROP_FRAME_COUNT)) 
video.release()
result = lintel.loadvid_frame_nums(open(path, 'rb').read(), frame_nums=(64,))

The number of frames is 164, while the above line gives "Ran out of frames. Looping. No frames received after seek." error.

Case 2: MP4 data.

import cv2, lintel
path = 'x0xr91NbD9E.mp4'
video = cv2.VideoCapture(path)
num_frames = int(video.get(cv2.CAP_PROP_FRAME_COUNT)) 
video.release()
result = lintel.loadvid_frame_nums(open(path, 'rb').read(), frame_nums=(808,))

The number of frames is 809, while the above line gives "Ran out of frames. Looping. No frames received after seek." error.

The frame numbers returned by OpenCV is correct, which I have double checked by using the following command:
fmpeg -i v_ApplyEyeMakeup_g01_c01.avi -vcodec copy -f rawvideo -y /dev/null 2>&1 | tr ^M '\n' | awk '/^frame=/ {print $2}'|tail -n 1

In short, the number of frames interpreted by Lintel is nearly correct for MP4 video, while it has a huge disparity for AVI video. I can provide these two example videos, if necessary.

Thank you for your kind consideration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions