I try to extract video from mp4 and mix with others audios,here is the video part:
MediaFormat videoFormat = null;
MediaMuxer mp4Muxer = createMediaMuxer();
MediaExtractor mp4Extractor = createMediaExtractor();
for (int i = 0; i < mp4Extractor.getTrackCount(); i++) {
    MediaFormat format = mp4Extractor.getTrackFormat(i);
    String mime = format.getString(MediaFormat.KEY_MIME);
    if (mime.startsWith("video/")) {
        mp4Extractor.selectTrack(i);
        videoFormat = format;
        break;
    }
}
int videoTrackIndex = mp4Muxer.addTrack(videoFormat);
mp4Muxer.start();
boolean videoMuxDone = false;
ByteBuffer videoSampleBuffer = ByteBuffer.allocateDirect(176 * 144); 
BufferInfo videoBufferInfo = new BufferInfo();
int sampleSize;
while (!videoMuxDone) {
    videoSampleBuffer.clear();
    sampleSize = mp4Extractor.readSampleData(videoSampleBuffer, 0);
    if (sampleSize < 0) {
        videoMuxDone = true;
    } else {
        videoBufferInfo.presentationTimeUs = mp4Extractor.getSampleTime();
        videoBufferInfo.flags = mp4Extractor.getSampleFlags();
        videoBufferInfo.size = sampleSize;
        mp4Muxer.writeSampleData(videoTrackIndex, videoSampleBuffer,videoBufferInfo);
        mp4Extractor.advance();
        }
}
mp4Extractor.release();
mp4Muxer.stop();
mp4Muxer.release();
creations:
private MediaExtractor createMediaExtractor() {
        MediaExtractor extractor = new MediaExtractor();
        try {
            extractor.setDataSource(mp4VideoFile.getAbsolutePath());
        } catch (IOException e) {
            e.printStackTrace();
        }
        return extractor;
}
private MediaMuxer createMediaMuxer() {
        MediaMuxer midiaMuxer = null;
        try {
            midiaMuxer = new MediaMuxer(OUTPUT_MP4,
                    MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return midiaMuxer;
}
the videoformat:
{max-input-size=6561, durationUs=3331377, height=144, mime=video/mp4v-es, csd-0=java.nio.ByteArrayBuffer[position=0,limit=30,capacity=30], width=176}
when it runs to line : mp4Muxer.stop(), exceptions happens:
MPEG4Writer Missing codec specific data
java.lang.IllegalStateException: Failed to stop the muxer
at android.media.MediaMuxer.nativeStop(Native Method)
at android.media.MediaMuxer.stop(MediaMuxer.java:226)
at com.darcye.media.Mp4Muxer.startMix(Mp4Muxer.java:155)
I have read the Extract Decode Encode Mux Audio,but still cant find the reason,please help me.