我正在用 C++ 编写一个应用程序,我想yuv
将从网络摄像头获取的图片转换x265_picture
为hevc
. 我按照http://x265.readthedocs.org/en/default/api.html#introduction上的教程进行操作。但是没有关于如何转换yuv
为x265_picture
. 如何实现?
x265_param *param = x265_param_alloc();
x265_param_default_preset(param, "ultrafast", "zerolatency");
x265_param_parse(param, "fps", "30");
x265_param_parse(param, "input-res", "352x288"); //wxh
x265_param_parse(param, "bframes", "0");
x265_param_parse(param, "rc-lookahead", "20");
x265_param_parse(param, "repeat-headers", "1");
x265_picture *pic_in = x265_picture_alloc();
x265_picture *pic_out = x265_picture_alloc();
x265_picture_init(param, pic_in);
x265_nal *pp_nal;
uint32_t pi_nal;
x265_encoder *encoder = x265_encoder_open(param);
x265_encoder_encode(encoder, &pp_nal, &pi_nal, pic_in, pic_out);