title: MediaCodec Encoded video has green bar at bottom and chrominance screwed up
body: <p>I started a project from <a href="https://github.com/google/grafika" rel="noreferrer">Grafika</a> and modified it. I've got a framework (not too different from the original) which captures a preview from the <code>Camera</code> and continuously encodes it to a video at the same time both at different resolutions.</p>
  
  <p><code>MediaCodec</code> (for encoding) is configured to use <code>COLOR_FormatSurface</code> in order for us to be able to render to the Surface queried using <code>getInputSurface()</code> using GLES.</p>
  
  <p>The media format is set to MIME Type <code>video/avc</code></p>
  
  <p><strong>For most phones, this setup works perfectly.</strong></p>
  
  <p>But for a few phones, the encoded video has the chrominance values slightly skewed and a green bar at the bottom.</p>
  
  <p>Currently the encoder surface is of 640x360 resolution.
  EGLConfig choosen to render to the surface supports 32 bit RGBA format.</p>
  
  <p>The <strong>preview is perfect</strong> in all phones.</p>
  
  <p>So I am assuming there's some thing wrong with the encoder parameters either on the application side or the OS framework side.</p>
  
  <p>It's happening on Android 4.4. - Not sure, if it's reproducible on 5.*.</p>
  
  <p><img src="https://i.stack.imgur.com/NnsJh.jpg" alt="![Green bar image">]<a href="https://i.stack.imgur.com/NnsJh.jpg" rel="noreferrer">2</a></p>