This is an experimental sysmodule that allows capturing the running game output to a pc.
Two versions are provided: one to stream via USB and one to stream over the network (TCP). Currently it's not possible to use both at the same time.
Using mpv player is recommended as it's the most straight forward to set up, any other player that supports raw h264 streams via tcp or stdin should work but you may have to configure it manually.
- Video quality is fixed to 720p @ 30fps with h264 compression (hardware limit)
- Audio quality is fixed to 16bit PCM @ 48kHz stereo. Not compressed
- Only works on games that have video recording enabled (aka you can long-press the capture button to save a video)
- Video and audio are two different streams, they're likely to desync as they require two different player instances. Vlc does support a secondary audio stream but i didn't manage to get it working properly.
- Only captures game output. System UI, home menu and homebrews running as applet won't be captured
- Video feed is not realtime, there will always be a minimum of ~1 second of delay.
- Stream quality depends heavily on the environment, bad usb wires or low wifi signal can affect it significantly.
- Stream quality is also affected by software configuration, more details at the bottom.
- USB streaming is not available when docked
- Requires firmware >= 6.0.0
Clearly with these limitations this sysmodule doesn't allow "remote play" and does not replace a capture card.
Setting up the sysmodule
The provided builds already contain the correct file structure, you should just be able to extract them to your sd card.
To remove the sysmodule just delete the atmosphere/titles/00FF0000A53BB665 folder from your sd card.
CFWs other than atmosphere should work but i won't provide support for them.
This is the easiest way to stream, In this mode the sysmodule is completely standalone, you should be able to play the video stream just by running mpv tcp://<switch ip address>:6666 --no-correct-pts --fps=30 and mpv tcp://<switch ip addr>:6667 --no-video --demuxer=rawaudio --demuxer-rawaudio-rate=48000 for audio.
When using network streaming it's not recommended to stream both audio and video at the same time as it may cause slowdowns. In general network streaming has more lag and delay compared to USB, it is worth the time to set it up, especially for gameplay recording.
To stream via usb you need the UsbStream program, it's built using dotnet core 3.0 and is compatible with linux as well.
First of all you should make sure your drivers are set up correctly (only the first time) :
Driver setup on windows
On windows you may get the device not found or unsupported driver errors or very bad performance on the stream, in this case you may have the wrong driver set up, download zadig and install the libusb-win32 driver for the "Nintendo Switch" device. This won't interfere with other application that communicate with the switch via usb as this sysmodule uses a different product id.
Driver setup on linux
On linux you may have errors about loading the libusb-1.0 library, this happens when the file name is different than the one expected by dotnet, you can make a symlink as described on the LibUsbDotNet repo:
sudo find / -name "libusb-1.0*.so*" and then
cd /lib/x86_64-linux-gnu sudo ln -s libusb-1.0.so.0 libusb-1.0.so
(Example commands, change the paths with the one you find on your pc)
UsbStream supports three streaming modes:
- mpv or stdin : pipes the received data directly to a video player via stdin, this will use no caching so you'll have low delay but it may lag. Using mpv will automatically add the needed configuration for mpv, stdin will require you to type the args to pass to the player
- tcp : opens a tcp server so players can connect to it and use their own caching mechanism to remove or reduce lag (at the price of an higher delay)
- file : writes the received data directly to a file so it can be converted to a common format later.
Launch UsbStream like this: UsbStream video <streaming mode> <arg> audio <streaming mode> <arg>
When using mpv the arg is the mpv executable (.com file on windows) path, you have to repeat it twice if using both streams.
The tcp option requires a free port number and the file option the output file path.
To disable a stream just omit the name and its fields.
UsbStream audio mpv C:/programs/mpv/mpv : Plays audio via mpv located at C:/programs/mpv/mpv, video is ignored UsbStream video mpv ./mpv audio mpv ./mpv : Plays video and audio via mpv (path has to be specified twice) UsbStream video tcp 1337 audio file C:/audio.raw : Streams video over port 1337 while saving audio to disk
Note that on windows you should use the mpv.com file and not mpv.exe, omitting the extension will automatically use the right one Launching UsbStream without any parameter will display more options and examples.
To connect to the tcp streams you can use: mpv tcp://localhost:<video port> --no-correct-pts --fps=30 for video and mpv tcp://localhost:<audio port> --no-video --demuxer=rawaudio --demuxer-rawaudio-rate=48000 for audio
To get the most out of this sysmodule you have to do a lot of testing to find the best configuration that works for you, here are some tips and answers to common issues :
- If the video stream doesn't start immediately try moving the camera around in the game, to display something the video player needs to acquire a video keyframe first
- If the stream is very poor try a different usb cable and driver with zadig, for network stream bring your console closer to the router, try using a lan adapter or windows' own hotspot mode.
- An usb 3 wire is slightly better than usb 2, but both should work.
- Quality also depends on the cpu utilization of the game you're running, OC can improve performances.
- Using cache will reduce lags at the cost of an higher delay, for mpv it's on by default (except when using usb stream with mpv mode), if you want to try without it the command line arg for mpv is --cache=no --cache-secs=0. There's a lot of room for experimenting here, try different values to find the combination that works best for you.
- If using no caching when the screen goes full black or white (eg loading screens) it may cause some desync and the stream will start to drop frames, eventually it will fix by itself but it could take some time, the fastest solution is to open the home menu for a few seconds and then resume the game, for usb stream you can try setting the --desync-fix flag (this will introduce glitches).
- Memory usage is kept as low as possible (512K for usb ver, 3MB for network) but running this with many other sysmodules, or ones particulary heavy like sysftpd will not work or hang your console on boot.
- The usb version stops working when launching another homebrew that requires usb access like nxmtp or goldleaf.
- Implement a key combination to reinitialize usb when this happens (?)
- Merge the usb and network stream versions and make an homebrew app to toggle between the two
- Improve automatic desync detection and fix for UsbStream
- Everyone from libnx and the people who reversed grc:d and wrote the service wrapper, mission2000 in particular for the suggestion on how to fix audio lag.
- mtp-server-nx for their usb implementation
Que novedades incluye la versión 5.0
- SysDVR-Client was upgraded to the just released .NET 5.0. Make sure to download it before trying this update. On windows you must install the x64 version
- Custom built-in video player to ensure best performances, brings down latency to about 100ms or less, literally can't get better than this.
- The built-in player uses ffmpeg and SDL2. Dlls are included for windows 64-bit, on mac and linux you can install them from your package managers, i added example commands in the guide.
- As for 32 bit Windows ffmpeg officially doesn't provide 32 bit builds anymore. If you're still using a 32 bit PC you can get unofficial builds from third parties and extract them to the SysDVR-Client folder, this should work but i'm not providing support for it, you should upgrade your PC.
- The implementation is still pretty rough and there's room for improvement but it's already a major step up from mpv, looking forward to user feedback.
- All the previous streaming modes are still avalilable, you can see them with the --help option
- New settings app with a proper GUI, explainations and links to the guide.
- SysDVR-Client GUI has been updated to be simpler to use: only select USB or type the IP and click launch to stream.
- Tweaked some timing and threading priorities that should improve performances on the console side
- Due to the limited testing i can do on my own i don't know if these changes have any negative side effects, i didn't notice anything wrong but in case of problems like lag in games or degraded performances let me know and i'll revert it if it's necessary.
- Added support for 32 bit arm in SysDVR-Client, now it can run on many single board computers like the raspberry pi
- Depends on .NET support for your board. Raspberry pi zero and 1 are not supported due to older arm version.
- Will most likely need manual configuration of hardware accelerated decoding to run smoothly, there's an explaination here
- Due to the changes to SysDVR-Client the command line arguments have slightly changed as well, this will likely break launch scripts generated by the GUI, make sure to delete them and create new ones with the latest version.