MediaWriter writer = new MediaWriter(file.toString());
writer.addListener(new MediaViewer(mViewerMode, true));
// add the video stream
ICodec videoCodec = ICodec.findEncodingCodec(ICodec.ID.CODEC_ID_FLV1);
writer.addVideoStream(videoStreamIndex, videoStreamId, videoCodec, w, h);
// add the audio stream
ICodec audioCodec = ICodec.findEncodingCodec(ICodec.ID.CODEC_ID_MP3);
IContainer container = writer.getContainer();
IStream stream = container.getStream(writer.addAudioStream(audioStreamIndex, audioStreamId,
audioCodec, channelCount, sampleRate));
int sampleCount = stream.getStreamCoder().getDefaultAudioFrameSize();