-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kinesis-video-archived-media client discards milliseconds from timestamps in list_fragments and get_clip #3255
Comments
Thanks for reaching out. I can reproduce this — when running your code snippet, my request also does not include the milliseconds. More investigation is needed here regarding the expected behavior for SDKs calling the ListFragments API. Regarding I think we'll want to look further into this issue and review with the team, in particular what you mentioned here:
|
@tim-finnigan: Thank you for the quick response!
Thanks; that makes sense. It was a long shot. :-) In case it helps to add some context: our situation is that
If millisecond information were preserved, this would be straightforward - we'd pass the producer timestamp for the first fragment we want in the clip as the FWIW, we've already done that careful thinking and applied the appropriate workarounds in our own code; I'm mostly reporting this upstream to help others avoid this trap (though it would be nice to be able to remove our workarounds at some point in the future, too). |
Thanks for your patience. After discussing with the team, the consensus was that we should leave this open for further tracking. We may need to reach out to the service team regarding a potential API modeling change on their end. Additionally, further testing/research maybe needed here — such as into Smithy timestamps and how these are processed by other SDKs. |
Describe the bug
I'm using the
kinesis-video-archived-media
client to fetch fragment information and MP4 clips from a KVS stream. Both thelist_fragments
method and theget_clip
method of the client expect aTimestampRange
object with aStartTimestamp
andEndTimestamp
. I'm supplying (UTC-timezoned)datetime.datetime
instances for each of those, and those instances have millisecond resolution.In both cases, the eventual request made to AWS appears to drop the millisecond information from the timestamps, resulting in me getting a different fragment list (or video clip range) from the one I expect.
Expected Behavior
I hoped for the millisecond information in the start timestamp and end timestamp to be preserved: the fragments themselves have time information that includes millisecond resolution, so it's useful to be able to use millisecond resolution to select the desired fragments.
Current Behavior
The requests succeeded, but returned fragments matched what would happen if the millisecond portion of the timestamps was being discarded. (By doing
boto3.set_stream_logger(name="botocore")
I was able to verify that this was in fact what was happening.)Reproduction Steps
Here's Python code that reproduces the issue for me. It needs a valid KVS
STREAM_NAME
to run.When I run this code, the logs include the following output:
Here the
StartTimestamp
has value1726138176
where I was expecting1726138176.5
, and similarly for theEndTimestamp
.I've verified that if I hack the serialization logic here then AWS is happy to accept timestamps with millisecond resolution, and to return the appropriate fragment list as a result.
Possible Solution
It looks as though the serialization logic for the timestamp range start and end ends up using
_timestamp_unixtimestamp
, which is where the millisecond information is discarded.I don't have enough familiarity with botocore internals (yet) to suggest a fix, but it looks as though the specification here should be using something other than plain old
Timestamp
for the shape. I seeTimestampMilliseconds
in some other places; can that be used here?Additional Information/Context
No response
SDK version used
botocore 1.34.33
Environment details (OS name and version, etc.)
macOS 14.6.1, Python 3.8
The text was updated successfully, but these errors were encountered: