Skip to content

Render Mode

Miku AuahDark edited this page Sep 8, 2022 · 8 revisions

Live Simulator: 2 (we'll refer to this as LS2 from later on) has a feature called "render mode" which act as offline, non-realtime autoplay of beatmap and encodes it to video and audio file. This allows you to record the whole autoplay footage of your beatmap which guarantee no stuttering occurs during the process, with expense of taking long time to complete.

Since v3.0.0, render mode is no longer limited to your desktop resolution, which means you can render to 8K resolution even if your desktop is only 720p, provided you have time and powerful CPU to do so.

Prerequisites

To use "render mode", you need FFmpeg shared libraries installed, and additionally if you're running LS2 from source (which is almost all cases in Linux and some cases in Windows), you need to compile Live Simulator: 2 Extensions Lua module (we'll refer to this as LS2X from now on) from source which in turns need FFmpeg development libraries. In Linux, you just have to install FFmpeg development libraries which will do everything for you. In Windows when running LS2 directly from source using LÖVE, you need both shared and development libraries from gyan.dev. Note that the bitness must match. If you're using 64-bit LÖVE, you have to use 64-bit libraries! Furthermore in Windows, gyan.dev doesn't provide 32-bit builds so only 64-bit is supported.

Note for Linux: Some Linux distros may not have FFmpeg in their repositories. Instead, they have "avconv", fork of FFmpeg. That fork of FFmpeg is not supported by LS2X, thus making "render mode" unsupported in those Linux distros unless you compile FFmpeg itself from source.

Also Note for Linux: LS2X needs somewhat recent version of FFmpeg (v3.2 or later, v4.x and v5.x is supported). Some distros may ship with very old version of FFmpeg like v3.1 or earlier. That version is not supported by LS2X, thus making "render mode" unsupported in those Linux distros unless you compile FFmpeg itself from source.

After LS2X and/or FFmpeg shared libraries is available:

  • Linux: Place ls2x.so in LS2 save directory, usually in $XDG_DATA_HOME/love/DEPLS or ~/.local/share/love/DEPLS.

  • Windows when using LS2 binaries from releases: Just copy all FFmpeg shared libraries DLLs to the LS2 installation directory, beside livesim2.exe.

  • Windows when running LS2 from source: Copy ls2x.dll and all FFmpeg shared libraries DLLs to your LÖVE installation directory, beside love.exe.

Usage

LS2 has these command-line options for the render mode feature:

  • -render <video> <audio> Render beatmap to <video> and <audio>. Video will be either H.264, vp9, or mpeg4 in Matroska container and audio is in WAV format. FFmpeg libraries must be installed to use this feature! This option triggers the rendering mode, forcing autoplay and start the LS2 in 60 FPS timestep. Note that this option must be specified first before all options below take effect!, so if you specify -renderfxaa -render out.mkv out.wav, the -renderfxaa flag (see below) will be ignored!

  • -renderfxaa Apply Fast Approximate Anti-Aliasing to the whole screen while rendering to video file. This will soften hard edges of the resulting video but slightly making the rendering slower.

  • -renderheight <height> Set video rendering height. This determines how big the video height will be.

  • -renderwidth <width> Set video rendering width. This determines how big the video height will be.

  • -renderfps <fps> (v4.0) Set video FPS. FPS must be divisible by <rate> of -rendersrate below. Default is 60.

  • -rendersrate <rate> (v4.0) Set audio sampling rate. Only supported in x86-64 Windows and Linux. Default is 48000.

If used with -replay option, you can render your replays to video.

Example

To render beatmap ~/time_lapse.ls2 at 4K resolution in Linux, execute this in terminal:

$ love path/to/ls2 -render ~/time_lapse_rendered.mkv ~/time_lapse_rendered.wav -renderwidth 3840 -renderheight 2160 ~/time_lapse.ls2

To render first beatmap in "time_lapse.ls2" which already exist in the beatmap directory at 1080p resolution with FXAA in Windows using LS2 binaries from releases, execute this in cmd:

livesim2.exe -render time_lapse_rendered.mkv time_lapse_rendered.wav -renderwidth 1920 -renderheight 1080 -renderfxaa -play time_lapse.ls2:1

Limitations

  • Audio and video is a separate file.

  • Audio always be Wave audio, regardless of extension.

  • Audio always sampled at 44100Hz (before v3.0) or 48000Hz (v3.0 and later)

  • Video can be placed inside Matroska container or MP4 container depending on supported features in used FFmpeg libraries. Use FFmpeg's ffprobe command to detect the real container!

  • Output will always be 60 FPS video (until v4.0).

Clone this wiki locally