[Libav-user] How to connect to an IP camera in libav

Brian Martin brian at caelumspace.com
Thu Nov 29 14:07:16 CET 2012



I'm trying to connect to a Foscam MJpeg IP camera (http) using libav on
Windows and am getting an error code of -5 after 


AVFormatContext *pFormatCtx=NULL;

                int             i, videoStream;

                AVCodecContext  *pCodecCtx;

                AVCodec         *pCodec;

                AVFrame         *pFrame; 

                AVFrame         *pFrameRGB;

                AVPacket        packet;

                int             frameFinished;

                int             numBytes;

                uint8_t         *buffer;

                struct SwsContext *img_convert_ctx;

                int frameCount=0;


                if(!videoStreamAddress) {

                                printf("Please provide a movie file\n");

                                return -1;


                // Register all formats and codecs




                //Open video file

                if(avformat_open_input(&pFormatCtx, videoStreamAddress,


                                printf("Couldn't open file %s\n",

                                return -1; // Couldn't open file



I tried to get the string value of this error but am getting a write
protected memory error using the built-in av_strerror command.

Any ideas would be appreciated. Thanks!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20121129/baad0226/attachment.html>

More information about the Libav-user mailing list