user2500472
user2500472

Reputation: 31

OpenCV RTSP H264 capture

I am using OpenCV 2.4.5 on windows 7 to capture RTSP stream.But I am getting some corrupt images in between.I found that the error is in decoding in ffmpeg layer.I want to drop these corrupt frames.But I am not able to do that because opencv Mat::empty never returns true. What could be the root cause of this and please let me know the solution for the same.

Here is an image for the reference:

Upvotes: 2

Views: 4814

Answers (2)

Anky
Anky

Reputation: 11

One fix to be this problem could be to force the RTSP protocol to use TCP as a transport. you can append ?tcp into your URL e.g. rtsp://ip-address:port/xyz?tcp then pass it to open method.

This solution worked for me and I have tried with Axis, D-Link, Acti and Panasonic.

Upvotes: 1

Sergio Basurco
Sergio Basurco

Reputation: 4298

I'm using 2.4.6 and no such frames. Nevertheless, ffmpeg is known to have issues with parsing h264 frames. Look for ffmpeg h264 parser patch or similar. Building ffmpeg with the patch and using it in your project should solve it.

Upvotes: 0

Related Questions