<p>Hello Brian,</p>
<p>not long ago i ran into a similar problem so i have a clue what it could be. In some cases, when it comes to receiving a live stream, you have to tell ffmpeg which format the input should have. Attached you find some code how to do that, i am using it for several mjpeg cameras.<br>
</p>AVInputFormat* avInformat = NULL;<br><br>avInformat = av_find_input_format("mjpeg");<br><br>if(avformat_open_input(&pFormatCtx, path, avInformat, NULL)!=0) <div>{ ...<div><div><br></div><div>
<p>Best regards,<br>
Alex</p>
<div class="gmail_quote">Am 29.11.2012 21:07 schrieb "Brian Martin" <<a href="mailto:brian@caelumspace.com" target="_blank">brian@caelumspace.com</a>>:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="#0563C1" vlink="#954F72"><div><p class="MsoNormal">Hello,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">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 <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal" style="text-indent:.5in">AVFormatContext *pFormatCtx=NULL;<u></u><u></u></p><p class="MsoNormal"> int i, videoStream;<u></u><u></u></p>
<p class="MsoNormal"> AVCodecContext *pCodecCtx;<u></u><u></u></p><p class="MsoNormal"> AVCodec *pCodec;<u></u><u></u></p><p class="MsoNormal"> AVFrame *pFrame; <u></u><u></u></p>
<p class="MsoNormal"> AVFrame *pFrameRGB;<u></u><u></u></p><p class="MsoNormal"> AVPacket packet;<u></u><u></u></p><p class="MsoNormal"> int frameFinished;<u></u><u></u></p>
<p class="MsoNormal"> int numBytes;<u></u><u></u></p><p class="MsoNormal"> uint8_t *buffer;<u></u><u></u></p><p class="MsoNormal"> struct SwsContext *img_convert_ctx;<u></u><u></u></p>
<p class="MsoNormal"> int frameCount=0;<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"> if(!videoStreamAddress) {<u></u><u></u></p><p class="MsoNormal"> printf("Please provide a movie file\n");<u></u><u></u></p>
<p class="MsoNormal"> return -1;<u></u><u></u></p><p class="MsoNormal"> }<u></u><u></u></p><p class="MsoNormal"> // Register all formats and codecs<u></u><u></u></p>
<p class="MsoNormal"> av_register_all();<u></u><u></u></p><p class="MsoNormal"> avformat_network_init();<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"> //Open video file<u></u><u></u></p>
<p class="MsoNormal"> if(avformat_open_input(&pFormatCtx, videoStreamAddress, NULL, NULL)!=0)<u></u><u></u></p><p class="MsoNormal"> {<u></u><u></u></p><p class="MsoNormal"> printf("Couldn't open file %s\n", videoStreamAddress);<u></u><u></u></p>
<p class="MsoNormal"> return -1; // Couldn't open file<u></u><u></u></p><p class="MsoNormal"> }<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">
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.<u></u><u></u></p><p class="MsoNormal">Any ideas would be appreciated. Thanks!<u></u><u></u></p>
</div></div><br>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br></blockquote></div>
</div></div></div>