Class UiVideoRecorder

java.lang.Object
com.render.testkit.UiVideoRecorder
All Implemented Interfaces:
AutoCloseable

public final class UiVideoRecorder extends Object implements AutoCloseable
Bounded real-frame recorder for dedicated development clients. Call capture(RenderTarget, double) after rendering, and wait until busy() is false before advancing a deterministic scenario's clock or input. PNG frames remain available even when the explicitly installed FFmpeg encoder fails.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    A persisted frame's real capture timestamp and deterministic scenario animation time.
    static final record 
    Final report; success requires verified MP4 dimensions, cadence, count, duration, and a written manifest.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    True until the outstanding GPU readback and PNG write both complete.
    boolean
    capture(com.mojang.blaze3d.pipeline.RenderTarget target, double animationTime)
    Requests the current rendered frame.
    void
    Stops asynchronously.
    boolean
    True while new frames may be admitted.
    start(Path directory, String label, int fps, int maxFrames, String ffmpegExecutable)
    Starts a recording in a newly created, sanitized label subdirectory.
    Stops admitting frames and returns the same asynchronous completion on every call.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • start

      public static UiVideoRecorder start(Path directory, String label, int fps, int maxFrames, String ffmpegExecutable) throws IOException
      Starts a recording in a newly created, sanitized label subdirectory. Existing recordings are never overwritten. FPS is 1..120 and the frame limit is 1..1800. Encoding uses the supplied executable directly; no tool is downloaded.
      Throws:
      IOException - when the output cannot be created, including a filename collision
    • capture

      public boolean capture(com.mojang.blaze3d.pipeline.RenderTarget target, double animationTime)
      Requests the current rendered frame. Returns false while a previous readback/write is pending or the recorder has stopped; callers must not advance their scenario when admission is refused. Invoke on the render thread.
    • busy

      public boolean busy()
      True until the outstanding GPU readback and PNG write both complete.
    • isRecording

      public boolean isRecording()
      True while new frames may be admitted. A limit, readback, or write failure automatically stops admission.
    • stop

      Stops admitting frames and returns the same asynchronous completion on every call. An outstanding frame is drained before encoding; the render thread never waits for disk IO or the encoder process.
    • close

      public void close()
      Stops asynchronously. Observe stop() to ensure the manifest/video has been finalized before client exit.
      Specified by:
      close in interface AutoCloseable