开发者

Search for i-frame in RTP Packet

开发者 https://www.devze.com 2023-02-15 05:23 出处:网络
I am implementing RTSP in C# using an Axis IP Camera. Everything is working fine but when i try to display the video, I am getting first few frames with lots of Green Patches. I suspect the issue that

I am implementing RTSP in C# using an Axis IP Camera. Everything is working fine but when i try to display the video, I am getting first few frames with lots of Green Patches. I suspect the issue that I am not sending the i-frame first to the client.

Hence, I want to know the algorithm required t开发者_Python百科o detect an i-frame in RTP Packet.


when initiating a RTSP-Session the server normaly starts the RTP-stream with config-data followed by the first I-Frame.

It is thinkable, that your Axis-camera is set to "always multicast" - in this case the RTSP-communication leads to a SDP description which tells the client all necessary network and streaming details for receiving the multicast stream.

Since the multicast stream is always present, you most probably receive some P- or B- frames first (depending on GOP-size).

You can detect these P/B-frames in your RTP client the same way you were detecting the I-frames as suggested by Ralf by identyfieng them via the NAL-unit type. Simply skip all frames in the RTP client until you receive the first I-frame. Now you can forward all following frames to the decoder.

or you gave to change you camera settings!

jens.

ps: don't forget that you have fragmentation in your RTP stream - that means that beside of the RTP header there are some fragmentation information. Before identifying a frame you have to reassemble it.


It depends on the video media type. If you take H.264 for instance, you would look at the NAL unit header to check the nal unit type.

The green patches can indeed be caused by not having received an iframe first.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号