How to resolve a "MAX_FRAGMENT_DURATION_REACHED" error when trying to stream RTSP camera feed into KVS #1189
Replies: 3 comments
-
Hi @tawiemadavz, can you try #147 (comment) if it helps |
Beta Was this translation helpful? Give feedback.
-
@niyatim23 i had seen it earlier, but i'm confused as to where on this command i should add "key-int-max=10"? Original Command:
When i add "frame-timestamp=1":
Output:
When i add the "key-int-max" from "x264enc":
Output:
So it does not seems to be working for me because i'm using "rtspsrc" instead of "ksvideosrc". Not sure if that matters? Have a limited understanding of gstreamer so any assistance RE how to put together the command correctly would be appreciated. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Please follow the example here: https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp/blob/master/docs/linux.md#running-the-gst-launch-10-command-to-start-streaming-from-a-rtsp-camera-source We have some sample pipelines in our docs that could help you get started. |
Beta Was this translation helpful? Give feedback.
-
I have been trying for a few days to connect a HikVision camera that is on my home network to KVS and if keeps failing with error message "MAX_FRAGMENT_DURATION_REACHED".
I have tried to adjust the camera settings for my IP camera to try get the GOP (as i understand it) as low as possible but still facing the same issue.
I am running the latest docker file for this build on an M1 Mac. I have used VLC player and ffmpeg to double check if the stream is working and it is working fine.
I have used the following commands to try start the stream:
./kvs_gstreamer_sample FacialVideoStream rtsp://XXXXXX:XXXXX@IP/Streaming/Channels/101
and
gst-launch-1.0 rtspsrc location="rtsp://XXXXXX:XXXXX@IP/Streaming/Channels/101" short-header=TRUE ! rtph264depay ! h264parse ! video/x-h264, format=avc,alignment=au ! kvssink stream-name="FacialVideoStream"
Credentials were set i have just omitted them and commands were pointed to the correct region.
See below camera settings and logs. Any help would be appreciated. Thanks!
`[INFO ] [03-06-2024 11:35:49:490.910 GMT] Using region: us-east-1
[INFO ] [03-06-2024 11:35:49:492.788 GMT] Using aws credentials for Kinesis Video Streams
[INFO ] [03-06-2024 11:35:49:492.990 GMT] No session token was detected.
[INFO ] [03-06-2024 11:35:49:503.042 GMT] createKinesisVideoClient(): Creating Kinesis Video Client
[INFO ] [03-06-2024 11:35:49:503.734 GMT] heapInitialize(): Initializing native heap with limit size 134217728, spill ratio 0% and flags 0x00000001
[INFO ] [03-06-2024 11:35:49:503.759 GMT] heapInitialize(): Creating AIV heap.
[INFO ] [03-06-2024 11:35:49:503.938 GMT] heapInitialize(): Heap is initialized OK
[DEBUG] [03-06-2024 11:35:49:504.384 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000001, Next state: 0x0000000000000002
[DEBUG] [03-06-2024 11:35:49:504.553 GMT] getSecurityTokenHandler invoked
[DEBUG] [03-06-2024 11:35:49:505.241 GMT] Refreshing credentials. Force refreshing: 0 Now time is: 1717414549504689000 Expiration: 0
[INFO ] [03-06-2024 11:35:49:505.373 GMT] New credentials expiration is 1717418149
[DEBUG] [03-06-2024 11:35:49:505.619 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000010
[INFO ] [03-06-2024 11:35:49:505.736 GMT] createDeviceResultEvent(): Create device result event.
[DEBUG] [03-06-2024 11:35:49:505.929 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000010, Next state: 0x0000000000000040
[DEBUG] [03-06-2024 11:35:49:506.102 GMT] clientReadyHandler invoked
[DEBUG] [03-06-2024 11:35:49:506.572 GMT] Client is ready
[INFO ] [03-06-2024 11:35:49:508.445 GMT] Creating Kinesis Video Stream FacialVideoStream
[INFO ] [03-06-2024 11:35:49:508.885 GMT] createKinesisVideoStream(): Creating Kinesis Video Stream.
[DEBUG] [03-06-2024 11:35:49:509.226 GMT] logStreamInfo(): Kinesis Video Stream Info
[DEBUG] [03-06-2024 11:35:49:509.239 GMT] logStreamInfo(): Stream name: FacialVideoStream
[DEBUG] [03-06-2024 11:35:49:509.242 GMT] logStreamInfo(): Streaming type: STREAMING_TYPE_REALTIME
[DEBUG] [03-06-2024 11:35:49:509.245 GMT] logStreamInfo(): Content type: video/h264
[DEBUG] [03-06-2024 11:35:49:509.248 GMT] logStreamInfo(): Max latency (100ns): 600000000
[DEBUG] [03-06-2024 11:35:49:509.251 GMT] logStreamInfo(): Fragment duration (100ns): 20000000
[DEBUG] [03-06-2024 11:35:49:509.254 GMT] logStreamInfo(): Key frame fragmentation: Yes
[DEBUG] [03-06-2024 11:35:49:509.257 GMT] logStreamInfo(): Use frame timecode: Yes
[DEBUG] [03-06-2024 11:35:49:509.259 GMT] logStreamInfo(): Absolute frame timecode: Yes
[DEBUG] [03-06-2024 11:35:49:509.290 GMT] logStreamInfo(): Nal adaptation flags: 0
[DEBUG] [03-06-2024 11:35:49:509.298 GMT] logStreamInfo(): Average bandwith (bps): 4194304
[DEBUG] [03-06-2024 11:35:49:509.301 GMT] logStreamInfo(): Framerate: 25
[DEBUG] [03-06-2024 11:35:49:509.309 GMT] logStreamInfo(): Buffer duration (100ns): 1200000000
[DEBUG] [03-06-2024 11:35:49:509.312 GMT] logStreamInfo(): Replay duration (100ns): 400000000
[DEBUG] [03-06-2024 11:35:49:509.324 GMT] logStreamInfo(): Connection Staleness duration (100ns): 600000000
[DEBUG] [03-06-2024 11:35:49:509.328 GMT] logStreamInfo(): Store Pressure Policy: 1
[DEBUG] [03-06-2024 11:35:49:509.331 GMT] logStreamInfo(): View Overflow Policy: 1
[DEBUG] [03-06-2024 11:35:49:509.339 GMT] logStreamInfo(): Segment UUID: NULL
[DEBUG] [03-06-2024 11:35:49:509.342 GMT] logStreamInfo(): Frame ordering mode: 0
[DEBUG] [03-06-2024 11:35:49:509.345 GMT] logStreamInfo(): Track list
[DEBUG] [03-06-2024 11:35:49:509.348 GMT] logStreamInfo(): Track id: 1
[DEBUG] [03-06-2024 11:35:49:509.351 GMT] logStreamInfo(): Track name: kinesis_video
[DEBUG] [03-06-2024 11:35:49:509.354 GMT] logStreamInfo(): Codec id: V_MPEG4/ISO/AVC
[DEBUG] [03-06-2024 11:35:49:509.361 GMT] logStreamInfo(): Track type: TRACK_INFO_TYPE_VIDEO
[DEBUG] [03-06-2024 11:35:49:509.364 GMT] logStreamInfo(): Track cpd: NULL
[DEBUG] [03-06-2024 11:35:49:510.724 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000001, Next state: 0x0000000000000002
[INFO ] [03-06-2024 11:35:50:538.442 GMT] writeHeaderCallback(): RequestId: 0fe69141-e974-40ef-a2d6-866c2ebdb6ab
[DEBUG] [03-06-2024 11:35:50:543.868 GMT] describeStreamCurlHandler(): DescribeStream API response: {"StreamInfo":{"CreationTime":1.716818676779E9,"DataRetentionInHours":2,"DeviceName":"Kinesis_Video_Device","IngestionConfiguration":null,"KmsKeyId":"arn:aws:kms:us-east-1:955834732421:alias/aws/kinesisvideo","MediaType":"video/h264","Status":"ACTIVE","StreamARN":"arn:aws:kinesisvideo:us-east-1:955834732421:stream/FacialVideoStream/1716818676779","StreamName":"FacialVideoStream","Version":"g7soBwlWuBMXDRAmbHEX"}}
[INFO ] [03-06-2024 11:35:50:555.377 GMT] describeStreamResultEvent(): Describe stream result event.
[DEBUG] [03-06-2024 11:35:50:555.977 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000020
[INFO ] [03-06-2024 11:35:51:445.588 GMT] writeHeaderCallback(): RequestId: 88b2b706-f5c7-452f-a997-f003a993b391
[DEBUG] [03-06-2024 11:35:51:446.002 GMT] getStreamingEndpointCurlHandler(): GetStreamingEndpoint API response: {"DataEndpoint":"https://s-808fdb44.kinesisvideo.us-east-1.amazonaws.com"}
[INFO ] [03-06-2024 11:35:51:451.225 GMT] getStreamingEndpointResultEvent(): Get streaming endpoint result event.
[DEBUG] [03-06-2024 11:35:51:451.727 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000020, Next state: 0x0000000000000010
[DEBUG] [03-06-2024 11:35:51:452.448 GMT] getStreamingTokenHandler invoked
[DEBUG] [03-06-2024 11:35:51:452.605 GMT] Refreshing credentials. Force refreshing: 1 Now time is: 1717414551452581418 Expiration: 1717418149
[INFO ] [03-06-2024 11:35:51:452.656 GMT] New credentials expiration is 1717418151
[INFO ] [03-06-2024 11:35:51:452.961 GMT] getStreamingTokenResultEvent(): Get streaming token result event.
[DEBUG] [03-06-2024 11:35:51:453.506 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000010, Next state: 0x0000000000000040
[DEBUG] [03-06-2024 11:35:51:454.069 GMT] streamReadyHandler invoked
[DEBUG] [03-06-2024 11:35:51:459.587 GMT] Stream is ready
[INFO ] [03-06-2024 11:35:51:514.949 GMT] Streaming from rtsp source
New pad found: recv_rtp_src_0_2073981561_96
[INFO ] [03-06-2024 11:35:56:895.153 GMT] Pad link successful
[INFO ] [03-06-2024 11:35:56:923.837 GMT] kinesisVideoStreamFormatChanged(): Stream format changed.
[DEBUG] [03-06-2024 11:35:56:925.474 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000040, Next state: 0x0000000000000080
[INFO ] [03-06-2024 11:35:56:926.239 GMT] putStreamResultEvent(): Put stream result event. New upload handle 0
[DEBUG] [03-06-2024 11:35:56:937.702 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000080, Next state: 0x0000000000000100
[DEBUG] [03-06-2024 11:35:56:941.946 GMT] Kinesis Video client and stream metrics
>> Overall storage byte size: 134217728
>> Available storage byte size: 134100379
>> Allocated storage byte size: 117349
>> Total view allocation byte size: 144080
>> Total streams frame rate (fps): 25
>> Total streams transfer rate (bps): 33554432 (32768 Kbps)
>> Current view duration (ms): 0
>> Overall view duration (ms): 0
>> Current view byte size: 117301
>> Overall view byte size: 117301
>> Current frame rate (fps): 25
>> Current transfer rate (bps): 33554432 (32768 Kbps)
[INFO ] [03-06-2024 11:35:57:915.985 GMT] writeHeaderCallback(): RequestId: d28a3872-1a6c-709e-8c5d-94ace60ab857
[DEBUG] [03-06-2024 11:35:57:922.545 GMT] postReadCallback(): Wrote 65524 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:35:57:925.232 GMT] postReadCallback(): Wrote 65524 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:35:57:926.223 GMT] postReadCallback(): Wrote 23305 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:35:57:926.512 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:35:58:429.380 GMT] postWriteCallback(): Curl post body write function for stream with handle: FacialVideoStream and upload handle: 0 returned: {"EventType":"BUFFERING","FragmentTimecode":1717414549487,"FragmentNumber":"91343852333181709691250862588105747435953574053"}
[DEBUG] [03-06-2024 11:35:58:433.408 GMT] fragmentAckReceivedHandler invoked
[DEBUG] [03-06-2024 11:35:58:433.821 GMT] Reporting fragment ack received. Ack timecode 1717414549487
[DEBUG] [03-06-2024 11:35:58:434.046 GMT] postReadCallback(): Wrote 13087 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:35:58:434.385 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:35:59:439.251 GMT] postReadCallback(): Wrote 22837 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:35:59:439.935 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:00:446.618 GMT] postReadCallback(): Wrote 24496 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:00:447.205 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:01:453.616 GMT] postReadCallback(): Wrote 32142 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:01:454.349 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:01:942.554 GMT] postReadCallback(): Wrote 21246 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:01:943.252 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:02:946.710 GMT] postReadCallback(): Wrote 38491 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:02:947.498 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:03:951.311 GMT] postReadCallback(): Wrote 39603 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:03:952.088 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:04:955.064 GMT] postReadCallback(): Wrote 35743 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:04:955.801 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:05:961.110 GMT] postReadCallback(): Wrote 37381 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:05:961.950 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:06:968.589 GMT] postReadCallback(): Wrote 39340 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:06:969.554 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:07:972.996 GMT] postReadCallback(): Wrote 43264 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:07:973.787 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:08:976.415 GMT] postReadCallback(): Wrote 39574 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:08:977.189 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:09:981.540 GMT] postReadCallback(): Wrote 44547 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:09:982.325 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:10:985.233 GMT] postReadCallback(): Wrote 38418 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:10:986.098 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:11:989.214 GMT] postReadCallback(): Wrote 41761 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:11:989.976 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:12:991.779 GMT] postReadCallback(): Wrote 40183 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:12:992.402 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:13:994.523 GMT] postReadCallback(): Wrote 45802 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:13:995.062 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:14:996.802 GMT] postReadCallback(): Wrote 40966 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:14:997.541 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:16:004.193 GMT] postReadCallback(): Wrote 43425 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:16:005.062 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:17:006.586 GMT] postReadCallback(): Wrote 39389 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:17:007.103 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [03-06-2024 11:36:17:280.886 GMT] postWriteCallback(): Curl post body write function for stream with handle: FacialVideoStream and upload handle: 0 returned: {"EventType":"ERROR","FragmentTimecode":1717414549487,"FragmentNumber":"91343852333181709691250862588105747435953574053","ErrorCode":"MAX_FRAGMENT_DURATION_REACHED","ErrorId":4002}
[DEBUG] [03-06-2024 11:36:17:283.465 GMT] streamErrorHandler invoked
[ERROR] [03-06-2024 11:36:17:284.133 GMT] Reporting stream error. Errored timecode: 53220000 Status: 1375731806
[WARN ] [03-06-2024 11:36:17:284.405 GMT] continuousRetryStreamErrorReportHandler(): Reporting stream error. Errored timecode: 53220000 Status: 0x5200005e
[DEBUG] [03-06-2024 11:36:17:284.936 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000100, Next state: 0x0000000000000200
[DEBUG] [03-06-2024 11:36:17:285.258 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000200, Next state: 0x0000000000000001
[DEBUG] [03-06-2024 11:36:17:285.411 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000001, Next state: 0x0000000000000002
[INFO ] [03-06-2024 11:36:17:285.517 GMT] describeStreamResultEvent(): Describe stream result event.
[DEBUG] [03-06-2024 11:36:17:285.616 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000020
[INFO ] [03-06-2024 11:36:17:285.663 GMT] getStreamingEndpointResultEvent(): Get streaming endpoint result event.
[DEBUG] [03-06-2024 11:36:17:285.695 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000020, Next state: 0x0000000000000010
[DEBUG] [03-06-2024 11:36:17:285.728 GMT] getStreamingTokenHandler invoked
[DEBUG] [03-06-2024 11:36:17:285.792 GMT] Refreshing credentials. Force refreshing: 1 Now time is: 1717414577285771847 Expiration: 1717418151
[INFO ] [03-06-2024 11:36:17:285.874 GMT] New credentials expiration is 1717418177
[INFO ] [03-06-2024 11:36:17:285.933 GMT] getStreamingTokenResultEvent(): Get streaming token result event.
[DEBUG] [03-06-2024 11:36:17:286.001 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000010, Next state: 0x0000000000000040
[DEBUG] [03-06-2024 11:36:17:286.065 GMT] streamReadyHandler invoked
[DEBUG] [03-06-2024 11:36:17:286.102 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000040, Next state: 0x0000000000000080
[INFO ] [03-06-2024 11:36:17:286.760 GMT] putStreamResultEvent(): Put stream result event. New upload handle 1
[DEBUG] [03-06-2024 11:36:17:297.453 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000080, Next state: 0x0000000000000100
[DEBUG] [03-06-2024 11:36:17:297.605 GMT] fragmentAckReceivedHandler invoked
[DEBUG] [03-06-2024 11:36:17:297.665 GMT] Reporting fragment ack received. Ack timecode 1717414549487
[WARN ] [03-06-2024 11:36:17:298.816 GMT] getStreamData(): Indicating an end-of-stream for a terminated stream upload handle 0
[INFO ] [03-06-2024 11:36:17:300.483 GMT] postReadCallback(): Reported end-of-stream for stream FacialVideoStream. Upload handle: 0
[DEBUG] [03-06-2024 11:36:17:300.624 GMT] postReadCallback(): Wrote 0 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [03-06-2024 11:36:17:303.028 GMT] putStreamCurlHandler(): Network thread for Kinesis Video stream: FacialVideoStream with upload handle: 0 exited. http status: 200
[INFO ] [03-06-2024 11:36:18:129.248 GMT] writeHeaderCallback(): RequestId: f3bebbbc-03b4-35aa-ad69-174e7cc45707
[DEBUG] [03-06-2024 11:36:18:129.666 GMT] postReadCallback(): Pausing CURL read for upload handle: 1`
Beta Was this translation helpful? Give feedback.
All reactions