[FFmpeg-devel] avformat_find_stream_info() fails while reading rtsp stream

Audric Ackermann audric.bilb at gmail.com
Fri Oct 5 11:45:09 CEST 2012


I am currently developping an application for Android to read Mjpeg streams
from a server which uses live555 to stream webcam.

Firstly I try this :

 if (avformat_open_input(&fmt_ctx, url, NULL, NULL) < 0) {
LOGE("Could not open source file");
        return 1;
LOGI("File/url opened - OK");
    /* retrieve stream information */
    if (avformat_find_stream_info(fmt_ctx, NULL) < 0) {
        LOGE("Find streams informations - Fail");
        return 1;
LOGI("Find streams informations - OK");

It works with url like
rtsp:// + h264), I
can print image on the Android Application, but it fails
in the opening with the server I use.
I think it is because the server stream to multicast, so I had (found on

       AVDictionary* options = NULL;
av_dict_set(&options, "rtsp_transport", "udp_multicast", 0);
ret = avformat_open_input(&fmt_ctx, url, 0, &options);

if (ret!=0 || !fmt_ctx){
LOGE("Source open - Fail");
return 1;
else {
LOGI("Source open - OK");
        if (avformat_find_stream_info(fmt_ctx, NULL) < 0) {
               LOGE("Find streams informations - Fail");

I can open the stream, but now it fails while finding streams information,
and I don't understand why.
Have I missed something ?

Thank you in advance.

More information about the ffmpeg-devel mailing list