[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


    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@"
-rtsp_transport http -loglevel debug -stats

  In the ffmpeg log I have
  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,
!= 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,

More information about the ffmpeg-user mailing list