FFMPEG API: How to connect to RTSP stream using av_open_input_file?

14,846

Turned out I did not enable network support when building FFMPEG.

The following options worked for me:

--enable-network --enable-protocol=tcp --enable-demuxer=rtsp --enable-decoder=h264

Share:
14,846
Alexander Kulyakhtin
Author by

Alexander Kulyakhtin

Updated on June 15, 2022

Comments

  • Alexander Kulyakhtin
    Alexander Kulyakhtin about 2 years

    I'm trying to connect to some RTSP stream using av_open_input_file() like this:

    AVFormatContext* ic; avcodec_register_all(); av_register_all(); av_open_input_file(&ic, "rtsp://login:[email protected]/videoinput_1/mjpeg/media.stm", NULL, 4096, NULL);

    It always returns 'file not found'. The same url, though, I can see in, say, VLC player. Do I do something wrong in my code?

    I'm using FFMPEG 0.6, shall I use the latest instead?

  • Mike Bevz
    Mike Bevz over 12 years
    I didn't find --enable-protocol=rtsp. How did you fix that?
  • Alexander Kulyakhtin
    Alexander Kulyakhtin over 12 years
    I used --enable-network --enable-protocol=tcp --enable-demuxer=rtsp --enable-decoder=h264 in the configure file, that did let me enable rtsp
  • Mike Bevz
    Mike Bevz over 12 years
    -enable-demuxer=rtsp solved my problem as well. I didn't need h264 as my app works only with audio streaming.
  • cdf1982
    cdf1982 almost 5 years
    @AlexanderKulyakhtin parameters are exactly what I did need to have RTSP streaming work. I know thanks comments need to be avoided, but this answer can be really useful to other users too, so be reassured this is the real deal!