1. Products
  2.   Video
  3.   Java
  4.   Video Recorder
 
  

Free Java Library for Automatic Video Recording

Open Source Java Library to Integrate Video Recorder into Your Selenium Grid, Capture Remote Node videos, and Analyze Failures with Concrete Visual Proof.

What is Video Recorder ?

Testing user interfaces, especially across different browsers and devices, can be like trying to catch smoke with your bare hands. When a test fails, you're left scratching your head, wondering what went wrong. Was it a timing issue? A missing element? A weird race condition? This is where the Video Recorder library comes in – a Java tool that automatically captures video of your UI tests with just a couple of annotations. The library, available on GitHub by Sergey Pirogov, makes video recording extremely simple by allowing developers to add a few annotations or configurations to start recording automatically during tests. Instead of manually reproducing bugs, teams can simply watch recorded videos to understand what happened during test execution.

Video Recorder is an open-source Java library that integrates seamlessly with popular test frameworks like JUnit 4/5, TestNG, and Spock. Instead of manually starting and stopping screen recordings, you simply add a @Video annotation to your test methods. The library handles the rest – initiating recording before your test runs and saving the video upon completion, typically only when a test fails (though you can configure it otherwise). The library uses either Monte Media (pure Java, easier setup but limited formats) or FFmpeg (more powerful, better support for different codecs and screen setups) as the underlying recorder. For remote testing, such as on a Selenium Grid, it can even record video on the remote node without additional configuration.

Previous Next

Getting Started with Video Recorder

The recommend way to use the Video Recorder library by adding Maven dependency. Please use the following command for a smooth working.

Maven Dependency for Video Recorder library

<dependency> <groupId>com.automation-remarks</groupId> <artifactId>video-recorder-testng</artifactId> <version>LATEST</version> </dependency>

Install documents4j GitHub


implementation 'com.automation-remarks:video-recorder-junit5:2.0'

Annotation-Based Video Recording via Java

One of the biggest advantages of open source Video Recorder library is its annotation-driven design. Developers can enable recording simply by adding annotations to test classes or methods. This reduces boilerplate code and makes integration straightforward for Java testing frameworks like JUnit. The @Video annotation automatically starts recording before the test begins and stops recording after completion. There are various benefits of this, such as minimal code changes, easy adoption and cleaner test files.

How to Recode Annotation-Based Video via Java Library?

import com.automation.remarks.video.annotations.Video;

public class LoginTest {

    @Video
    public void testLogin() {
        System.out.println("Executing login test...");
    }
}

ustom Video Naming

Custom Video Naming via Java Library

The open source Video Recorder library enables Java developers to perform custom naming conventions for recordings, helping teams organize recordings more efficiently. This is useful when running multiple test suites. It is a very useful and provides benefits like better file organization, easier artifact lookup and improved reporting integration. Here is a simple example that shows, how to perform this operation.

How to Generated Video File via Java Library?

@Video(name = "checkout_flow_test")
public void checkoutTest() {
    System.out.println("Checkout process running");
}

Custom Video Naming via Java Library

Video Recorder is very powerful and control everything – from the output folder and recording mode (always, on failure, only annotated tests) to the frame rate and screen size. Create a video.properties file in your classpath, or pass parameters via Maven/Gradle command line. This allows you to set different recording strategies for local development (always record) vs. CI (only record failures).

How to Apply Various Recording Properties using Video Recorder Library?

# Only record tests annotated with @Video (default)
video.mode=ANNOTATED
# Save videos only when a test fails (saves disk space)
video.save.mode=FAILED_ONLY
# Output directory – use an environment variable for CI
video.folder=${user.home}/test-reports/videos
# Frame rate – lower for faster processing, higher for smooth playback
video.frame.rate=15
# Use FFmpeg for better codec support
recorder.type=FFMPEG

FFmpeg Integration for High-Performance Recording

For advanced users, the library can call FFmpeg directly (instead of Monte Media). FFmpeg offers lower CPU usage, more codecs (H.264, VP9), and the ability to record a specific application window or region. You just need FFmpeg installed on the test machine and the SendSignalCtrlC.exe utility on Windows for graceful stops.