Now I have a IP camera. I tried to get a image through ffmpeg (like this : ffmpeg -rtsp_transport tcp -i "my rtsp stream address" -y -f image2 test.jpg ).That's OK! Or I tried to do this through opencv,no problem too.But when I open the stream in vlc,At the same time,I tried to capture the image ,oh,I just got a gray image. why? if I open the stream in vlc two times,that's also OK! If capturing the image and view the rtsp stream together,just got a gray image.Is the reason of IP camera?normal imagegray image
Try this https://gist.github.com/jamek/1dda2add62b3f7ac415a
g++ -s -o ffmpeg_rtsp rtsp.cpp -lavcodec -lavutil -lswscale -lavformat
Run: ./ffmpeg_rtsp "your rtsp stream address"