0

I am using OpenCV and FFMPEG to capture frames from a network camera using RTSP. The point is that OpenCV successfully loads the FFMPEG .dll but icvCreateFileCapture_FFMPEG_p returns false in the following code of cap_ffmpeg.cpp:

virtual bool open( const char* filename )
{
    close();

    icvInitFFMPEG();
    if( !icvCreateFileCapture_FFMPEG_p )
        return false;
    ffmpegCapture = icvCreateFileCapture_FFMPEG_p( filename );
    return ffmpegCapture != 0;
}
sashoalm
  • 75,001
  • 122
  • 434
  • 781
Didac Perez Parera
  • 3,734
  • 3
  • 52
  • 87

1 Answers1

0

Probably the stream is not ready or you have problems with the network address/access. Check this if you have followed the correct way of doing it. Try pining the network resource first and see if it is available or not. The camera also must allow un-authenticated access, set via its web interface. Sometimes MJPEG works and MPEG4 has problems.

Community
  • 1
  • 1
  • The stream is ready since I am connected using VLC with the same exactly path. – Didac Perez Parera Oct 29 '12 at 10:30
  • Does the stream play on VLC? if it does, make sure the data being sent to OpenCV is in a supported format. –  Oct 29 '12 at 10:31
  • 1
    Yes it does, and VLC uses ffmpeg (x264) via live555, so I think OpenCV does the same. – Didac Perez Parera Oct 29 '12 at 10:35
  • I don't believe VLC uses live555 , just ffmpeg and I openCV has an interface highGUI that does not use live 555 either. the udp port 554 could be blocked. – Michelle Cannon Oct 29 '12 at 20:02
  • Dear Michelle, VLC does use live555. Just capture packets using Wireshark and you will see what VLC says in the RTSP handshake ;-) Port 554 is not blocked since my firewall is set to off. OpenCV loads the dll of FFMPEG returning a successful pointer to icvCreateFileCapture_FFMPEG_p but when calling the function it returns always 0 (NULL). Thanks anyway. – Didac Perez Parera Oct 30 '12 at 07:53
  • 1
    Not to beat a dead horse, but you can optionally enable vlc --enable-live555 \ Not sure whats parts it uses because I know vlc can work with just ffmpeg selected. So maybe I am partially wrong, but live555 is not all that good anyway, I know c++ very well but even for us its difficult to build a halfway decent client with that library – Michelle Cannon Nov 02 '12 at 17:01