Laex / Delphi-OpenCV

Project Delphi-OpenCV. Translation of OpenCV library header files in Delphi
500 stars 226 forks source link

RTSP H264 decoding error #119

Closed cedmarf closed 5 years ago

cedmarf commented 5 years ago

Hello, I tried to decode an RTSP H264 steam from my IP cam and i have decoding error like this 👍 [h264 @ 0247bfe0] error while decoding MB 10 30, bytestream (-10) [h264 @ 02d1b020] error while decoding MB 25 1, bytestream (-11) [h264 @ 0247bfe0] error while decoding MB 1 30, bytestream (-6) [h264 @ 0307b7e0] error while decoding MB 71 23, bytestream (-6) [h264 @ 030de2e0] error while decoding MB 58 7, bytestream (-8)

I use the sample program FaceDetect; I juste change these lines 👍

//capture := cvCreateCameraCapture(CAMERA_INDEX); rtsp := AnsiString(StreamingURL); capture := cvCreateFileCapture(pAnsiChar(rtsp));

The streaming started and error occurs. The IP CAM stream works well with VLC player. Regards.

Laex commented 5 years ago

Not all IP cameras are equally good and send a fully valid video stream. The VLC and FFMPEG developers are aware of this and correct the video stream. Try ffmpeg -i "rtsp address" and you will see that there are a lot of errors in the stream. OpenCV does not fix the error; it simply cannot decode the stream. Use FFMPEG or VLC to receive and decode the stream, and give the resulting frame (image) to OpenCV. See the sources TocvFFMpegIPCamSourceThread.Execute;

cedmarf commented 5 years ago

Hi, Thank you for your reply. And of course, thank you very much for sharing your work. Regards.