title: x265 encoder, convert yuv to x265_picture
body: <p>I'm writing an application in C++ and I want to convert a <code>yuv</code> picture that I get from the webcam to an <code>x265_picture</code>, so that it can be encode to <code>hevc</code>. I followed the tutorial on <a href="http://x265.readthedocs.org/en/default/api.html#introduction" rel="nofollow">http://x265.readthedocs.org/en/default/api.html#introduction</a>. But there is nothing on how you can convert <code>yuv</code> to <code>x265_picture</code>. How can this be accomplished?
  </p>
  
  <pre><code>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, &amp;pp_nal, &amp;pi_nal, pic_in, pic_out);
  </code></pre>