2

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:

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(&pFormatCtx, url, NULL, NULL);

This code worked with a local file as url but as soon as I give a https url it doesnt work anymore. thanks
[edit]
I found only this: ffserver.c
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.
[update]
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: Get frame from video with libvlc smem and convert it to opencv Mat. (c++)

Community
  • 1
  • 1
grll
  • 1,047
  • 2
  • 10
  • 18
  • A URI link by its self wouldn't be a valid stream. You'll need to implement a [HTTPContext](http://www.ffmpeg.org/doxygen/trunk/structHTTPContext.html), and pass [HTTPContext->stream->feed_filename](http://www.ffmpeg.org/doxygen/trunk/ffserver_8c_source.html#l02791) to `avformat_open_input`. – emcconville Apr 11 '14 at 18:55
  • 2
    Any clue on how to implement the HTTPContext ? (Can't find any exemple) – grll Apr 11 '14 at 19:22

0 Answers0