Learn how to capture videos using the OpenH264 plugin integration in GameDriver
Installation
The 2025.01 release introduced the ability to capture videos during test execution using the OpenH264 open-source plugin. This integration does not include the plugin, however, and so it must be installed for each of the intended platforms you wish to build for and test. To download the plugin, open the GameDriver menu in your Unity project, and select OpenH264 > OpenH264 Download Manager:
This opens a dialog where you can select the platform you wish to download the plugin for. Simply select the checkboxes beside each of the platform(s), and click Sync.
The download(s) will start automatically. Note: This is a third-party download, and may be slow.
Once the download(s) have been completed, they will show as Done, and the dialog can be closed.
Usage
The OpenH264 integration enables the capture of video using the StartVideoRecording and StopVideoRecording API methods. There are three overloads for the StartVideoRecording command that provide different methods of recording, depending on your use case. The first simply captures a video of the entire viewport, with scale and magnification arguments:
public void StartVideoRecording(float imageScale = 1, float magnification = 1, int timeout = 60)
The second allows you to focus on a specific object in the scene by specifying the HierarchyPath of the object:
public void StartVideoRecording(string trackObjectFromPath, float imageScale = 1,
float magnification = 1, int timeout = 60)
The third allows you to center recording on a specific Vector2 position of the screenspace viewport:
public void StartVideoRecording(Vector2 centerOnPosition, float imageScale = 1,
float magnification = 1, int timeout = 60)
Once you are done recording during your test, whether by waiting for a set amount of time or a combination of timing and actions, you would use StopVideoRecording to stop the recording. This command includes arguments for the filename, whether to copy the file back to the ApiClient and how to handle filename collisions in case you want to overwrite an existing file or not.
public string StopVideoRecording(string outputFileName = "capture", bool storeInGameFolder = false,
FileCollisionOption collisionOption = FileCollisionOption.GenerateUniqueName, int timeout = 60)
Conclusion
As you can see, this is a simple solution for capturing video during your test execution. Keep in mind that videos can be quite large in size when deciding where in your tests to capture, and for how long.