arcan(1)
π arcan(1) β User manual β Scriptable Multimedia Engine π
π NAME π
Arcan β Scriptable Multimedia Engine β¨
πΈ SYNOPSIS πΈ
arcan [OPTIONS] applname [APPLARGS]
π¦ DESCRIPTION π¦
okay so Arcan is a portable and fast self-sufficient multimedia engine for advanced visualization and analysis work in a wide range of applications β e.g. game development, real-time streaming video, monitoring and surveillance, up to and including desktop compositors and window managers. it's giving one engine, many main-character arcs π β¨
β¨ OPTIONS β¨
-h,--helpβ show a brief summary of commands and usage. tiny lil cheat sheet, we love her π«Ά-w,--widthpixels β set the desired active canvas width. setting this value to0will let the display driver choose based on connected displays. this can be overridden by the running appl. this value will be cached/fetched from the database. π-h,--heightpixels β set the desired active canvas height. setting this value to0will let the display driver choose based on connected displays. this can be overridden by the running appl. this value will be cached/fetched from the database. yes bestie,-hshows up here too π-m,--conservativeβ toggle conservative memory management profile. the engine will store just enough metadata to be able to reconstruct static data sources (e.g. most textures, fonts etc.) should the display context need to be rebuilt. β οΈ note that the behaviors of this option may vary radically depending on video platform. Verify and Validate heavily when using conservative mode. no cap, test it fr fr.-W,--sync-stratstrategy β specify the synchronization strategy that the display driver should use initially. these are dependent on the built-time configuration of the engine and are listed at the end of running arcan with the--helpcommand-line argument. iykyk π-M,--monitorrate β enable monitoring mode: every rate ticks, save a snapshot of the scripting engine state to a monitoring target (see-O,--monitor-out). if the rate is set to a negative value, only script errors will be written. π΅οΈββοΈ-O,--monitor-outtarget β defines the monitoring data recipient, used in combination with-M,--monitor. either specifyLOG:filenameorLOGFD:fdnofor a file destination or inherited file descriptor number. πΎ-C,--monitor-ctrlilenameor-β sets filename (use-for stdin) to work as a blocking control interface / watchdog that is triggered upon sendingSIGUSR1to the process. this can preempt script execution and is intended as an internal developer facing channel for building better inspection and debugging tools. refer to the source implementation forarcan_monitor.cfor commands and processing. π οΈ-p,--rpathpath β change default searchpath for shared resources; see the namespaces section below for additional details. ποΈ-B,--binpathpath β specify the full path to the desired frameserver (e.g./usr/bin/arcan_frameserver) or to a prefix/path/to/prefix_(decode,encode,game,terminal,remoting). π₯-L,--libpathpath β set the search path for native libraries (used e.g. by luasystem_load). π§-t,--applpathpath β change default searchpath for applications; see the namespaces section below for additional details. π-T,--scriptpathpath β change the default search path for builtin system scripts; see the namespaces section below for additional details. π-H,--hookβ specify a post-init (after runningapplname()) hook script that will be loaded and executed. the scripts are fetched from the system scripts namespace (-T,--scriptpath). providing multiple-Harguments is allowed. see the hookscripts section below for additional details. πͺ-b,--fallbackapplname β if the running application crashes due to scripting error or from misuse of the API, all running external or recoverable frameserver, connections will be transferred to applname. if applname is set to the reserved value:self, the same appl will be used without running a verifyload cycle. π-d,--databasedbname β specify a different database for use when launching external targets and as a key/value store for the running application, overriding the default ofHOMEDIR/.arcan/arcan.sqlite. ποΈ-g,--debugβ increases debuglevel, more troubleshooting data will be sent to the standard error and standard output nodes. the active debuglevel is also exposed to scripts. this can be added multiple times for additional effect. debuglevels over2enabled engine features that change engine behavior and notably increases verbosity. π-V,--versionβ print a version string to stdout and then terminate. this version string can be used to identify the build, including audio, video, input platforms and source code repository checkout id. π·οΈ-1,--pipe-stdoutβ this is only usable from anarcan_lwainstance. a requested connection point is generated and written to stdin. this is supposed to be used with a normal arcan instance running piped with-0and act as a generic mechanism for hooking up multiple arcan instances in a pipes-and-filters structure. π-0,--pipe-stdinβ see the description for 'pipe-stdin'. reads a single line from stdin and tries to open an external connection point with that name (assuming it passes normal connection point validation). π«Ά
π Unstable Arguments π
these are slated to be replaced with a more flexible display configuration system and will be changed in coming versions. users should therefore take precautions to make sure to notice when upgrading as not to break scripts that depend on these features. β οΈ
-S,--nosoundβ disable (silence) audio output. π€«-s,--windowedβ set borderless, windowed display mode. πͺ-f,--fullscreenβ fullscreen switch: the display driver will attempt to force the connected display resolution to match the specified canvas dimensions. π²-a,--multisamplessamples β enable multisampling (MSAA), default:4samples. if MSAA setup fails, the engine will silently revert to regular sampling. β¨
there is also a range of possible environment variables for tuning options related to the various input platforms. these are printed when you start arcan with the --help argument and vary depending on how the engine was compiled. π
π¦ USER-NAMESPACES π¦
for dynamically exposing files and folders with user controlled petnames and access restructions, the database and the arcan appl key value store is used. this is mainly useful / intended for cases where Arcan is used as the system display server and desktop. the keys and values follows the format: key=ns_petname value=Label:permissions:path. π
as an example, exposing the user home directory on a POSIX system would be:
arcan_db add_appl_kv arcan ns_home Home:rw:/home/me
this is intended to be controlled / managed by dynamic tools, like an external drive or encrypted storage mounting daemon. π
β¨ NAMESPACES β¨
okay bestie, buckle up β there is a whole assortment of namespaces that the engine will go hunting through whenever an appl asks for read access to a resource, or wants to create one. π
And the way all of these get set up? It varies depending on your command-line arguments, operating-system-specific scans, whether applname was given as a relative/absolute path, and a whole series of environment variables. it's giving β¨configurableβ¨.
fr fr, if you want the deep, detailed explanation from an appl developer's perspective, go check the developer documentation on the wiki. π«Ά
This setup is honestly pretty complex on purpose β it's how the engine accounts for a huge range of platforms and use-cases. The absolutely most simple configuration possible is just an application base folder (controlled with the -t command-line switch) plus a shared resource folder (controlled with the -p switch). lowkey iconic minimalism.
The most important namespaces are the APPLBASE and the RESOURCEPATH. remember those two, they're the main characters. π
Appls can manipulate (create, open, read, write) the files within the confines of APPLBASE/APPNAME. Traversal (../) outside this path will be blocked π« β but a user can explicitly map other paths into this namespace (symlink, bind-mounts or similar) and the engine will allow it. so like, the door's locked but you can install your own door if you want, iykyk.
Scripts are treated as an overlay namespace where there's a priority order in the event of a collision. By default, scripts are treated in the order of APPLTEMP -> APPLBASE -> SCRIPTPATH. More paranoid builds will want to disable APPLTEMP to prevent the creation of unpacker scripts / code generation β yes that's a real security-ish concern, not just me being dramatic. π
The most fine-grained control can be obtained by setting a number of environment variables:
ARCAN_RESOURCEPATHβ shared resources, as described above. the classic.ARCAN_SCRIPTPATHβ the system script namespace contains shared scripts that are part of the general Arcan package to promote optional re-use of higher level analysis like mouse gestures. The default search-path for this would be theshare/arcan/scriptsinstall path, though you might want to override this for custom setups or development purposes. πARCAN_APPLTEMPPATHβ used when there's a need to split the folder that an appl can use as a writable (delete, create, update) backing store. By default, this is resolved to the same folder as the appl is β but it can be unmapped to prevent an appl from killing or modifying itself. gotta respect the self-preservation vibes. πARCAN_APPLBASEPATHβ this path is used to search for appls but may be ignored for absolute paths specified on the command-line.ARCAN_APPLSTOREPATHβ the default setting is to allow the appl full access to its own folder, but this can be split into a separate store. This will then expand asARCAN_APPLSTOREPATH/APPLNAME. β¨ARCAN_STATEBASEPATHβ the default setting is to map this toRESOURCEPATH/savestatesand will then be shared between all appls (which holds true wheneverSTATEBASEis set to a subdirectory ofRESOURCEPATH). sharing is caring π«ΆARCAN_FONTPATHβ the default setting is to map this to theAPPLPATH/fontswith fallback toRESOURCEPATH/fontsbut can be set to some other system font directory for more fine-grained control (as font-parsing is complex and can be a source of vulnerabilities). yeah ngl font parsing is scary, protect yourself. πARCAN_BINPATHβ the default is to set this to/usr/bin/arcan_frameserver(or wherever the frameserver is installed, first searching./then/usr/local/binthen/usr/bin). cute lil search order, love that for us.ARCAN_LIBPATHβ this path specifies the directory where the appl is allowed to load libraries from usingsystem_load. The namespace is referenced asRESOURCE_SYS_LIBSin the scripting documentation. πARCAN_LOGPATHβ set toRESOURCEPATH/logsby default (if it exists) and is used for storing debugging, profiling and similar development/troubleshooting related data. This includes state dumps which may contain sensitive data. β οΈ so like, be careful who you share those with, bestie.
Some namespaces are also reset when an appl does an explicit switch β this behavior can be cancelled out by setting ARCAN_XXXPIN for any namespaces that should explicitly be locked to some path. π pin it and it stays pinned, periodt.
π₯ FRAMESERVERS π₯
A principal design decision behind Arcan is to split tasks that are inherently prone to security and stability issues into separate processes that should be sandboxed to as large a degree as possible, with the principle of least privilege in mind. literally the "don't give everyone admin" philosophy β¨
These behave like 'normal' clients but are grouped into fixed roles (archetypes) β like 'decode' is responsible for image parsing and so on. They are chainloaded by 'arcan_frameserver' into its respective role (afsrv_) based on a probe done at startup, a build-time mask and an environment controlled mask. For instance, to block the 'terminal' role, set AFSRV_BLOCK_TERMINAL. π« no terminal for you today.
It should be the active application (set of user-supplied scripts) that dynamically controls the level of privilege, communication and data storage that such processes have access to. you're the main character controlling the vibes, essentially. π
These are mainly an internal developer detail β some scripting functions transparently set them up, e.g. launch_decode(...) and define_recordtarget(...). so you might be using them without even knowing, sneaky iconic. π
πΈ LIGHTWEIGHT (LWA) ARCAN πΈ
Lightweight arcan is a specialized build of the engine that uses the frameserver shared memory API as its audio/video display backend. This allows Arcan to run and control additional instances of itself, with the same or a different application β thus reusing the engine to fulfill the role of application framework, rendering engine and display server all rolled into one. it's giving "I contain multitudes" β¨π¦
The lwa build works just the same (although likely with fewer dependencies on external libraries) as the main version, except the ARCAN_CONNPATH environment need to be set to a connection point that the arcan instance exposes. one tiny requirement, slay.
π HEADLESS ARCAN π
Headless arcan is a specialized build of the engine that performs all rendering in memory, and normally does not try to output anything to the screen. It adds the option to use other software defined outputs via the capabilities of the encode frameserver. By setting the video platform argument for ARCAN_VIDEO_ENCODE=encode_args, the output can be recorded or streamed, interactively as well as non-interactively. See the afsrv_encode binary for the possible encoding options. π content creator arcan, honestly.
A special detail with this build is that, since there is no strict output, the default virtual display dimensions have to be set explicitly via the -w and -h arguments. no vibes-based sizing here, be specific bestie. π
π¦ HOOK SCRIPTS π¦
There's a built-in set of more generic and re-usable scripts being distributed along with the engine. These are normally installed as a 'scripts' subdirectory in the shared set of files, though this path can be changed with the -T argument. π
A hookscript is enabled via the -H command line argument, which can be repeated to chain them together. Their arguments are extracted from the appl-arguments part of the command line in the key=value form. chain them like friendship bracelets. π
hook/shutdown.luaβ this hookscript sets a timer to whatever ashutdown=numberargument on the commandline provides, or the built-in default of500ticks. When the timer fires, an asynchronous shutdown request will be queued. This allows for easier automation and testing. β° set it and forget it.hook/external_input.luaβ this hookscript opens up a connection point where you can attach external input drivers. The default connection point for the first hook script will beextio_1, this will increment for each instance of the script that is added to the command line. Theextioprefix can be tuned by adding theext_iokey to the database for the specific appl being run, and only one input provider can be attached to the connection point at a time. one at a time, no sharing. π ββοΈhook/timed_dump.luaβ this script sets a timer to whateverdump_timer=numberordump_periodic=numberon the command-line is set to. When the timer fires, it callssystem_snapshotinto'timed_n.lua"or whateverdump_prefixis set to on the command-line. The_nsuffix corresponds to the dump sequence if on a periodic timer. ποΈ regular lil snapshot moments.hook/debugstall.luaβ this script enables the frameserverdebugstall(delay whenever a frameserver is launched) as a tool to make it easier to attach a debugger to it. The delay can be configured throughdebugstall=val(default is10) on the command-line. π΄ giving you time to attach, so considerate.hook/alloc_debugβ this script intercepts all allocation functions and attaches a debug traceback as the'tag'property of the video object. This can then be used insystem_snapshotand crash-dumps to figure out where a certain allocation came from. π΅οΈββοΈ forensic queen.hook/touch_simulator.luaβ this script takes over mouse input and re-injects as touch input. Since it intercepts the input appl- handler, it is best used as apre:hook rather than the default (post). π±οΈβ‘οΈπ the transformation arc.
π DIAGNOSTICS π
There are a number of ways the engine can shut down, especially if the engine was built in Debug mode. A governing principle for user supplied scripts is that of Fail Often, Early and Hard. This means that API misuse β i.e. missing or wrong arguments β will result in a crash and the related error description will be provided (color-coded π) to the standard output, and that a state dump will be generated and stored in the namespace specified by ARCAN_LOGPATH. dramatic? yes. useful? also yes. π
This state dump is a Lua parsable script that can be loaded either by a regular Lua interpreter. π
The environment variable ARCAN_FRAMESERVER_DEBUGSTALL can be set if you suspect that a frameserver is involved, or to blame, for an issue. This will print the process ID (pid) of the new frameserver process to standard output, then sleep for the argument supplied number of seconds, to provide enough time to attach a debugger or tracing tool. π blame the frameserver era.
There is also a way to trace the events that are passed between the main process and all the framesevers, and that is via the environment variable ARCAN_SHMIF_DEBUG=1. π watch the messages fly.
π HOMEPAGE π
https://arcan-fe.com β go say hi, bestie. π
β SEE-ALSO β
arcan_api_overview(3) arcan_lwa(1) arcan_frameserver(1) arcan_db(1) β the whole friend group, go read them too. π«Ά
π BUGS π
You can report bugs through the tracker on the github page. For normal contact and discussion, see the #arcan IRC channel on freenode. π¬
Save a snapshot of core-dumps (in the case of engine issues) or the appropriate resources/logs entries. For some issues, a copy of the database used and a list of files (with permissions) in applpath and resourcepath may also be relevant. ngl the more receipts you bring, the faster it gets fixed. π§Ύ
π COPYRIGHT π
Copyright Β© 2003-2020 Bjorn Stahl. License GPLv2+ or BSD depending on build configuration. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. π«Ά read that last bit again, bestie β no warranty, fr fr.
β¨ AUTHOR β¨
Bjorn Stahl <contact at arcan-fe dot com> β the icon behind the engine. π
and that's the whole page, bestie!! π this was arcan(1), from November 2020 β go forth and namespace responsibly. mwah ππ
π¦ where this page comes from
- nixos 26.05: arcan 0.7.1
- nixpkgs unstable: arcan 0.7.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms