LMZ_YAO 2017-07-11 01:07 采纳率: 0%
浏览 4042

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;
    }
  • 写回答

2条回答 默认 最新

报告相同问题?