In-Engine Audio and Video Capture Plugin for Unreal Engine 4
Switch branches/tags
Nothing to show
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
plugin Add 4.20 version of plugin Aug 23, 2018
scripts Add UE4 version checks to scripts Aug 3, 2018
LICENSE Initial source commit Jul 7, 2018
README.md Migrate MediaIPC Conan recipe to ue4-conan-recipes repo Nov 2, 2018

README.md

In-Engine Audio and Video Capture Plugin for Unreal Engine 4

This plugin utilises the MovieSceneCapture and AudioMixer modules to capture both audio and video from Unreal Engine 4 projects, without the need for external screen capture tools. This overcomes the lack of audio support when exporting movies using Sequencer, and also facilitates capturing audio and video when performing offscreen rendering on a headless device or inside an NVIDIA Docker container under Linux.

The plugin acts as a MediaIPC producer process, transmitting data to any running MediaIPC consumer process that has been initialised with the prefix "UE4Capture". For details on creating and using MediaIPC consumers, see the documentation from the MediaIPC GitHub repository.

Contents

Requirements

  • Unreal Engine 4.19.0 or newer
  • CMake 3.8 or newer
  • ue4cli
  • conan-ue4cli
  • Under Unreal Engine 4.19, one of the public header files for the UE4 AudioMixer module includes a private header file, causing compilation errors when included by non-Engine modules. To fix this, run the script patch-headers.py in the scripts directory. This issue is fixed in Unreal Engine 4.20.
  • The Conan package for libMediaIPC needs to be compiled by running the command build.py MediaIPC-ue4 from the ue4-conan-recipes repository.
  • Audio capture only works when using an output device based on the AudioMixer module, which requires running the game with the -AudioMixer command-line argument.

Usage

Getting started with UE4Capture plugin is extremely simple. First, create a MediaIPC consumer to receive the capture output:

  • Grab the MediaIPC source code and build the CMake project, including the example producers and consumers.
  • Run the executable for an example consumer (e.g rawdump_consumer.cpp) with the command-line argument "UE4Capture", which will set the correct prefix value.
  • The consumer should display the text "Awaiting control block from producer process...".

Then, setup your UE4 project to act as the MediaIPC producer process:

  • Create a new C++ UE4 project and copy the UE4Capture directory from the appropriate plugin subdirectory for your Engine version to your project's Plugins directory.
  • Modify your default game mode to inherit from the ACaptureGameMode base class (may not work under Windows), or copy the code into your own game mode (works under all platforms.)
  • Build the project by running the command ue4 build from the directory containing the project's .uproject file.
  • Run the project by running the command ue4 run -game -AudioMixer from the directory containing the project's .uproject file.

The capture will now begin automatically:

  • Once the game is running and the default level has loaded, switch back to the window for the consumer process. It should now display the text "Receiving stream data from producer process...". This indicates that the capture has been initiated successfully.
  • Once you close the window for the game, the consumer process will detect that the capture has ended and finalise its output, displaying the text "Stream complete.".
  • In the case of the rawdump_consumer example, the output will be a pair of files (audio.raw and video.raw) containing the raw, uncompressed capture data. You will need to post-process these files using a tool such as FFmpeg or GStreamer to encode the raw bitstreams into a usable video file.

License

Copyright © 2018, Adam Rehn and Aidan Possemiers. Licensed under the MIT License, see the file LICENSE for details.