[FFmpeg-user] Getting http_code on avformat_open_input() error

Alexey Vasilyev alexey.vasilyev at gmail.com
Wed Oct 8 09:23:00 CEST 2014


Hi,

    I'm using RTSP over HTTP from ffmpeg and want to get an extended error
when avformat_open_input failed, e.g. Unauthorised error occurred
 ./ffplay "rtsp://username:incorrectpassword@192.168.0.3:80/my.sdp"
-rtsp_transport http -loglevel debug -stats

  In the ffmpeg log I have
  http_code=-1807328772
  HTTP error -1807328772 HTTP/1.1 401 Unauthorized

   However I can not get this status 401 via avformat_open_input.

    int errCode = 0;
    if ((errCode = avformat_open_input(&formatContext, c_url, NULL,
/*NULL*/&options))
!= 0) {
      // Print error description
      char errbuf[128];
      av_strerror(errCode, errbuf, sizeof(errbuf));
      E("avformat_open_input() failed with code %d (%s)", errCode, errbuf);
      // Cleanup
      // ...
    }

   The error that I have is
   avformat_open_input() failed with code -5 (I/O error)


   Is there any way to get the http_code on avformat_open_input or
introducing my own AVERROR(http_code) and patching libavformat/http.c is
the only way to do that?

Best regards,
Alex.


More information about the ffmpeg-user mailing list