Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
electron-video-recorder
Advanced tools
Capture Electron's window and export as video
ffmpeg
if you have FFmpeg installed, make sure to set the FFMPEG_PATH
environment variable;
Or, install @ffmpeg-installer/ffmpeg
electron
npm i electron-video-recorder
With Electron's Offscreen API, you can export videos in the background:
const fs = require("fs");
const { capture } = require("electron-video-recorder");
const { app, BrowserWindow } = require("electron");
const win = new BrowserWindow({
webPreferences: { offscreen: true },
show: false,
});
capture(win, { savePath: 'capture.mp4', fps: 25 }).then(handle => {
handle.stop().then(() => {
const buffer = fs.readFileSync('capture.mp4');
win.close();
win.destroy();
});
})
Or with async func:
const fs = require("fs");
const { capture } = require("electron-video-recorder");
const { app, BrowserWindow } = require("electron");
const win = new BrowserWindow({
webPreferences: { offscreen: true },
show: false,
});
const handle = await capture(win, { savePath: 'capture.mp4', fps: 25 });
// Set up your custom stop event
await new Promise((r) => setTimeout(r, 10000));
const buffer = fs.readFileSync('capture.mp4');
win.close();
win.destroy();
win
<BrowserWindow>: window to be capturedoptions
<Object>
savePath
<String>: path to save the exported video;fps
<Number>: The frames per secord, defaluts to 25
;format
< mp4
| gif
>: output format, default to mp4
;niceness
<Number>: config of fluent-ffmpeg;Core class of capture, created when call capture(win)
, and return an instance;
Manually stop capturing.
This method will automatically be called when BrowserWindow
is closed
or destroyed
const capture = await capture(win, { savePath: "capture.mp4" });
await new Promise(r => setTimeout(r, 5000));
await capture.stop();
There's an Electron example in project, Clone the project and run:
yarn dev
This library is referenced from playwright-video
FAQs
Record Electron's window and export as video
We found that electron-video-recorder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.