awslabs / amazon-kinesis-video-streams-producer-sdk-cpp

Amazon Kinesis Video Streams Producer SDK for C++ is for developers to install and customize for their connected camera and other devices to securely stream video, audio, and time-encoded data to Kinesis Video Streams.
Apache License 2.0
378 stars 336 forks source link

Stuck with RTSP Audio + Video #799

Closed luisberga closed 2 years ago

luisberga commented 2 years ago

Hello!

Below is my gts command:

gst-launch-1.0 rtspsrc name=src location="rtsp://192.168.14.5:5554/playlist.m3u" short-header=true do-timestamp=true ! rtph264depay ! h264parse ! kvssink name=sink stream-name="name" access-key="key" secret-key="secret" aws-region="sa-east-1" src. ! rtpmpadepay ! mpg123audiodec ! audioresample ! audioconvert ! voaacenc ! aacparse ! queue ! sink.

however, i'm getting this error:

...Setting pipeline to PLAYING ... New clock: GstSystemClock Progress: (request) Sending PLAY request Progress: (request) Sending PLAY request Progress: (request) Sent PLAY request WARNING: from element /GstPipeline:pipeline0/GstRTSPSrc:src/GstUDPSink:udpsink3: Error sending UDP packets Additional debug info: gstmultiudpsink.c(726): gst_multiudpsink_send_messages (): /GstPipeline:pipeline0/GstRTSPSrc:src/GstUDPSink:udpsink3: client 192.168.15.3:0, reason: Error sending message: Invalid argument INFO - kinesisVideoStreamFormatChanged(): Stream format changed. 2021-11-22 18:26:31 [140587632580352] WARNING: from element /GstPipeline:pipeline0/GstRTSPSrc:src: Delayed linking failed. Additional debug info: ./grammar.y(506): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstRTSPSrc:src: failed delayed linking some pad of GstRTSPSrc named src to some pad of GstRtpPcmaDepay named rtppcmadepay0 WARNING: from element /GstPipeline:pipeline0/GstRTSPSrc:src/GstUDPSink:udpsink1: Error sending UDP packets Additional debug info: gstmultiudpsink.c(726): gst_multiudpsink_send_messages (): /GstPipeline:pipeline0/GstRTSPSrc:src/GstUDPSink:udpsink1: client 192.168.14.5:0, reason: Error sending message: Invalid argument

And I've got stuck in this part... Anyone could help me?

Thanks!!

hassanctech commented 2 years ago

Can you please post which version of kvssink you are using? In addition as a first debugging step have you tried to change the sink to something like filesink and see if that works? This way we can help to narrow down if your issue is upstream near your source or truly with the plugin. I would first try the simplest pipeline and once you get it working try to add more of what you need. Also are you sure what is coming from the source is in fact h264 encoded?

luisberga commented 2 years ago

Hello!

I'm using version 1.0.

When I try just:

gst-launch-1.0 rtspsrc name=src location=rtsp://192.168.15.3:5554/playlist.m3u short-header=TRUE ! rtph264depay ! h264parse ! video/x-h264, format=avc,alignment=au ! kvssink name=sink stream-name=Teste1 storage-size=512 access-key=<> secret-key=<> aws-region=sa-east-1

The video works like a charm, but just the video... without audio.

I did try with filesink, but i got this error:

gst-launch-1.0 rtspsrc name=src location=rtsp://192.168.15.3:5554/playlist.m3u short-header=TRUE ! rtph264depay ! h264parse ! video/x-h264, format=avc,alignment=au ! filesink name=sink stream-name=Teste1 storage-size=512 access-key=<> secret-key=<> aws-region=sa-east-1 WARNING: erroneous pipeline: no property "stream-name" in element "sink"

Yes, what's coming from the source is h264 (the encoder that the source uses is OMX.google.h264.encoder)

hassanctech commented 2 years ago

The latter it is because filesink does not have those parameters you only need to supply it location parameter which is where to write the file.

hassanctech commented 2 years ago

Try that and let's see if you get audio kn the file. Then we can debug the audio part.

hassanctech commented 2 years ago

Also sorry I should have been more specific for the version, which version of the producer CPP SDK you're using to build the kvssink plugin?

luisberga commented 2 years ago

Hello!

Ahh, ok...

I tried to use filesink:

gst-launch-1.0 rtspsrc name=src location=rtsp://192.168.15.3:5554/playlist.m3u short-header=TRUE ! rtph264depay ! h264parse ! video/x-h264, format=avc,alignment=au ! filesink location=test.h264

But I got the following error:

Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... Progress: (open) Opening Stream Progress: (connect) Connecting to rtsp://192.168.15.3:5554/playlist.m3u Progress: (open) Retrieving server options Progress: (open) Retrieving media info Progress: (request) SETUP stream 0 Progress: (request) SETUP stream 1 Progress: (open) Opened Stream Setting pipeline to PLAYING ... New clock: GstSystemClock Progress: (request) Sending PLAY request Progress: (request) Sending PLAY request Progress: (request) Sent PLAY request WARNING: from element /GstPipeline:pipeline0/GstRTSPSrc:src/GstUDPSink:udpsink3: Error sending UDP packets Additional debug info: gstmultiudpsink.c(726): gst_multiudpsink_send_messages (): /GstPipeline:pipeline0/GstRTSPSrc:src/GstUDPSink:udpsink3: client 192.168.15.3:0, reason: Error sending message: Invalid argument

It's the same error when I use: gst-launch-1.0 rtspsrc name=src location=rtsp://192.168.15.3:5554/playlist.m3u short-header=TRUE ! rtph264depay ! h264parse ! video/x-h264, format=avc,alignment=au ! kvssink name=sink stream-name=Teste1 storage-size=512 access-key=<> secret-key=<> aws-region=sa-east-1

luisberga commented 2 years ago

I saw in VLC, the stream information is:

image

luisberga commented 2 years ago

Hello!

I suceed to misc audio and video (i'm using the bigbuckbunny rtsp example):

gst-launch-1.0 rtspsrc name=src location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4 short-header=TRUE ! queue ! rtph264depay ! h264parse ! kvssink name=sink stream-name=test storage-size=512 access-key=key secret-key=key aws-region=sa-east-1 src. ! queue ! rtpmp4gdepay ! aacparse ! sink.

However, I'm getting a lot of Warnings. I think that these warning can cause to my stream to get stuck in some points, freezing and start to loading to start again (resulting in big delay).

Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
[INFO ] [23-11-2021 02:35:26:277.890 GMT] kinesisVideoStreamFormatChanged(): Stream format changed.
[INFO ] [23-11-2021 02:35:26:282.389 GMT] kinesisVideoStreamFormatChanged(): Stream format changed.
[DEBUG] [23-11-2021 02:35:26:282.800 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000040, Next state: 0x0000000000000080
[INFO ] [23-11-2021 02:35:26:283.037 GMT] putStreamResultEvent(): Put stream result event. New upload handle 0
[DEBUG] [23-11-2021 02:35:26:293.248 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000080, Next state: 0x0000000000000100
[INFO ] [23-11-2021 02:35:26:455.420 GMT] writeHeaderCallback(): RequestId: id
[DEBUG] [23-11-2021 02:35:27:076.252 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[DEBUG] [23-11-2021 02:35:27:209.149 GMT] Kinesis Video client and stream metrics
    >> Overall storage byte size: 536870912
    >> Available storage byte size: 536870912
    >> Allocated storage byte size: 0
    >> Total view allocation byte size: 576080
    >> Total streams elementary frame rate (fps): 100
    >> Total streams transfer rate (bps): 33554432 (32768 Kbps)
    >> Current view duration (ms): 0
    >> Overall view duration (ms): 0
    >> Current view byte size: 0
    >> Overall view byte size: 0
    >> Current elementary frame rate (fps): 100
    >> Current transfer rate (bps): 33554432 (32768 Kbps)
[WARN ] [23-11-2021 02:35:27:502.799 GMT] putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 15388398 presentation timestamp: 16376349273998159
[WARN ] [23-11-2021 02:35:27:503.062 GMT] putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 15408398 presentation timestamp: 16376349274851492
[WARN ] [23-11-2021 02:35:27:503.250 GMT] putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 16361000 presentation timestamp: 16376349275704826
[WARN ] [23-11-2021 02:35:27:597.922 GMT] putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 17277764 presentation timestamp: 16376349276105254
[WARN ] [23-11-2021 02:35:27:696.508 GMT] putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 18265696 presentation timestamp: 16376349276929438
[WARN ] [23-11-2021 02:35:27:796.006 GMT] putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 19260070 presentation timestamp: 16376349278178799
[WARN ] [23-11-2021 02:35:27:896.890 GMT] putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 20277039 presentation timestamp: 16376349278598707
[WARN ] [23-11-2021 02:35:27:988.358 GMT] putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 20374491 presentation timestamp: 16376349279971492
[WARN ] [23-11-2021 02:35:27:996.553 GMT] putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 21269903 presentation timestamp: 16376349280678695
[DEBUG] [23-11-2021 02:35:28:077.563 GMT] postReadCallback(): Wrote 7073 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [23-11-2021 02:35:28:097.735 GMT] streamLatencyPressureHandler invoked
[DEBUG] [23-11-2021 02:35:28:097.824 GMT] Reported streamLatencyPressure callback for stream handle 94251739631512. Current buffer duration in 100ns: 18446744073708721616
[DEBUG] [23-11-2021 02:35:28:097.866 GMT] streamLatencyStateMachineHandleStreamLatency(): Stream Latency State Machine starting from NORMAL_STATE
[DEBUG] [23-11-2021 02:35:28:097.894 GMT] streamLatencyStateMachineToResetConnectionState(): Stream Latency State Machine move to RESET_CONNECTION_STATE
[DEBUG] [23-11-2021 02:35:28:097.932 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000100, Next state: 0x0000000000000200
[DEBUG] [23-11-2021 02:35:28:097.962 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000200, Next state: 0x0000000000000020
[WARN ] [23-11-2021 02:35:28:098.208 GMT] getStreamData(): Indicating an end-of-stream for a terminated stream upload handle 0
[INFO ] [23-11-2021 02:35:28:098.303 GMT] postReadCallback(): Reported end-of-stream for stream Teste1. Upload handle: 0
[DEBUG] [23-11-2021 02:35:28:098.340 GMT] postReadCallback(): Wrote 0 bytes to Kinesis Video. Upload stream handle: 0
[DEBUG] [23-11-2021 02:35:28:114.620 GMT] postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 0 returned: {"EventType":"BUFFERING","FragmentTimecode":1637634927209,"FragmentNumber":"91343852333188666914271646403834998996324041453"}

[WARN ] [23-11-2021 02:35:28:114.739 GMT] streamFragmentAckEvent(): An ACK is received for an already expired upload handle 0
[DEBUG] [23-11-2021 02:35:28:114.782 GMT] fragmentAckReceivedHandler invoked
[DEBUG] [23-11-2021 02:35:28:114.861 GMT] postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 0 returned: {"EventType":"RECEIVED","FragmentTimecode":1637634927209,"FragmentNumber":"91343852333188666914271646403834998996324041453"}

[WARN ] [23-11-2021 02:35:28:114.910 GMT] streamFragmentAckEvent(): An ACK is received for an already expired upload handle 0
[DEBUG] [23-11-2021 02:35:28:114.934 GMT] fragmentAckReceivedHandler invoked
[INFO ] [23-11-2021 02:35:28:195.398 GMT] writeHeaderCallback(): RequestId: 574a3720-ac21-4073-82da-a913026548dd
[DEBUG] [23-11-2021 02:35:28:195.572 GMT] getStreamingEndpointCurlHandler(): GetStreamingEndpoint API response: {"DataEndpoint":"endpoint"}
[INFO ] [23-11-2021 02:35:28:197.671 GMT] getStreamingEndpointResultEvent(): Get streaming endpoint result event.
[DEBUG] [23-11-2021 02:35:28:197.765 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000020, Next state: 0x0000000000000010
[DEBUG] [23-11-2021 02:35:28:197.830 GMT] getStreamingTokenHandler invoked
[DEBUG] [23-11-2021 02:35:28:197.874 GMT] Refreshing credentials. Force refreshing: 1 Now time is: 1637634928197867073 Expiration: 18446744073709551615
[INFO ] [23-11-2021 02:35:28:197.934 GMT] getStreamingTokenResultEvent(): Get streaming token result event.
[DEBUG] [23-11-2021 02:35:28:197.970 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000010, Next state: 0x0000000000000040
[DEBUG] [23-11-2021 02:35:28:197.998 GMT] streamReadyHandler invoked
[DEBUG] [23-11-2021 02:35:28:198.032 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000040, Next state: 0x0000000000000080
[INFO ] [23-11-2021 02:35:28:198.965 GMT] putStreamResultEvent(): Put stream result event. New upload handle 1
[DEBUG] [23-11-2021 02:35:28:209.167 GMT] stepStateMachine(): State Machine - Current state: 0x0000000000000080, Next state: 0x0000000000000100
[WARN ] [23-11-2021 02:35:28:209.361 GMT] putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 23304599 presentation timestamp: 16376349281518695
[WARN ] [23-11-2021 02:35:28:209.870 GMT] putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 23313297 presentation timestamp: 16376349281928695
[DEBUG] [23-11-2021 02:35:28:242.444 GMT] postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 0 returned: {"EventType":"PERSISTED","FragmentTimecode":1637634927209,"FragmentNumber":"91343852333188666914271646403834998996324041453"}

[WARN ] [23-11-2021 02:35:28:242.569 GMT] streamFragmentAckEvent(): An ACK is received for an already expired upload handle 0
[DEBUG] [23-11-2021 02:35:28:242.611 GMT] fragmentAckReceivedHandler invoked
[WARN ] [23-11-2021 02:35:28:299.413 GMT] putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 24296719 presentation timestamp: 16376349282768695
[DEBUG] [23-11-2021 02:35:28:332.885 GMT] postReadCallback(): Wrote 12322 bytes to Kinesis Video. Upload stream handle: 1
[INFO ] [23-11-2021 02:35:28:333.144 GMT] writeHeaderCallback(): RequestId: fd16b448-f910-53e6-a700-e1f87c6da81b
[DEBUG] [23-11-2021 02:35:28:473.665 GMT] postReadCallback(): Wrote 410 bytes to Kinesis Video. Upload stream handle: 1
[DEBUG] [23-11-2021 02:35:28:473.909 GMT] postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 1 returned: {"EventType":"BUFFERING","FragmentTimecode":1637634927209,"FragmentNumber":"91343852333188671866031803545356098659483817243"}

[DEBUG] [23-11-2021 02:35:28:473.989 GMT] fragmentAckReceivedHandler invoked
[DEBUG] [23-11-2021 02:35:28:493.354 GMT] streamLatencyPressureHandler invoked
[DEBUG] [23-11-2021 02:35:28:493.433 GMT] Reported streamLatencyPressure callback for stream handle 94251739631512. Current buffer duration in 100ns: 18446744073709131616
[DEBUG] [23-11-2021 02:35:28:494.213 GMT] postReadCallback(): Wrote 443 bytes to Kinesis Video. Upload stream handle: 1
[DEBUG] [23-11-2021 02:35:28:494.368 GMT] postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 1 returned: {"EventType":"RECEIVED","FragmentTimecode":1637634927209,"FragmentNumber":"91343852333188671866031803545356098659483817243"}

Do you know how to fix that Failed to submit frame to Kinesis Video client. ?

hassanctech commented 2 years ago

The error you're seeing 0x30000005 means STATUS_CONTENT_VIEW_INVALID_TIMESTAMP and looking at your DTS and PTS values they are not in the correct scale, please correct your timestamps that should resolve this issue.

luisberga commented 2 years ago

Good... how can I change my timestamp? xD

luisberga commented 2 years ago

When I use this:

gst-launch-1.0 rtspsrc name=src location=rtsp://192.168.15.3:5554/playlist.m3u ! queue ! rtph264depay ! h264parse ! mpegtsmux name=mux ! filesink location="test.ts" src. ! queue ! rtpmp4gdepay ! aacparse ! mux.

The video and audio work like a charm! However, when I try to send to Kinesis, with this pipe:

gst-launch-1.0 rtspsrc name=src location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4 short-header=TRUE ! queue ! rtph264depay ! h264parse ! mpegtsmux name=mux ! kvssink name=sink stream-name=test storage-size=512 access-key=key secret-key=key aws-region=sa-east-1 src. ! queue ! rtpmp4gdepay ! aacparse ! mux.

I got this error:

WARNING: erroneous pipeline: could not link mux to kvssink0

hassanctech commented 2 years ago

Can you run with GST_DEBUG=5 ?

hassanctech commented 2 years ago

I examined your timestamps the diff between the successive pts timestamps is:

853300 853400 400400 824200 1249300 420000 1372700 707200

It looks like your encoder is not consistent these diffs should roughly be the same value this will cause errors because the frames have durations so when a fragment ends if you try to insert a frame with a time code overlapping you will see other errors (I do not see indication of that right now) but it will most likely happen with an encoder which is not consistent.

You cannot send mux'd video to kvssink it will accept raw h264 (either annex b or avcc) so if you delete mpegtsmux name=mux from the pipeline with kvssink it should work.

luisberga commented 2 years ago

Hi!

With GST_DEBUG=5:

INFO - createKinesisVideoClient(): Creating Kinesis Video Client
2021-11-23 17:18:04 [139871915054144] INFO - heapInitialize(): Initializing native heap with limit size 536870912, spill ratio 0% and flags 0x00000001
2021-11-23 17:18:04 [139871915054144] INFO - heapInitialize(): Creating AIV heap.
2021-11-23 17:18:04 [139871915054144] INFO - heapInitialize(): Heap is initialized OK
2021-11-23 17:18:04 [139871915054144] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000001, Next state: 0x0000000000000002
2021-11-23 17:18:04 [139871915054144] DEBUG - getSecurityTokenHandler invoked
2021-11-23 17:18:04 [139871915054144] DEBUG - Refreshing credentials. Force refreshing: 0 Now time is: 1637698684874218140 Expiration: 0
2021-11-23 17:18:04 [139871915054144] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000010
2021-11-23 17:18:04 [139871915054144] INFO - createDeviceResultEvent(): Create device result event.
2021-11-23 17:18:04 [139871915054144] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000010, Next state: 0x0000000000000040
2021-11-23 17:18:04 [139871915054144] DEBUG - clientReadyHandler invoked
2021-11-23 17:18:04 [139871915054144] INFO - try creating stream
2021-11-23 17:18:04 [139871915054144] INFO - Creating Kinesis Video Stream Teste1
2021-11-23 17:18:04 [139871915054144] INFO - createKinesisVideoStream(): Creating Kinesis Video Stream.
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo(): Kinesis Video Stream Info
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Stream name: Teste1 
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Streaming type: STREAMING_TYPE_REALTIME 
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Content type: video/h264,audio/aac 
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Max latency (100ns): 600000000
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Fragment duration (100ns): 20000000
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Key frame fragmentation: Yes
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Use frame timecode: Yes
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Absolute frame timecode: Yes
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Nal adaptation flags: 0
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Average bandwith (bps): 4194304
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Framerate: 100
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Buffer duration (100ns): 1200000000
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Replay duration (100ns): 400000000
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Connection Staleness duration (100ns): 600000000
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Store Pressure Policy: 1
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  View Overflow Policy: 1
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Segment UUID: NULL
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Frame ordering mode: 5
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo(): Track list
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Track id: 1
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Track name: kinesis_video
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Codec id: V_MPEG4/ISO/AVC
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Track type: TRACK_INFO_TYPE_VIDEO
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Track cpd: NULL
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Track id: 2
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Track name: audio
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Codec id: A_AAC
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Track type: TRACK_INFO_TYPE_AUDIO
2021-11-23 17:18:04 [139871915054144] DEBUG - logStreamInfo():  Track cpd: NULL
2021-11-23 17:18:04 [139871915054144] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000001, Next state: 0x0000000000000002
2021-11-23 17:18:04 [139871915054144] INFO - writeHeaderCallback(): RequestId: 9c1d4e0d-f78a-450d-b4ee-eca7afeb7e7d
2021-11-23 17:18:04 [139871345846016] DEBUG - describeStreamCurlHandler(): DescribeStream API response: {"StreamInfo":{"CreationTime":1.637259545601E9,"DataRetentionInHours":2,"DeviceName":"Kinesis_Video_Device","IngestionConfiguration":null,"KmsKeyId":"arn:aws:kms:sa-east-1:259477352775:alias/aws/kinesisvideo","MediaType":"video/h264","Status":"ACTIVE","StreamARN":"arn:aws:kinesisvideo:sa-east-1:259477352775:stream/Teste1/1637259545601","StreamName":"test","Version":"dasdasdqwd222"}}
2021-11-23 17:18:04 [139871345846016] INFO - describeStreamResultEvent(): Describe stream result event.
2021-11-23 17:18:04 [139871345846016] WARN - describeStreamResult(): Content type returned from the DescribeStream call doesn't match the one specified in the StreamInfo
2021-11-23 17:18:04 [139871345846016] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000020
2021-11-23 17:18:04 [139871345846016] INFO - writeHeaderCallback(): RequestId: 4f35e68a-f8f5-4dd1-8439-5dd26460ea18
2021-11-23 17:18:05 [139871337453312] DEBUG - getStreamingEndpointCurlHandler(): GetStreamingEndpoint API response: {"DataEndpoint":"endpoint"}
2021-11-23 17:18:05 [139871337453312] INFO - getStreamingEndpointResultEvent(): Get streaming endpoint result event.
2021-11-23 17:18:05 [139871337453312] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000020, Next state: 0x0000000000000010
2021-11-23 17:18:05 [139871337453312] DEBUG - getStreamingTokenHandler invoked
2021-11-23 17:18:05 [139871337453312] DEBUG - Refreshing credentials. Force refreshing: 1 Now time is: 1637698685193199406 Expiration: 18446744073709551615
2021-11-23 17:18:05 [139871337453312] INFO - getStreamingTokenResultEvent(): Get streaming token result event.
2021-11-23 17:18:05 [139871337453312] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000010, Next state: 0x0000000000000040
2021-11-23 17:18:05 [139871337453312] DEBUG - streamReadyHandler invoked
2021-11-23 17:18:05 [139871337453312] Stream is ready
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (request) SETUP stream 1
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
INFO - kinesisVideoStreamFormatChanged(): Stream format changed.
2021-11-23 17:18:06 [139871345846016] INFO - kinesisVideoStreamFormatChanged(): Stream format changed.
2021-11-23 17:18:06 [139871337453312] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000040, Next state: 0x0000000000000080
2021-11-23 17:18:06 [139871345846016] INFO - putStreamResultEvent(): Put stream result event. New upload handle 0
2021-11-23 17:18:06 [139871345846016] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000080, Next state: 0x0000000000000100
2021-11-23 17:18:06 [139871345846016] DEBUG - postReadCallback(): Pausing CURL read for upload handle: 0
2021-11-23 17:18:07 [139870433437440] INFO - writeHeaderCallback(): RequestId: ecd751f1-26df-d972-b6c0-1f4f352fc3ef
2021-11-23 17:18:07 [139870433437440] DEBUG - Dropping frame with flag: 8768
2021-11-23 17:18:08 [139871345846016] DEBUG - Kinesis Video client and stream metrics
        >> Overall storage byte size: 536870912
        >> Available storage byte size: 536870912
        >> Allocated storage byte size: 0
        >> Total view allocation byte size: 576080
        >> Total streams elementary frame rate (fps): 100
        >> Total streams transfer rate (bps): 33554432 (32768 Kbps)
        >> Current view duration (ms): 0
        >> Overall view duration (ms): 0
        >> Current view byte size: 0
        >> Overall view byte size: 0
        >> Current elementary frame rate (fps): 100
        >> Current transfer rate (bps): 33554432 (32768 Kbps)
2021-11-23 17:18:08 [139871337453312] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 14493908 presentation timestamp: 16376986877920039
2021-11-23 17:18:08 [139871345846016] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 14595979 presentation timestamp: 16376986875834824
2021-11-23 17:18:08 [139871345846016] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 14597093 presentation timestamp: 16376986878271933
2021-11-23 17:18:08 [139871337453312] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 16612376 presentation timestamp: 16376986879452105
2021-11-23 17:18:08 [139871337453312] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 17619898 presentation timestamp: 16376986879865485
2021-11-23 17:18:08 [139871337453312] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 18635135 presentation timestamp: 16376986880693585
2021-11-23 17:18:08 [139871345846016] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 18636016 presentation timestamp: 16376986881523314
2021-11-23 17:18:08 [139871337453312] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 19651578 presentation timestamp: 16376986882773177
2021-11-23 17:18:08 [139871337453312] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 20671095 presentation timestamp: 16376986884023173
2021-11-23 17:18:08 [139871337453312] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 21532266 presentation timestamp: 16376986884746706
2021-11-23 17:18:08 [139871337453312] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 22666574 presentation timestamp: 16376986884863173
2021-11-23 17:18:08 [139871345846016] DEBUG - Kinesis Video client and stream metrics
        >> Overall storage byte size: 536870912
        >> Available storage byte size: 536858307
        >> Allocated storage byte size: 12605
        >> Total view allocation byte size: 576080
        >> Total streams elementary frame rate (fps): 112
        >> Total streams transfer rate (bps): 33554432 (32768 Kbps)
        >> Current view duration (ms): 981
        >> Overall view duration (ms): 981
        >> Current view byte size: 11405
        >> Overall view byte size: 11405
        >> Current elementary frame rate (fps): 12.0482
        >> Current transfer rate (bps): 33554432 (32768 Kbps)
2021-11-23 17:18:08 [139871337453312] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x32000002 decoding timestamp: 23673596 presentation timestamp: 16376986885693173
2021-11-23 17:18:08 [139871345846016] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 24691213 presentation timestamp: 16376986886943173
2021-11-23 17:18:08 [139871345846016] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 24693164 presentation timestamp: 16376986888610581
2021-11-23 17:18:08 [139871337453312] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 25678720 presentation timestamp: 16376986889016486
2021-11-23 17:18:08 [139871345846016] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 26722873 presentation timestamp: 16376986889430421
2021-11-23 17:18:08 [139871337453312] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 27708506 presentation timestamp: 16376986890255462
2021-11-23 17:18:08 [139871345846016] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 28738505 presentation timestamp: 16376986891090582
2021-11-23 17:18:09 [139871345846016] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 29744708 presentation timestamp: 16376986892743408
2021-11-23 17:18:09 [139871345846016] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 30744509 presentation timestamp: 16376986894406404
2021-11-23 17:18:09 [139871337453312] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 31623636 presentation timestamp: 16376986895000762
2021-11-23 17:18:09 [139871337453312] DEBUG - postReadCallback(): Wrote 13333 bytes to Kinesis Video. Upload stream handle: 0
2021-11-23 17:18:09 [139870433437440] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 32766931 presentation timestamp: 16376986895225100
2021-11-23 17:18:09 [139871337453312] DEBUG - postReadCallback(): Wrote 4889 bytes to Kinesis Video. Upload stream handle: 0
2021-11-23 17:18:09 [139870433437440] DEBUG - postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 0 returned: {"EventType":"BUFFERING","FragmentTimecode":1637698687546,"FragmentNumber":"91343852333191469610520588504794486392407257964"}

2021-11-23 17:18:09 [139870433437440] DEBUG - fragmentAckReceivedHandler invoked
2021-11-23 17:18:09 [139870433437440] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x32000002 decoding timestamp: 33776384 presentation timestamp: 16376986896892893
2021-11-23 17:18:09 [139871345846016] DEBUG - streamLatencyPressureHandler invoked
2021-11-23 17:18:09 [139871337453312] DEBUG - Reported streamLatencyPressure callback for stream handle 94646786758904. Current buffer duration in 100ns: 18446744073708901616
2021-11-23 17:18:09 [139871337453312] DEBUG - streamLatencyStateMachineHandleStreamLatency(): Stream Latency State Machine starting from NORMAL_STATE
2021-11-23 17:18:09 [139871337453312] DEBUG - streamLatencyStateMachineToResetConnectionState(): Stream Latency State Machine move to RESET_CONNECTION_STATE
2021-11-23 17:18:09 [139871337453312] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000100, Next state: 0x0000000000000200
2021-11-23 17:18:09 [139871337453312] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000200, Next state: 0x0000000000000020
2021-11-23 17:18:09 [139871337453312] DEBUG - streamLatencyPressureHandler invoked
2021-11-23 17:18:09 [139871337453312] DEBUG - Reported streamLatencyPressure callback for stream handle 94646786758904. Current buffer duration in 100ns: 18446744073708471616
2021-11-23 17:18:09 [139871337453312] WARN - getStreamData(): Indicating an end-of-stream for a terminated stream upload handle 0
2021-11-23 17:18:09 [139870433437440] INFO - postReadCallback(): Reported end-of-stream for stream Teste1. Upload handle: 0
2021-11-23 17:18:09 [139870433437440] DEBUG - postReadCallback(): Wrote 0 bytes to Kinesis Video. Upload stream handle: 0
2021-11-23 17:18:09 [139870433437440] DEBUG - postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 0 returned: {"EventType":"RECEIVED","FragmentTimecode":1637698687546,"FragmentNumber":"91343852333191469610520588504794486392407257964"}

2021-11-23 17:18:09 [139870433437440] WARN - streamFragmentAckEvent(): An ACK is received for an already expired upload handle 0
2021-11-23 17:18:09 [139870433437440] DEBUG - fragmentAckReceivedHandler invoked
2021-11-23 17:18:09 [139870433437440] DEBUG - postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 0 returned: {"EventType":"BUFFERING","FragmentTimecode":1637698688527,"FragmentNumber":"91343852333191469615472348661936007493524558005"}

2021-11-23 17:18:09 [139870433437440] WARN - streamFragmentAckEvent(): An ACK is received for an already expired upload handle 0
2021-11-23 17:18:09 [139870433437440] DEBUG - fragmentAckReceivedHandler invoked
2021-11-23 17:18:09 [139870433437440] DEBUG - postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 0 returned: {"EventType":"PERSISTED","FragmentTimecode":1637698687546,"FragmentNumber":"91343852333191469610520588504794486392407257964"}

2021-11-23 17:18:09 [139870433437440] WARN - streamFragmentAckEvent(): An ACK is received for an already expired upload handle 0
2021-11-23 17:18:09 [139870433437440] DEBUG - fragmentAckReceivedHandler invoked
2021-11-23 17:18:09 [139870433437440] DEBUG - postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 0 returned: {"EventType":"RECEIVED","FragmentTimecode":1637698688527,"FragmentNumber":"91343852333191469615472348661936007493524558005"}

2021-11-23 17:18:09 [139870433437440] WARN - streamFragmentAckEvent(): An ACK is received for an already expired upload handle 0
2021-11-23 17:18:09 [139870433437440] DEBUG - fragmentAckReceivedHandler invoked
2021-11-23 17:18:09 [139870433437440] DEBUG - postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 0 returned: {"EventType":"BUFFERING","FragmentTimecode":1637698689522,"FragmentNumber":"91343852333191469620424108819077528629899444298"}

2021-11-23 17:18:09 [139870433437440] WARN - streamFragmentAckEvent(): An ACK is received for an already expired upload handle 0
2021-11-23 17:18:09 [139870433437440] DEBUG - fragmentAckReceivedHandler invoked
2021-11-23 17:18:09 [139870433437440] DEBUG - postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 0 returned: {"EventType":"ERROR","FragmentTimecode":1637698689522,"FragmentNumber":"91343852333191469620424108819077528629899444298","ErrorCode":"FRAMES_MISSING_FOR_TRACK","ErrorId":4011}

2021-11-23 17:18:09 [139870433437440] WARN - streamFragmentAckEvent(): An ACK is received for an already expired upload handle 0
2021-11-23 17:18:09 [139870433437440] DEBUG - fragmentAckReceivedHandler invoked
2021-11-23 17:18:09 [139870433437440] DEBUG - putStreamCurlHandler(): Network thread for Kinesis Video stream: Teste1 with upload handle: 0 exited. http status: 200
2021-11-23 17:18:09 [139870433437440] INFO - writeHeaderCallback(): RequestId: e6233e2c-7b74-46dd-9e34-98c83e367424
2021-11-23 17:18:09 [139870425044736] DEBUG - getStreamingEndpointCurlHandler(): GetStreamingEndpoint API response: {"DataEndpoint":"https://s-d45ffc09.kinesisvideo.sa-east-1.amazonaws.com"}
2021-11-23 17:18:09 [139870425044736] INFO - getStreamingEndpointResultEvent(): Get streaming endpoint result event.
2021-11-23 17:18:09 [139870425044736] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000020, Next state: 0x0000000000000010
2021-11-23 17:18:09 [139870425044736] DEBUG - getStreamingTokenHandler invoked
2021-11-23 17:18:09 [139870425044736] DEBUG - Refreshing credentials. Force refreshing: 1 Now time is: 1637698689582220449 Expiration: 18446744073709551615
2021-11-23 17:18:09 [139870425044736] INFO - getStreamingTokenResultEvent(): Get streaming token result event.
2021-11-23 17:18:09 [139870425044736] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000010, Next state: 0x0000000000000040
2021-11-23 17:18:09 [139870425044736] DEBUG - streamReadyHandler invoked
2021-11-23 17:18:09 [139870425044736] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000040, Next state: 0x0000000000000080
2021-11-23 17:18:09 [139870425044736] INFO - putStreamResultEvent(): Put stream result event. New upload handle 1
2021-11-23 17:18:09 [139870425044736] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000080, Next state: 0x0000000000000100
2021-11-23 17:18:09 [139870425044736] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 34766858 presentation timestamp: 16376986898554241
2021-11-23 17:18:09 [139871337453312] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 35787528 presentation timestamp: 16376986899274351
2021-11-23 17:18:09 [139871345846016] DEBUG - postReadCallback(): Wrote 19034 bytes to Kinesis Video. Upload stream handle: 1
2021-11-23 17:18:09 [139870433437440] INFO - writeHeaderCallback(): RequestId: d3b898a6-ebe8-e1e3-89af-d667f9a1b83c
2021-11-23 17:18:09 [139870433437440] DEBUG - streamLatencyPressureHandler invoked
2021-11-23 17:18:09 [139871337453312] DEBUG - Reported streamLatencyPressure callback for stream handle 94646786758904. Current buffer duration in 100ns: 18446744073709141616
2021-11-23 17:18:09 [139871337453312] DEBUG - postReadCallback(): Wrote 76 bytes to Kinesis Video. Upload stream handle: 1
2021-11-23 17:18:09 [139870433437440] DEBUG - postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 1 returned: {"EventType":"BUFFERING","FragmentTimecode":1637698687546,"FragmentNumber":"91343852333191474562280745646315586086303734012"}

2021-11-23 17:18:09 [139870433437440] DEBUG - fragmentAckReceivedHandler invoked
2021-11-23 17:18:09 [139870433437440] DEBUG - postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 1 returned: {"EventType":"RECEIVED","FragmentTimecode":1637698687546,"FragmentNumber":"91343852333191474562280745646315586086303734012"}

2021-11-23 17:18:09 [139870433437440] DEBUG - fragmentAckReceivedHandler invoked
2021-11-23 17:18:09 [139870433437440] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 36851177 presentation timestamp: 16376986899373810
2021-11-23 17:18:09 [139871337453312] DEBUG - postReadCallback(): Wrote 165 bytes to Kinesis Video. Upload stream handle: 1
2021-11-23 17:18:09 [139870433437440] DEBUG - postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 1 returned: {"EventType":"BUFFERING","FragmentTimecode":1637698688527,"FragmentNumber":"91343852333191474567232505803457107188639917374"}

2021-11-23 17:18:09 [139870433437440] DEBUG - fragmentAckReceivedHandler invoked
2021-11-23 17:18:09 [139870433437440] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 37831448 presentation timestamp: 16376986900201773
2021-11-23 17:18:09 [139871345846016] DEBUG - streamLatencyPressureHandler invoked
2021-11-23 17:18:09 [139871337453312] DEBUG - Reported streamLatencyPressure callback for stream handle 94646786758904. Current buffer duration in 100ns: 18446744073709131616
2021-11-23 17:18:09 [139871337453312] DEBUG - postReadCallback(): Wrote 132 bytes to Kinesis Video. Upload stream handle: 1
2021-11-23 17:18:09 [139870433437440] DEBUG - postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 1 returned: {"EventType":"RECEIVED","FragmentTimecode":1637698688527,"FragmentNumber":"91343852333191474567232505803457107188639917374"}

2021-11-23 17:18:09 [139870433437440] DEBUG - fragmentAckReceivedHandler invoked
2021-11-23 17:18:09 [139870433437440] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 38914806 presentation timestamp: 16376986901443789
2021-11-23 17:18:10 [139871337453312] DEBUG - postReadCallback(): Wrote 358 bytes to Kinesis Video. Upload stream handle: 1
2021-11-23 17:18:10 [139870433437440] DEBUG - postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 1 returned: {"EventType":"BUFFERING","FragmentTimecode":1637698689522,"FragmentNumber":"91343852333191474572184265960598628288221217755"}

2021-11-23 17:18:10 [139870433437440] DEBUG - fragmentAckReceivedHandler invoked
2021-11-23 17:18:10 [139870433437440] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 39921354 presentation timestamp: 16376986903109892
2021-11-23 17:18:10 [139871345846016] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 40841132 presentation timestamp: 16376986903548699
2021-11-23 17:18:10 [139871337453312] DEBUG - postReadCallback(): Wrote 858 bytes to Kinesis Video. Upload stream handle: 1
2021-11-23 17:18:10 [139870433437440] DEBUG - postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 1 returned: {"EventType":"PERSISTED","FragmentTimecode":1637698687546,"FragmentNumber":"91343852333191474562280745646315586086303734012"}

2021-11-23 17:18:10 [139870433437440] DEBUG - fragmentAckReceivedHandler invoked
2021-11-23 17:18:10 [139870433437440] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 40961211 presentation timestamp: 16376986904354162
2021-11-23 17:18:10 [139871337453312] DEBUG - postReadCallback(): Wrote 757 bytes to Kinesis Video. Upload stream handle: 1
2021-11-23 17:18:10 [139870433437440] DEBUG - postWriteCallback(): Curl post body write function for stream with handle: Teste1 and upload handle: 1 returned: {"EventType":"PERSISTED","FragmentTimecode":1637698688527,"FragmentNumber":"91343852333191474567232505803457107188639917374"}

2021-11-23 17:18:10 [139870433437440] DEBUG - fragmentAckReceivedHandler invoked
2021-11-23 17:18:10 [139870433437440] DEBUG - postReadCallback(): Wrote 356 bytes to Kinesis Video. Upload stream handle: 1
2021-11-23 17:18:10 [139870433437440] WARN - putKinesisVideoFrame(): Failed to submit frame to Kinesis Video client. status: 0x30000005 decoding timestamp: 42897129 presentation timestamp: 16376986904768569
2021-11-23 17:18:10 [139871345846016] DEBUG - Kinesis Video client and stream metrics
        >> Overall storage byte size: 536870912
        >> Available storage byte size: 536857642
        >> Allocated storage byte size: 13270
        >> Total view allocation byte size: 576080
        >> Total streams elementary frame rate (fps): 136
        >> Total streams transfer rate (bps): 27377848 (26736 Kbps)
        >> Current view duration (ms): 41
        >> Overall view duration (ms): 995
        >> Current view byte size: 3774
        >> Overall view byte size: 12022
        >> Current elementary frame rate (fps): 24.4999
        >> Current transfer rate (bps): 27377848 (26736 Kbps)
2021-11-23 17:18:10 [139871337453312] DEBUG - postReadCallback(): Wrote 3774 bytes to Kinesis Video. Upload stream handle: 1

Yes, if i delete mpegtsmux name=mux it works, but I got the 0x30000005 error... What should I do, in this case? Since my video stream has this infos:

image

Which codec did you suggest and how can I implement?

hassanctech commented 2 years ago

Yes we're back to the original problem you have to figure out your video source and why it's not producing frames with the proper pts values and why they are all over the place and not consistent. If it's 24fps your frames should be ~approx 42ms apart. Here it looks like you're feeding from some publicly available test video source, what is your actual production use case where will the video come from, if the video source there doesn't have this issue then we might be wasting time debugging why this public source doesn't have correct pts/dts values.

One way to correct it is to have an appsink element then in your code you implement a callback (you will not be able to do this with gst-launch you have to write some code to do it) which modifies the pts values and then an appsrc to pick up the changed timestamp in the buffer, the callback would be trivial all it does is set a correct pts. That's ok if you want to test but really your source needs to produce the correct pts value. You can probably use ffmpeg to rewrite those values as well.

luisberga commented 2 years ago

Hi Hassan.

Unfortunately, I don't have control of my video source... How can I use ffmpeg to rewrite those values?

Thanks

hassanctech commented 2 years ago

There is another issue, I looked at your more detailed logs and I see failures with reason: FRAMES_MISSING_FOR_TRACK you can see documentation here explaining this error: https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/API_dataplane_PutMedia.html

This will happen if you have both audio/video tracks and one of the tracks is missing frames for a fragment. This will be rejected by the backend which is what is happening in your case as shown in the logs.

Unfortunately we cannot provide support how to rewrite those values but if you search ffmpeg or GStreamer forums you should be able to get help from there.

hassanctech commented 2 years ago

Also please make sure you're using the latest release 3.2.0: https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp/releases

luisberga commented 2 years ago

Thank you, Hassan!

I'm using the last version.

Appreciated.