<div dir="ltr">In addition, the error is always "immediate exit requested"</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 30, 2020 at 6:25 PM Carlos Esponda <<a href="mailto:esponda.carlos9@gmail.com">esponda.carlos9@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I am currently trying to read an RTSP stream with FFMPEG and can't get past avformat_open_input. <br><br>Any help would be appreciated!<div><br></div><div>thank you.<br><br>  #include <iostream><br><br>extern "C"<br>{<br>#include <libavformat/avformat.h><br>#include <libavcodec/avcodec.h><br>#include <libavcodec/codec.h><br>#include "libswscale/swscale.h"<br>#include "libavutil/avutil.h"<br>#include "libavutil/frame.h"<br>#include "libavcodec/codec_id.h"<br>#include "libavutil/pixfmt.h"<br>#include "libavutil/imgutils.h"<br>}<br><br><br>int decode_interrupt(void*);<br><br>int main()<br>{<br>    AVFrame* frame = NULL;<br>    AVFormatContext* formatc = NULL;<br>    const AVIOInterruptCB int_cb = { decode_interrupt, NULL };<br>    AVCodec* codec = NULL;<br>    AVCodecContext* codecc = NULL;<br>    char* error = new char[255];<br><br>    if (!(frame = av_frame_alloc())) {<br>        std::cout << " failed to alloc frame";<br>        return -1;<br>    }<br>    formatc = avformat_alloc_context();<br>    formatc->interrupt_callback = int_cb;<br><br>    codec = avcodec_find_decoder(AV_CODEC_ID_H264);<br>    codecc = avcodec_alloc_context3(codec);<br>    int result = avcodec_open2(codecc, codec, NULL);<br>    if (result != 0) {<br>        std::cout << "failed to open codec";<br>    }<br><br>    result = avformat_open_input(&formatc, "rtsp://:8554/testStream", NULL, NULL);<br>    if (result != 0) {<br>        av_strerror(result, error, 255);<br>        std::cout << "couldnt open input " << error<< std::endl;<br>        avformat_close_input(&formatc);<br>        return -1;<br>    }<br><br>    result = avformat_find_stream_info(formatc, NULL);<br>    if (result != 0) {<br>        std::cout << "could not find stream information\n";<br>        return -1;<br>    }<br><br>    return 0;<br>}<br><br>int decode_interrupt(void * ctx) {<br>    std::cout << "interupted\n";<br>    return -1;<br>}<div></div><div><br></div></div></div>
</blockquote></div>