I suspect this may be what I am running into as well. Good to see that I am not the only one with RTSP issues.
In my case I am using MPD and though MPD can take many different string URLs and just play them, the rtsp one I found does not play through MPD though I can play it from CLI without issue. On Thu, Jul 30, 2020 at 6:25 PM Carlos Esponda <[email protected]> wrote: > I am currently trying to read an RTSP stream with FFMPEG and can't get > past avformat_open_input. > > Any help would be appreciated! > > thank you. > > #include <iostream> > > extern "C" > { > #include <libavformat/avformat.h> > #include <libavcodec/avcodec.h> > #include <libavcodec/codec.h> > #include "libswscale/swscale.h" > #include "libavutil/avutil.h" > #include "libavutil/frame.h" > #include "libavcodec/codec_id.h" > #include "libavutil/pixfmt.h" > #include "libavutil/imgutils.h" > } > > > int decode_interrupt(void*); > > int main() > { > AVFrame* frame = NULL; > AVFormatContext* formatc = NULL; > const AVIOInterruptCB int_cb = { decode_interrupt, NULL }; > AVCodec* codec = NULL; > AVCodecContext* codecc = NULL; > char* error = new char[255]; > > if (!(frame = av_frame_alloc())) { > std::cout << " failed to alloc frame"; > return -1; > } > formatc = avformat_alloc_context(); > formatc->interrupt_callback = int_cb; > > codec = avcodec_find_decoder(AV_CODEC_ID_H264); > codecc = avcodec_alloc_context3(codec); > int result = avcodec_open2(codecc, codec, NULL); > if (result != 0) { > std::cout << "failed to open codec"; > } > > result = avformat_open_input(&formatc, "rtsp://:8554/testStream", > NULL, NULL); > if (result != 0) { > av_strerror(result, error, 255); > std::cout << "couldnt open input " << error<< std::endl; > avformat_close_input(&formatc); > return -1; > } > > result = avformat_find_stream_info(formatc, NULL); > if (result != 0) { > std::cout << "could not find stream information\n"; > return -1; > } > > return 0; > } > > int decode_interrupt(void * ctx) { > std::cout << "interupted\n"; > return -1; > } > > _______________________________________________ > Libav-user mailing list > [email protected] > https://ffmpeg.org/mailman/listinfo/libav-user > > To unsubscribe, visit link above, or email > [email protected] with subject "unsubscribe".
_______________________________________________ Libav-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/libav-user To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
