Donate for Oldunreal:


Links to our wiki:




Unreal Reference



Contact us:
Submit News
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Recording Unreal footage (Read 1242 times)
Oldunreal MasterPoster

The Great Emerald

Posts: 5361
Location: Vilnius, Lithuania
Joined: May 21st, 2007
Gender: Male
Recording Unreal footage
Aug 25th, 2014 at 7:40pm
Print Post  
Now that I'm going to start a run of Unreal: RtNP, I tried and figured out how to record the game on Linux. It's a bit complex, though, so I'll share the method I discovered.

Important thing to note is that Unreal is a 32-bit game, so you need 32-bit recording software. Which can be quite a hassle to find these days! Thankfully, the Simple Screen Recorder (SSR) has a library called ssr-glinject that can also be built in 32-bit (and is built in openSUSE at least, in the Packman repository).

However, Unreal isn't very cooperative and will immediately segfault if you try to record it regularly. It seems to not like things being in its LD_PRELOAD for some reason, and to get accelerated recording, an OpenGL hook is needed.

The good thing is that the Linux version of Unreal actually allows you to specify the name of the OpenGL library to load! So you can specify to load the ssr-glinject library like this:
Select All

That works to get the hooks, but of course you won't be able to do much without SSR itself running. And it always tries to use LD_PRELOAD, thus crashing the game. But there's a workaround you can do: simply make SSR call `bash -c 'LD_PRELOAD="" ./UnrealLinux.bin'` – that way the program sets LD_PRELOAD, but the command it executes unsets it immediately before starting the game. The "bash" part is needed because otherwise SSR will assume that LD_PRELOAD is the name of the executable.

Don't forget to set the Working Directory to your Unreal/System directory (UnrealLinux.bin isn't smart enough to figure out where it resides in, unfortunately).

So that's the short version. It will work just as well as it does recording any other program when set up that way.

However, there are some extra things I personally need that SSR doesn't handle. First, I have two monitors, and SDL by default puts the game on the wrong one. That can be solved with an additional environment variable.

Second is mouse acceleration. SDL by default doesn't do anything to change it, it uses the desktop settings (which means you get mouse acceleration). The optimal way to toggle it is to use `xinput` to first disable it and then re-enable it.

Third is sound. SSR lacks a way to record more than one sound stream at the moment. And I need to record both the game audio and the microphone... There's a workaround for that too: http://www.maartenbaert.be/simplescreenrecorder/recording-game-audio/

So in the end I made myself two scripts to handle it all. One script for launching SSR (have to set up the audio before launching it), and one for launching Unreal with all those extra features. The first one looks like this at the moment:
Select All
pactl load-module module-null-sink sink_name=duplex_out
pactl load-module module-null-sink sink_name=game_out
pactl load-module module-loopback source=game_out.monitor latency_msec=1
pactl load-module module-loopback source=game_out.monitor sink=duplex_out latency_msec=1
pactl load-module module-loopback sink=duplex_out latency_msec=1
pactl unload-module module-loopback
pactl unload-module module-null-sink 

Note that in pavucontrol, if you right-click on a sink's name, you can change it. I named the duplex_out one "Unified" and the game_out "Game". These names will stick around. Make sure to put the inputs the way it's explained in the above webpage and set SSR to record "Monitor of Unified" or whatever else you named duplex_out.

In my case, somehow Unreal refused to get remapped to the Game sink... No idea why, setting it simply didn't do anything. But thankfully there is another environment variable, called PULSE_SINK, that controls which sink the program should output the sound to.

The Unreal launcher script ended up being this:
Select All
MOUSE_NAME="The full name of your mouse"
cd /path/to/Unreal/System

xinput set-prop "$MOUSE_NAME" "Device Accel Profile" -1
xinput set-prop "$MOUSE_NAME" "Device Accel Profile" 0 

You get the full name of your mouse by running `xinput list`. You can use the numerical ID as well, but you might get problems if you connect the mouse to a different USB slot down the road.
Also note that profile 0 is the default profile. If you use a different profile, use the profile number you want at the second command there.

To get SSR to execute this, I have in OpenGL Settings → Command `bash ~/bin/unreal-ssr.sh` (the latter is of course the path to the script above). As a bonus, since I have that `cd` statement in my script, I no longer need to enter anything into Working Directory.

So after that everything works very nicely. And the person who made SSR is working on a nicer way to record multiple inputs, so I'll be able to drop one of the scripts once that is done.
Back to top
IP Logged
Page Index Toggle Pages: 1
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo