FFMPEG中调用avformat_open_input报错

调用avformat_open_input报错:Protocol not found。请大神指点一下,谢谢了。


    AVFormatContext *pAudioCtx = NULL;
    AVCodecContext  *pCodecCtx = NULL;
    AVCodec         *pCodec = NULL;
    AVPacket        *packet = NULL;
    uint8_t         *out_buffer;
    AVFrame         *pFrame;

    SDL_AudioSpec   wanted_spec;

    int audioStream;
    int i;
    int ret;
    int getpicture;

    int64_t in_channel_layout;
    struct SwrContext *au_convert_ctx;

    FILE *pFile = fopen("lmzoutput.pcm", "wb");
    char url[] = "16.opus";


    av_register_all();

    avformat_network_init();

    //pAudioCtx = avformat_alloc_context();   //新版本不需要  加了会出错?


    int err_code;
    char buf[1024];
    memset(buf,0x00,sizeof(buf));

    err_code = avformat_open_input(&pAudioCtx, url, NULL, NULL);
    if (err_code != 0)
    {
        av_strerror(err_code, buf, 1024);
        _TRACE("Couldn't open file %s: %d(%s)", url, err_code, buf);
        _TRACE("Couldn't open input stream.\n");
        return 0;
    }

https://stackoverflow.com/questions/14914634/ffmpeg-avformat-open-input-always-returns-protocol-not-found-rv-1330794744

有二种原因:
1.没有初始化,添加如下初始化代码

av_register_all();
avformat_network_init();

2.RTSP地址不正确, 注意这里是小写的rtsp

rtsp://...