rekognition-streaming-video-events icon indicating copy to clipboard operation
rekognition-streaming-video-events copied to clipboard

Stream processor not reaching RUNNING state

Open jorgejgnz opened this issue 3 years ago • 7 comments

I'm trying to detect labels in a streaming video but the stream processor goes from STARTING state to STOPPED state. It seems not to reach RUNNING state at any moment.

If MaxDurationInSeconds is set, it finishes before reaching that duration. If it's not set, it finishes after a couple of seconds.

Sometimes it detects a label that appeared in the stream a long time ago. Sometimes, if the processor is restarted after having stopped, it detects events that have already been detected before, returning exactly the same image.

I have tried with an external webcam, built-in webcam and sample videos, but I get the same behavior in all cases.

I have checked that the producer timestamp is correct. Just after starting the processor, I capture a video of a few seconds of the stream using get_data_endpoint and get_media functions for the same timestamp used in stream processor start request. The video extracted from the stream for that timestamp shows the expected content.

Responses from stream processors's creation and start requests don't show any error.

Stream processor creation request:

response = rekognition_client.create_stream_processor(
    Input={
        'KinesisVideoStream': {
            'Arn': ...
        }
    },
    Output={
        'S3Destination': {
            'Bucket': ...
        }
    },
    Name= ...,
    Settings = {'ConnectedHome': {
        'Labels': ["PERSON", "PET", "PACKAGE","ALL"],
        'MinConfidence': 90.0
    }
    },
    RoleArn=...,
    NotificationChannel={
        'SNSTopicArn': ...
    }
)

Stream processor start request:

response = rekognition.start_stream_processor(
        Name=...,
        StartSelector={
            'KVSStreamStartSelector': {
                'ProducerTimestamp': int(time.time())
            }
        }
        #,StopSelector={'MaxDurationInSeconds': 120}
    )

jorgejgnz avatar Jun 13 '22 19:06 jorgejgnz

I think the ProducerTimestamp needs to be in milliseconds not seconds can you try 'ProducerTimestamp': int(time.time())*1000 and see if you get the same result?

mikames avatar Jun 29 '22 22:06 mikames

I tried providing timestamp in milliseconds in the start processor request but I'm getting the same result. If StopSelector is not provided in start request, the stream processor tries to start but it stops almost immediately after receiving the start request.

I assume timestamps are given in seconds as they are given in seconds in Kinesis Video Streams API. I couldn't find any documentation that specifies what format the producer timestamp should have in the start stream processor request.

Docs: API, CLI

jorgejgnz avatar Jul 01 '22 15:07 jorgejgnz

@jorgejgnz can you email me directly ([email protected]) with your contact details so i can follow up. thanks

mikames avatar Jul 01 '22 15:07 mikames

@mikames hi, any updates regarding this issue?

@bartlomiejgadzicki-digica , hey yes looks like it's my instructions setting up SNS were wrong i'm going to fix. here's the instructions on setting up SNS https://docs.aws.amazon.com/rekognition/latest/dg/streaming-labels-setting-up.html

mikames avatar Jul 21 '22 16:07 mikames

It doesn't work either with Producer or real time timestamp :C

@bartlomiejgadzicki-digica please drop me an email [email protected] and i can help debug.

mikames avatar Jul 22 '22 13:07 mikames