Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyAVReaderTimed returns same frame for two indexes and does not access last frame #440

Open
kvoit opened this issue Feb 6, 2023 · 0 comments

Comments

@kvoit
Copy link

kvoit commented Feb 6, 2023

We are using python 3.9.13 and pims 0.6.1.
While trying to uncover some other issues, we noticed that pims shows a slightly weird behavior when iterating through frames.
pims seems to return one frame image for two indices, but then returns the same number of overall frames as imageio by leaving out the last frame:

import pims
import imageio
import hashlib
from tqdm import tqdm

hashes_pims = list()
for i_fr, img in enumerate(tqdm(reader_pims)):
    hashes_pims.append(hashlib.md5(img).hexdigest())

hashes_pims = list()
for i_fr, img in enumerate(tqdm(reader_pims)):
    hashes_pims.append(hashlib.md5(img).hexdigest())

for n in range(620,625):
    print(f"{n} {hashes_pims[n]} {hashes_imageio[n]}")
620 fce4da92e07f132e11bdee7b44322b6a fce4da92e07f132e11bdee7b44322b6a
621 2e43a6209ad4d87a3435f5d0d9a5d5d5 2e43a6209ad4d87a3435f5d0d9a5d5d5
622 2e43a6209ad4d87a3435f5d0d9a5d5d5 c7866a3a91355e487192901951714c87
623 c7866a3a91355e487192901951714c87 7a219477137e364aa832f3f03fbea151
624 7a219477137e364aa832f3f03fbea151 e29e4fb648d37c5c99a876ca452e654b

for n in range(990,995):
    print(f"{n} {hashes_pims[n]} {hashes_imageio[n]}")
990 35a18dbe59f28598b36a2a9a7ca082ae 6e72e375f58b1fe6d7c9397ca8fe0ac2
991 6e72e375f58b1fe6d7c9397ca8fe0ac2 3771c6599ad9147be24f897c69b3fb3b
992 3771c6599ad9147be24f897c69b3fb3b 7ffc6d7c2ff353fee0a85ea46925bc7f
993 7ffc6d7c2ff353fee0a85ea46925bc7f 2a8648af9e3eb0a342594dedeb49d8af
994 2a8648af9e3eb0a342594dedeb49d8af 27a18c5d62e707fbb65223e62157abc4

imageio v2 with ffmpeg, on the other hand, does not yield consistent frame image returns when doing random access to frames (querying frame n does not consistently yield the frame with the nth hash), which works for pims ...
imageio v3 with pyav seems to work fine.

I would prefer to avoid posting the video publicly, but I would be happy to provide it to anyone in direct communication who would like to take the issue on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant