title: c++ ffmpeg api get video stream from https link
body: <p>I'm trying to read https video link using the function av_format_open_input() but the function return a negative value.
  Here is my code:</p>
  
  <pre><code>av_register_all();
  avcodec_register_all();
  avformat_network_init();
  const char * url = "https://r1---sn ...";
  
  AVFormatContext * pFormatCtx = avformat_alloc_context();
  
  int ret = avformat_open_input(&amp;pFormatCtx, url, NULL, NULL);
  </code></pre>
  
  <p>This code worked with a local file as url but as soon as I give a https url it doesnt work anymore.
  thanks<br>
  <strong>[edit]</strong><br>
  I found only this: <a href="http://www.ffmpeg.org/doxygen/trunk/ffserver_8c-source.html" rel="nofollow noreferrer">ffserver.c</a><br>
  But it uses a .ffm file as input. Any exemple or help on how to implement HttpContext (if HttpContext is needed here) would be great.<br>
  <strong>[update]</strong><br>
  I ended using libvlc which seems to be much easier but the way to do it using ffmpeg could still be interesting. See my other post if interested: <a href="https://stackoverflow.com/questions/23092940/get-frame-from-video-with-libvlc-smem-and-convert-it-to-opencv-mat-c">Get frame from video with libvlc smem and convert it to opencv Mat. (c++)</a></p>