aws-samples / aws-samples/amazon-kinesis-video-streams-consumer-library-for-python

fragment_bytes not full image data?

Open
#7 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
35
Forks
28
PR merge metrics
No merged PRs in 30d

Description

Hi,

I am trying to implement this example for creating images from a stream. I thought I had gotten it to work but picking this project back up after leaving it for a while it isn't working anymore. I dockerized it so the environment should not have changed.

Everything runs until it hits line `151` in the `kinesis_video_fragment_processor.py`:
`frames = iio.imread(io.BytesIO(fragment_bytes), plugin="pyav", index=...)`

So I tried using Pillow to check if the image data was valid:
```
from PIL import Image
import io

try:
image = Image.open(io.BytesIO(fragment_bytes))
image.verify() # Verifies that the file is a valid image
print("Valid image")
except Exception as e:
print("Invalid image:", e)
```

and that returned:
`Invalid image: cannot identify image file <_io.BytesIO object at 0x7f1bad8bdd50>`

EDIT: The stream shows fine in the AWS KVS Console by the way. And maybe its worth noting that I am streaming an h265 format to KVS

Can anyone point me in the right direction, or tell me how to further debug this?
Any help would be greatly appreciated!

Regards Gijs

Contributor guide

Open the contributing guide

Research direction

Start with line 151 of kinesis_video_fragment_processor.py and reproduce the failure around iio.imread, using the reported Pillow validation check for fragment_bytes. Compare the behavior with the AWS KVS Console for the H.265 stream. Done means the cause of the undecodable fragment data is identified and the example's H.265 behavior is fixed or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, docker, python
Domain
cloud, stream-processing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.