Skip to content

Seek succeeds but any frame read is all zeros [revisited] #1987

@tikuma-lsuhsc

Description

@tikuma-lsuhsc

This issue was originally discussed in Issue #349 in 2018 (moved to Discussion as #928), but it wasn't resolved then (as far as I can tell). I just came across this very issue and may be able to shed additional light.

Here is a minimal example (tested with v15.0.0 running on Python v3.13.3 in Linux):

import av

seek_first = False
with av.open(avifile) as fmt:
    vst = fmt.streams.video[0]
    if seek_first:
        fmt.seek(0, stream=vst, backward=True, any_frame=False)
    frame = next(fmt.decode(video=0))
    data = frame.to_ndarray(format="rgb24")
    assert np.any(data!=0) # errors out only if seek_first=True

The assertion appears to fail only with my AVI file (uncompressed video from highspeed video camera). If I use an MP4 file, it worked properly. Also, every frame of this AVI file is a key frame. I cannot share my video file but this info may help debugging the issue.

Thanks, and Thanks for the awesome package

P.S., I'd be happy to move this post under #928 if appropriate, but it does appear to be a real issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions