[QUESTION] kvssink keeps dropping frames from an rtsp source #1008
-
I'm trying to stream to KVS several rtsp flows (video only). I built my environment exactly how it is described here: https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp#build. However, kvssink keeps dropping frames with this message:
and the KVS stream remains empty. Case 1: foo (not working)Here is my command for the camera foo: $ gst-launch-1.0 -v rtspsrc location="rtsp://user:pass@foo" short-header=TRUE ! rtph264depay ! h264parse ! kvssink stream-name="YourStreamName" storage-size=128 access-key="aaa" secret-key="aaa" aws-region="eu-central-1" and here is the output Here is the $ gst-launch-1.0 rtspsrc location="rtsp://user:pass@foo" ! rtph264depay ! capsfilter caps="video/x-h264" ! fakesink here is the output Even in VLC, the video is properly streamed. Case 2: bar (working!)I tried the same command with another camera (bar) and in that case, all the things work: $ gst-launch-1.0 -v rtspsrc location="rtsp://user:pass@bar" short-header=TRUE ! rtph264depay ! h264parse ! kvssink stream-name="YourStreamName" storage-size=128 access-key="aaa" secret-key="aaa" aws-region="eu-central-1" and here is the output Case 3: baz (not working, again)Strangely enough, if I try with the camera baz (same model of camera bar), things do not work again (dropped frames). $ gst-launch-1.0 -v rtspsrc location="rtsp://user:pass@baz" short-header=TRUE ! rtph264depay ! h264parse ! kvssink stream-name="YourStreamName" storage-size=128 access-key="aaa" secret-key="aaa" aws-region="eu-central-1" here is the output Here is the $ gst-launch-1.0 -v rtspsrc location="rtsp://user:pass@baz" short-header=TRUE ! rtph264depay ! h264parse ! fakesink and here is the output Again, baz streams properly to VLC. Unfortunately, I can't access to any camera control panel. I can just consume the rtsp streams as they are. I'd kindly ask you some help on how to troubleshoot this kind of problem. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
The frame dropping message should be benign. Here are the frame flags: So I did notice this in your logs:
If you know you will not support UDP in order to avoid this latency you can set this property: https://gstreamer.freedesktop.org/documentation/rtsp/rtspsrc.html?gi-language=c#rtspsrc:protocols to only In theory fixing the above to TCP only with your network configuration shouldn't fix the issue but I wouldn't be surprised if there were some extra issues that show up when you're renegotiating the rtsp stream the camera so I would definitely suggest to make this change if you know you will not support UDP. This likely will not fix your issue but I see your terminate the pipeline in the foo case after 13s. Can you please try to run it for 1-2 minutes and see if we can get some error codes returned from the SDK to be printed in the logs? |
Beta Was this translation helpful? Give feedback.
-
Thank you @hassanctech for your suggestions. Here is the longer log for the camera foo: And here is the same log with the property Plese note that in both cases I get in Kinesis :
|
Beta Was this translation helpful? Give feedback.
-
I build the project from e99e7e9. This is the corresponding section of the file you mentioned at that commit: amazon-kinesis-video-streams-producer-sdk-cpp/src/gstreamer/gstkvssink.cpp Lines 1101 to 1104 in e99e7e9 Do you mean something like this? if (isDroppable) {
LOG_DEBUG("Dropping frame with flag: " << GST_BUFFER_FLAGS(buf) << ", PTS: " << buf->pts << ", DTS: " << buf->dts << " for " << kvssink->stream_name);
goto CleanUp;
} Sorry if my question is trivial. |
Beta Was this translation helpful? Give feedback.
-
Ok, I have just run the command with the customized build with info about pts and dts for the camera foo. gst-launch-1.0 -v rtspsrc protocols=tcp location="rtsp://foo" short-header=TRUE ! rtph264depay ! h264parse ! kvssink stream-name="YourStreamName" storage-size=128 access-key="foo-credential" secret-key="foo" aws-region="eu-central-1" Here is the complete log: foo_tcp_pts_dts.log It looks like no frame is put into the Kinesis stream. |
Beta Was this translation helpful? Give feedback.
Okay, so I went through the logs and as suspected it is a timestamp corruption issue.
2023-05-09 09:18:27 [140627329136192] DEBUG - Dropping frame with flag: 1536, PTS: 208075878, DTS: 18446744073709551615 for YourStreamName
The DTS value is a max int value. If this is not correctable by the source then you can edit this line in the kvssink:
amazon-kinesis-video-streams-producer-sdk-cpp/src/gstreamer/gstkvssink.cpp
Line 1288 in 63537aa
And remove the check on the DTS.
so this line should now be something like: