Screenshots and short video clips of a player's screen, for staff tools and anticheats.
It answers the same calls as screenshot-basic, so anything made for screenshot-basic keeps working when you swap it in. On top of that it records video, keeps copies on the server, and can upload to Discord or an image host from the server, so no upload keys ever reach players.
- warden: screenshots on every kick and ban, and with
Config.clipa video of the seconds before. The clip is attached to the anticheat log. - fivecord:
/screenshot,/recordand a Record button on/lookup. Clips are sent straight to Discord. - fivepanel: Screenshot and Record 10s on a player's profile, and warden's clips on the Anticheat page.
-
Remove screenshot-basic. fivecapture takes its place.
-
Drop
fivecaptureinto your resources and add toserver.cfg, before anything that uses it:ensure fivecapture -
Optional, for uploads to Discord:
set fivecapture_webhook "https://discord.com/api/webhooks/..."
Files come back to the server over HTTP, the same way screenshot-basic's do. If a player's game can't reach the server that way, they come through the game connection instead.
config.json:
image |
Default encoding (jpg, png or webp), quality from 0 to 1, and the widest a screenshot gets |
video |
Size, frames per second and bitrate of clips, and the longest clip anyone can ask for |
maxMB |
Biggest file a player can send back |
keepDays |
Days to keep saved files in captures/. 0 keeps them forever |
upload |
Where upload = true sends files: none, discord or custom |
custom |
Any host that takes a multipart upload: url, the form field, headers such as an API key, and urlField, where the link is in its JSON answer (dots for nested, like data.url) |
Video at 1280x720, 24 fps and 2.5 Mbps comes to about 3 MB for 10 seconds. Discord takes up to 10 MB from webhooks and bots.
From the server console, fivecapture <id> saves a screenshot of that player and fivecapture <id> 10 a 10 second clip. They go in captures/.
Server, with a callback from Lua:
exports.fivecapture:screenshot(source, { encoding = 'jpg', quality = 0.8 }, function(err, r)
-- r.data is a data URI
end)
exports.fivecapture:record(source, 10, { upload = true, message = 'Clip of ' .. GetPlayerName(source) }, function(err, r)
-- r.file is the saved video, r.url the link once uploaded
end)
exports.fivecapture:upload('/path/from/r.file', { webhook = 'https://discord.com/api/webhooks/...' })From JavaScript, leave out the callback and await the result instead.
Options:
encoding, quality |
Screenshots only |
width, height, fps |
Override the config for this one |
save |
Keep a copy in captures/. On by default for clips |
data |
Return the file as a data URI. On by default for screenshots |
upload |
true for the configured upload, or discord or custom |
webhook |
Upload to this Discord webhook instead of the configured one |
message |
Text posted with a Discord upload |
The result has type, size, and depending on the options data, file and url. When an upload fails, uploadError says why and the file is kept in captures/.
screenshot-basic's calls work as before:
-- server
exports['screenshot-basic']:requestClientScreenshot(source, { encoding = 'jpg' }, function(err, data) end)
-- client
exports['screenshot-basic']:requestScreenshot(function(data) end)
exports['screenshot-basic']:requestScreenshotUpload(url, 'files[]', function(response) end)Only the server can ask for a player's screen. Each capture gets a one-time token, and a file sent back without the right one is refused.
The server code and the capture page are TypeScript, bundled with esbuild into dist/server.js and html/capture.js, both included.
npm install
npm run build
npm test
Made by IamZach. Questions, bugs or ideas: discord.gg/agn
MIT

