How to record screen in android more than 3 minutes programmatically?

Have added FFMPEG utility to be able to record beyond 3 minutes. but it’s recording from the middle to the end in your case.

Start Recording:

AndroidStartScreenRecordingOptions Options=new AndroidStartScreenRecordingOptions().withTimeLimit(Duration.ofMinutes(10)).enableBugReport().withVideoSize(“1280x720”);
((CanRecordScreen) getDriver()).startRecordingScreen(Options);

Stop Recording:
String media = ((CanRecordScreen) getDriver()).stopRecordingScreen();

Using similar code with no issue. Check when you start recording in code.

// mine example just in case
((AndroidDriver) driver).startRecordingScreen(
                    new AndroidStartScreenRecordingOptions()
                            .withBitRate(1600000) // default: 4000000
                            .withVideoSize("360x800") // Nokia 5.3: 720 x 1600, Nokia x10: 1080 x 2400 pixels
                            .withTimeLimit(Duration.ofMinutes(10))); // 10 minutes max. video length

Thanks you for you support its working now