Many of us have already faced this error. I found a workaround for everyone who may be interested.
Right after you add the video and audio streams to the writer, encode a video packet with a timestamp of value 0.
writer.addVideoStream(0, 0, ICodec.ID.CODEC_ID_H264, outVideoWidth, outVideoHeight);
writer.addAudioStream(1, 0, ICodec.ID.CODEC_ID_AAC, 2, sampleRate);
blankVideoPicture.setTimestamp(0);
writer.encodeVideo(0, blankVideoPicture);
Anything else fails for me. If anyone is aware of the reason behind this, please explain. :)