FFmpeg 设置编解码参数的不同方法

方法1:直接对成员变量访问设置:

enc_ctx->profile = FF_PROFILE_H264_HIGH; // 设置profile

avcodec_open2(enc_ctx, enc, NULL);

方法2:使用av_opt_set系列函数方法:

av_opt_set(enc_ctx->priv_data,"profile","high", 0);

avcodec_open2(enc_ctx, enc, NULL);

方法3:使用AVDictiony系列函数方法:

AVDictionary *dict = NULL;
av_dict_set(&dict, "profile", "high", 0);
//av_dict_set_int(&dict, "profile", FF_PROFILE_H264_HIGH, 0); // 同上

avcodec_open2(enc_ctx, enc, &dict);

猜你喜欢

转载自blog.csdn.net/davidsguo008/article/details/128817846