aws/amazon-kinesis-video-streams-parser-library

Extracting fragment from KVS at configured interval

Closed this issue · 4 comments

I have a continuous video being put on kinesis video stream.
while reading the data from stream what i want to do is read fragments at interval of 10 seconds.
Is there a way to achieve this.

@divyaJainPhilips GetMedia API has a start selector but not the end selector. It's up to the customers application to "consume" as much of the stream as needed. In order to support your scenario, your application could start reading from a certain point, read up-to N number of fragments (say 10 seconds worth, controlled by your app) then close the connection. Next time, you could set the start selector the fragment number you've successfully processed last time and repeat.

I am going to resolve this issue. Please feel free to re-open or cut a new ticket for further information

@MushMal Thx for quick response...
one more question...the suggestion that u have given means that i will reading all the fragments in stream with 10 second interval...
what if i want to skip fragments generated in 10 seconds interval...
If i close the connection after reading one fragment and reopen after 10 second with selectorType NOW will I be able to achieve my useCase.

Also is there a way to specify the number of fragments I want to read

https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/API_dataplane_StartSelector.html

You can select SERVER_TIMESTAMP or PRODUCER_TIMESTAMP (depending on what you need) and specify the exact time stamp of the start that you intent to consume. Consume for 10 seconds and close the connection. Next time, do the same but update the time stamp.

You could use NOW selector and do 10 seconds provided that you have stable Producer stream.

Recommend trying various selectors to get the sense of what your application will need.