MediaRecorder, first frames blank

208 views Asked by At

I'm trying to develop a simple video recorder

I initialize Camera, and then on button click I run a Runnable that prepares the MediaRecorder:

public void run() {
    mCamera.unlock();
    mMediaRecorder = new MediaRecorder();
    mMediaRecorder.setCamera(mCamera);
    mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
    mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);

    mMediaRecorder.setVideoSize(320, 240);

    mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
    mMediaRecorder.setOutputFile(mSomeFile); 

    mMediaRecorder.setMaxDuration(MAX_DURATION);
    mMediaRecorder.setOrientationHint(90);


    try {
        mMediaRecorder.prepare();
        mMediaRecorder.start();
    } catch (Exception e) {
        e.printStackTrace();
    } 
}

Every thing runs fine but the actual output video contains some blank frames at the beginning. Could it be a hardware issue or rather it needs some optimization from the code?

0

There are 0 answers