title: Will all phones support YUV 420 (Semi) Planar color format in h.264 encoder?
body: <p>Preambule: This may sound like a very specific question, but this is actually a go / no go to build an <code>API</code> 16+ <code>Android</code> application using <code>MediaCodec</code> that is compatible with most phone.</p>
  
  <p>I have an application with a <code>h.264</code> <code>MediaCodec</code> that receives data from a buffer - and not a surface since I'm doing a lot of manipulations on the image. When creating the <code>Encoder</code>, I iterate through the list of possible encoders from the phone to make sure I'm using a proprietary encoder if any. This part is not a problem.</p>
  
  <p>The problem is that each encoder has its color format preference. This may lead to color format conversion before encoding. In my proof-of-concept, for example, I included method to convert to <code>NV12</code>, <code>NV21</code> and <code>YV12</code>, along with following very strict rules, like placing the start of some planes / interleaved plane at a precise offset in the buffer, etc. Just being able to make an encoded video look good may be a long story.</p>
  
  <p>So, if I was certain that there is a standard in what Android <code>h.264</code> <code>MediaCodec</code> Encoders are accepting, then that would limit a lot the amount of customization I have to do to get my API 16 MediaCodec proof-of-concept working on all devices.</p>
  
  <p>[EDIT]</p>
  
  <p>Oh. I just saw that it's impossible to create an input surface before Android 18. I will have to rely on detecting proprietary codecs and color formats for each case, random crashes, slow FPS, etc. Bwe... With a bit of chance, in 2017 or 2018, there will be enough devices with relevant API features to write a decent app using MediaCodec.</p>