Skip to content

Playback inconsistently ending one frame before #544

@rodrigoberriel

Description

@rodrigoberriel

Preliminary Checks

  • This issue is not a duplicate. Before opening a new issue, please search existing issues.
  • This issue is not a question, feature request, or anything other than a bug report directly related to this project.

Description

The playback, via python, sometimes ends one frame before the expected. The behavior is not deterministic, but I was able to consistently reproduce it in many PC configurations with several videos recorded from different ZED versions (ZED 1, ZED 2, and ZED 2i).

Steps to Reproduce

To reproduce it, I used the playback snippet provided in the official website, with small changes to print additional info:

# FROM: https://www.stereolabs.com/docs/video/using-video/#video-playback
import sys
import pyzed.sl as sl

# Set SVO path for playback
input_path = sys.argv[1]
init_parameters = sl.InitParameters()
init_parameters.set_from_svo_file(input_path)

# Open the ZED
zed = sl.Camera()
err = zed.open(init_parameters)

svo_image = sl.Mat()
while True:
    if zed.grab() == sl.ERROR_CODE.SUCCESS:
        # Read side by side frames stored in the SVO
        zed.retrieve_image(svo_image, sl.VIEW.SIDE_BY_SIDE)
        # Get frame count
        svo_position = zed.get_svo_position()
    elif zed.grab() == sl.ERROR_CODE.END_OF_SVOFILE_REACHED:
        print("SVO end has been reached.")
        print(f"Current SVO position: {svo_position + 1}")
        print(f"Nb of frames: {zed.get_svo_number_of_frames()}")
        print(f"Nb of frames dropped: {zed.get_frame_dropped_count()}")
        exit()

Expected Result

I would expect the "Current SVO position" to be equal to the "Nb of frames". The number of frames dropped is reported just in case as well.

Actual Result

But if I run it 10 times, they are different (the difference is always equal to one) in a few of them:

for i in {1..10}; do python3 playback.py HD1080_SN23944511_16-20-25.svo; done

SVO end has been reached.
Current SVO position: 182     # <<<<<
Nb of frames: 183
Nb of frames dropped: 0
SVO end has been reached.
Current SVO position: 183
Nb of frames: 183
Nb of frames dropped: 0
SVO end has been reached.
Current SVO position: 182     # <<<<<
Nb of frames: 183
Nb of frames dropped: 0
SVO end has been reached.
Current SVO position: 183
Nb of frames: 183
Nb of frames dropped: 0
SVO end has been reached.
Current SVO position: 182     # <<<<<
Nb of frames: 183
Nb of frames dropped: 0
SVO end has been reached.
Current SVO position: 183
Nb of frames: 183
Nb of frames dropped: 0
SVO end has been reached.
Current SVO position: 183
Nb of frames: 183
Nb of frames dropped: 0
SVO end has been reached.
Current SVO position: 183
Nb of frames: 183
Nb of frames dropped: 0
SVO end has been reached.
Current SVO position: 183
Nb of frames: 183
Nb of frames dropped: 0
SVO end has been reached.
Current SVO position: 182     # <<<<<
Nb of frames: 183
Nb of frames dropped: 0

The video I used above was a recording of a wall :) recorded only to reproduce the bug and share in this issue: HD1080_SN23944511_16-20-25.zip.

ZED Camera model

ZED, ZED2, and ZED 2i

Environment

I tried on several environments, locally and in the cloud.

OS: Ubuntu 20.04 and 22.04
GPU: GTX 1050 Ti, Tesla T4, and Tesla V100.
ZED SDK VERSION: v3.7.6 and v3.8.0
Other info: I tried it in docker containers and directly on the host.

Anything else?

I tried to disable depth at runtime (passing depth_mode=sl.DEPTH_MODE.NONE to sl.InitParameters(...)), which I was expecting to improve the situation, but exactly the opposite happens: the inconsistency becomes far more frequent.

I also tried videos from different ZED versions: ZED, ZED 2, ZED 2i. All of them presented the same issue.

Is this expected?

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions