Tag: games

Only record audio from specific applications with NVIDIA ShadowPlay

ShadowPlay is a feature of modern NVIDIA graphics cards that allows for recording games and other applications at native resolution with only a minimal performance hit. It also includes some genuinely useful features like instant replay.

Unfortunately, the audio options for recording are pretty limited. By default, all audio is recorded to a single mixed track. This includes the game audio, but also your mic, notification sounds, any music you're playing in the background, people talking on Steam, Discord, etc.

After some experimentation I eventually found a way to pick which applications to record the audio from, but it's not intuitive at all so I'm documenting it here.

General idea

  • Create a virtual audio device
  • Play the audio from this device to the default audio device so you can hear it
  • Force the applications you want to record to only play audio to this device
  • Tell ShadowPlay to only record audio from this device

Step by step guide

  1. Install GeForce Experience and enable the in-game overlay and hotkey in the settings. Press the hotkey to bring up the overlay. In the overlay on the right you will see a microphone icon. Click it to bring up a dropdown menu then click on "Settings". In the menu that appears, configure your microphone input and select the "Separate both tracks" option. This will cause your microphone audio to be recorded, but in a separate track from the game audio, making it easy to strip out or mix in later. You can also just use the single track mode and mute the mic instead if you never want to record yourself.

  2. Install Virtual Audio Cable. This will install two virtual sound devices on your system: "CABLE Input" (an output device) and "CABLE Output" (an input device). When sounds are played out the "CABLE Input" device, they can be recorded by listening to the "CABLE Output" device.

  3. Open the "Sounds" control panel (Open the Control Panel, click "Hardware and Sound", then "Sound"), go to the "Recording" tab and find the "CABLE Output" device. Double click it to open its properties. Go to the "Listen" tab, check the "Listen to this device" option, and select the "Default Playback Device" as the target. This will allow you to hear any audio that is played by this device. Configuring the "CABLE Output" device in the sounds control panel

  4. Launch all applications and games you want to record.

  5. Open the Sound mixer (Start menu, type "Sound mixer options"). You should see your open programs mapped to audio inputs and outputs. If you don't see a "NVIDIA Container" program listed then activate the GeForce overlay and toggle the "Instant Replay" setting on and off to make it appear. Change the "Output" of the "NVIDIA Container" application to the "CABLE Input" device. This tells ShadowPlay to only record the audio sent to this output.

  6. Change the "Output" of each of the applications you want to record to "CABLE Input". I'm recording the audio from a game called Alien Swarm: Reactive Drop in the example below. Recording the audio from Alien Swarm: Reactive Drop

  7. Start recording (or enable the instant replay recording mode)

The resulting video files will only include audio from the applications you selected in step 6. If you opted to record your microphone in step 1, it will be in a separate audio track that you can either remove or manually mix into the main audio later.

Notes

  • Tested on Windows 10 21H1 running GeForce Experience v3.22.0.32
  • Once this is all set up, the only thing you'll have to mess with on an ongoing basis is the mixer settings (steps 5 and 6)

Fixing save file corruption in Ridiculous Fishing

Ridiculous Fishing is a game by Vlambeer about fishing. That's if you can call chainsawing fish and blowing them out of the sky with a bazooka "fishing".

I've been playing this game on and off for a while now, but just recently I had a problem where my save file somehow got corrupted, making the app refuse to open.

The problem first manifested as the game freezing for up to 5 seconds when navigating around the UI or buying items in the in-game store. Since I was running the game on a Nexus 5 (not the latest and greatest, but pretty close), it seemed weird. The delay got longer and longer until the game eventually crashed and refused to reopen.

Since I was pretty far into the game (I only needed to catch one more species of fish!), I opted to try to fix it instead of just wiping the app's data and starting again. I initially tried clearing the app's cache and reinstalling the app, but the problem persisted.

The next step was to dump the games's data to my computer so I could do some analysis on it. Some exploration on the device revealed that the settings and data were stored in the folder /data/data/com.vlambeer.RidiculousFishing.humble (I have the Humble Bundle version of the app).

To pull that folder to my current directory, I used ADB:

1
2
adb root #Restart adbd on the device with root permissions
adb pull /data/data/com.vlambeer.RidiculousFishing.humble/

A quick du -h revealed that something was very wrong in the files/Library/Preferences/com.vlambeer.RidiculousFishing.humble.plist file. It should've been just a text document, but was well over 200MB.

After trying out of habit to open the file in Vim and having it hang (oops), I paged through the document with less. About halfway through the file, there was a line containing &amp;lt;message&amp;gt;@eggbirdTBA Take it to the Smartypants Bar (no, that's not a formatting error, in the plist there's XML data stored in a <string> element, requiring the < and > characters to be escaped) followed by about 200MB of garbage.

Apparently there are ways to load huge files in Vim, as well as other text editors that handle them nicely, but since I already knew what line was causing the issue, a simple sed command would do the trick.

1
sed '/Take it to the Smartypants Bar/d' com.vlambeer.RidiculousFishing.humble.plist > temp.plist

Total size of temp.plist: 107.11KB. Much better.

After going though and deleting some lines around the one that was removed (to make the XML valid again), I pushed the file back to the device:

1
adb push temp.plist /data/data/com.vlambeer.RidiculousFishing.humble/files/Library/Preferences/com.vlambeer.RidiculousFishing.humble.plist

Success! The game opened properly, all the freezing issues were gone, and my save data was still there.

Now to find that stupid Mimic Fish...


Making Steam for Linux close to the system tray

Steam for Linux is a little odd in how it handles a user clicking the close button. Instead of exiting the program or mimimizing the application to the system tray, it just minimizes it to the taskbar. The developers have said that this is temporary and that it will be changed in the future, but for now, there is a workaround.

To make Steam always minimize to the system tray, just add STEAM_FRAME_FORCE_CLOSE=1 to your environment.

For more information see the original GitHub issue.

© Carey Metcalfe. Built using Pelican. Theme is subtle by Carey Metcalfe. Based on svbhack by Giulio Fidente.