Skip to content

Video object returns array of zeros on second call #454

Description

@EricThomson

Thanks a lot for the useful package! Sorry if my question betrays a basic misunderstanding:

I have an avi file that I am reading and pims works great accessing individual frames, initially:

pims_movie = pims.Video('filename.avi')
for ind in range(10,12):
    movie_frame = pims_movie[ind]
    print("\n", ind)
    print(movie_frame[:5, :5, 0])

It prints out reasonable values:

10
[[ 85 87 89 90 93]
[ 87 89 90 92 96]
[ 88 89 91 93 97]
[ 89 92 93 94 97]
[ 92 94 96 98 102]]

11
[[ 86 88 90 90 91]
[ 90 89 90 93 95]
[ 90 90 91 95 96]
[ 91 93 95 96 98]
[ 94 96 97 99 102]]

But if I run the for loop again (without reloading the movie), I get arrays of zeros back:

10
[[0 0 0 0 0]
[0 0 0 0 0]
[0 0 0 0 0]
[0 0 0 0 0]
[0 0 0 0 0]]

11
[[0 0 0 0 0]
[0 0 0 0 0]
[0 0 0 0 0]
[0 0 0 0 0]
[0 0 0 0 0]]

Is this expected behavior? Am I supposed to be closing out the video and reloading it, or using a context manager, or something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions