@Override
    protected void configure() {
        withCreateContainerCmdModifier(it -> it.withEntrypoint("/bin/sh"));
        String encodedPassword = Base64.getEncoder().encodeToString(vncPassword.getBytes());
        setCommand(
            "-c",
            "echo '" +
            encodedPassword +
            "' | base64 -d > /vnc_password && " +
            "flvrec.py -o " +
            ORIGINAL_RECORDING_FILE_NAME +
            " -d -r " +
            frameRate +
            " -P /vnc_password " +
            targetNetworkAlias +
            " " +
            vncPort
        );
    }
Create a sidekick container and attach it to another container. The VNC output of that container will be recorded.
core/src/main/java/org/testcontainers/containers/VncRecordingContainer.java