title: Android encoder muxer: raw h264 to mp4 container
body: <p>I created a h264 raw video file, and I was able to mux it with Android MediaMuxer on Android 4.3 and up. Now I need to support Android versions 4.1 and 4.2. I found Jcodec. And there is an example for doing this:</p>
  
  <p><a href="https://github.com/jcodec/jcodec/blob/master/samples/main/java/org/jcodec/samples/mux/AVCMP4Mux.java">https://github.com/jcodec/jcodec/blob/master/samples/main/java/org/jcodec/samples/mux/AVCMP4Mux.java</a></p>
  
  <p>But I'm getting java.nio.ReadOnlyBufferException exception at line 70:</p>
  
  <p>H264Utils.encodeMOVPacket(data);</p>
  
  <p>I guess this code is not for Android? How do I fix this. Can someone familiar with Jcodec help on this?</p>