Hi. I have a problem reading the MJPEG stream from an IP camera. Program successfully reads the stream (server also accepts new connection) and while the stream is streaming program waits in "av_find_stream_info()" forever, that is until i shut down the stream. Then it successfully encodes everything in one go.
I would like to encode frame-by-frame as they are coming so I can manipulate length and store the movies and pictures, but for that I need to get out of the "av_find_stream_info()". Is there a way? Code goes like this (Taken from a post http://www.nabble.com/how-to-grab-video-from-a-IP-camera-td20782070.html#a20782070 how to grab video from a IP camera ) int main(int argc, char *argv[]) { AVFormatContext *m_pFormatCtx; int i, m_videoStream; AVCodecContext *m_pCodecCtx; AVCodec *m_pCodec; AVFrame *pFrame; AVFrame *pFrameRGB; AVPacket packet; AVInputFormat *m_fmt; int frameFinished; int numBytes; uint8_t *buffer; if(argc < 2) { printf("Please provide a movie file\n"); return -1; } // Register all formats and codecs av_register_all(); m_fmt = av_find_input_format("mjpeg"); if (!m_fmt) { fprintf(stderr, "Unknown input format: mjpeg\n"); return -1; } // Open video file if(av_open_input_file(&m_pFormatCtx, argv[1], m_fmt, 0, NULL)!=0) { fprintf(stderr, "Couldn't open file\n"); return -1; // Couldn't open file } // Retrieve stream information if(av_find_stream_info(m_pFormatCtx)<0) { fprintf(stderr, "Couldn't find stream information\n"); return -1; // Couldn't find stream information } ... And here it lags until stream is shut down, and then it successfully encodes picture and video. argv[1] = "http://192.168.0.30" that is stream process. -- View this message in context: http://www.nabble.com/Reading-MJPEG-stream-problem-tp23481361p23481361.html Sent from the libav-users mailing list archive at Nabble.com. _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
