方法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);