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

Amazon Kinesis Video Streams parser library is for developers to include in their applications that makes it easy to work with the output of video streams such as retrieving frame-level objects, metadata for fragments, and more.
Apache License 2.0
102 stars 52 forks source link

How to poll streams every 10 seconds #101

Closed varun-tangoit closed 4 years ago

varun-tangoit commented 4 years ago

Hi,

I'm currently using kinesisvideoExample module, by using i can able to save mkv files. I want to save this mkvfile with respective 10 seconds interval in a single file. Say example i started parser with particualar PRODUCER_TIME_STAMP as startselector, i want skip from on that time 10:00, 10:10,10:20... => a.mkv kind of. Kindly help me out to resolve this issue, it would be verymuch helpful.

MushMal commented 4 years ago

Not sure I understand the scenario. Perhaps, if you need the fragments then you could use https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/API_reader_ListFragments.html which will give you the inclusive list of fragments for a particular period?

varun-tangoit commented 4 years ago

Hi @MushMal, Thanks for the response. i want to save mkv file not in sequence manner, i want to skip frame inbetween with 10 seconds interval based. can i modify in any one of the module to achieve this?

MushMal commented 4 years ago

@varun-tangoit there is some confusion I think. KVS backend operates on a Fragment granularity and not a Frame. In order to retrieve a particular frame you will need to retrieve the fragment and parse/unpack it. If you need to retrieve a set of already persisted fragments (ts = present ts - retention period, where retention != 0) you could use the ListFragments API as I mentioned earlier and then do GetMediaForFragment https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/API_reader_GetMediaForFragmentList.html. However, if you are attempting to consume realtime stream you will need to use GetMedia API. In this case, check out the documentation of GetMedia https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/API_dataplane_GetMedia.html - you could specify your application specific start selector, consume only 10 seconds and drop the connection. Repeat at a later time.

varun-tangoit commented 4 years ago

Tahnks @MushMal. Yeah i currently using Getmedia API call only and Can i consume without drop connection with 10 seconds of interval?

MushMal commented 4 years ago

Unfortunately not with the realtime GetMedia.

varun-tangoit commented 4 years ago

okay @MushMal . thanks again!

MushMal commented 4 years ago

Resolving. Please feel free to cut a new issue if you need anything