[Libav-user] FW: av_open_input_file fails on certain Windows Machines

Alistair Boyd aboyd at a2etech.com
Mon May 16 19:33:18 CEST 2011

I have an application that successfully streams video using rtp. I have
found that on certain computers the function av_open_input_file() fails with
return value -22 EINVAL (invalid argument). I have created a very simple
test app (below) which runs on some windows machines and not on others (e.g.
2 XP machines are fine, 1 XP laptop not, 1 Win7 32bit laptop fine another


Does anyone have any insight into what the problem may be?




#include <stdlib.h>

#include <stdio.h>

#include <string.h>

#include <math.h>



// Required to use libs on windows


#define inline _inline




extern "C" 


      #include "libavformat/avformat.h"

      #include "libavcodec/avcodec.h"

      //#include "libswscale/swscale.h"   


bool CreateSdpFile();


AVFormatContext* pFormatCtx = NULL;


bool CreateSdpFile()


      FILE *pFile = fopen ("C:\\FFMpegTest\\MP4.sdp","w");


      if (pFile)


            fprintf (pFile, "v=0\n");

            fprintf (pFile, "o=- 0 0 IN IP4\n");

            fprintf (pFile, "s=No Name\n");

            fprintf (pFile, "c=IN IP4\n");

            fprintf (pFile, "t=0 0\n");

            fprintf (pFile, "a=tool:libavformat 52.104.0\n");

            fprintf (pFile, "m=video 5004 RTP/AVP 96\n");

            fprintf (pFile, "b=AS:1228\n");

            fprintf (pFile, "a=rtpmap:96 MP4V-ES/90000\n");

            fprintf (pFile, "a=fmtp:96 profile-level-id=1\n");

        if (fclose (pFile) != 0)


             printf("dp close failed\n");

          //  AfxMessageBox("sdp close failed",MB_OK| MB_ICONSTOP);




      return true;



#undef exit



int main()




    AVCodec *pCodec;    

    int numBytes;

    int avError;


    char* filename = "C:\\FFMpegTest\\MP4.sdp";

      //char* filename = "C:\\ABTmp\\vid.avi";




    avError = av_open_input_file(&pFormatCtx, filename, NULL, 0, NULL);



        printf("Stream init error, could not open input file, %d\n",






Email scanned by PC Tools - No viruses or spyware found.
(Email Guard:, Virus/Spyware Database: 6.17520)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20110516/84f7eec4/attachment.html>

More information about the Libav-user mailing list