I had wrote a program that successfully get raspberry pi camera video and apply some image processing on it like the followings:
#include <opencv2/opencv.hpp>
VideoCapture vcap;
Mat Frame;
...
vcap.open(0);
while(true)
{
vcap >> Frame;
...
imshow("Output Window", Frame);
waitKey(1);
}
Because of limitation of raspberry camera (lux, shutter, etc) I bought an IP camera and try to use its video using rtsp:
vcap.open("rtsp://admin:[email protected]");
I get the video but it's distorted like the following picture:
As seen in the picture there are errors in the console:
error while decding MB n, bytestream m
cabac decode of gscale diff failed at n m
I have test with VLC on raspberry but it only get one single frame and CPU goes 100%, even reducing resolution, bitrate, fps doesn't change. I can view rtsp video in the raspberry using omxplayer. Also there isn't any problem on my PC.
I have installed Raspbian Jessie on my raspberry pi.
I also recompiled OpenCV using GStreamer insted of FFMPEG but didn't change anything:
cmake ... -D WITH_FFMPEG=OFF -D WITH_GSTREAMER=ON ...
Compiling and installing OpenCV 3.2 resolved the problem, finally I have successfully got the picture from my IP camera.
Other methods that I've tested without any results consist of compiling and installing the latest FFMPEG package, also installing all dependencies suggested by this site.