# Record processed video on Android

> Record the processed NosmaiPreviewView to an MP4 and handle completion without interrupting the camera pipeline.

> For AI agents: the complete documentation index is at https://nosmai.com/llms/effects.txt

Product: Nosmai Effects
Group: guide
Source: https://nosmai.com/docs/effects/guides/output/record-video/android/

## Prerequisites

- A working [Android quickstart](/docs/effects/quickstart/android/)
- The active `NosmaiPreviewView`
- A writable absolute `.mp4` output path

## Start recording

```java
NosmaiSDK.startRecording(previewView, outputPath,
    new NosmaiSDK.RecordingCallback() {
        @Override
        public void onStarted(boolean success, String error) {
            if (!success) {
                Log.e("Nosmai", "Recording did not start: " + error);
            }
        }
    });
```

Disable duplicate start requests until `onStarted` returns.

## Stop and finalize the MP4

```java
NosmaiSDK.stopRecording(new NosmaiSDK.RecordingCallback() {
    @Override
    public void onCompleted(String path, boolean success, String error) {
        if (success) {
            Log.i("Nosmai", "Video ready at " + path);
        } else {
            Log.e("Nosmai", "Recording failed: " + error);
        }
    }
});
```

Wait for `onCompleted` before opening, sharing, or scanning the file.

## Lifecycle rule

Stop and finalize recording before switching camera, pausing the activity, or
destroying the preview. On measured lower-tier devices the SDK can reduce only
the recording resolution to protect frame rate; the live preview remains at its
configured size.

## Verify it worked

Record a short clip with a visible effect, wait for `onCompleted`, and play the
returned MP4. Confirm its orientation, effect output, video duration, and audio.

## Common errors

| Symptom | Cause | Fix |
| --- | --- | --- |
| Recording does not start | The preview is not ready or another start is in progress | Wait for camera startup and guard the record button |
| The file cannot be opened | The app used it before `onCompleted` | Wait for finalization and use a writable absolute `.mp4` path |

## Next steps

- [Stream processed frames with Agora on Android](/docs/effects/integrations/agora/android/)
- [Review limits and performance](/docs/effects/limits-and-performance/)

## References

- [Android platform guide](/docs/effects/platforms/android/)
- [Troubleshooting](/docs/effects/troubleshooting/)
