Using encoder (Link), To record video which is playing on screen for Selenium automation script.
ScreenCaptureJob scj = new ScreenCaptureJob();
scj.OutputScreenCaptureFileName = "XXX.avi";
scj.Start();
It is required to delete existing file, before to write .avi file on existing name.
Is it possible to replace existing file Or override it ?
You can try deletion of file before saving it:
try {
Files.deleteIfExists(Paths.get("PATH TO FILE\"XXX.avi"));
} catch (IOException e) {
e.printStackTrace();
}