{"id":23084773,"url":"https://github.com/arciisine/screen-recorder","last_synced_at":"2025-08-24T09:30:57.471Z","repository":{"id":56573129,"uuid":"167966557","full_name":"arciisine/screen-recorder","owner":"arciisine","description":"Cross platform screen recording utility (with audio support), with animated GIF conversion","archived":false,"fork":false,"pushed_at":"2021-06-21T12:13:50.000Z","size":41,"stargazers_count":17,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-16T16:49:47.028Z","etag":null,"topics":["audio","ffmpeg","linux","osx","screencapture","screencast","videorecord","win32","x11"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arciisine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-28T13:26:13.000Z","updated_at":"2024-09-18T19:21:30.000Z","dependencies_parsed_at":"2022-08-15T21:10:42.072Z","dependency_job_id":null,"html_url":"https://github.com/arciisine/screen-recorder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arciisine%2Fscreen-recorder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arciisine%2Fscreen-recorder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arciisine%2Fscreen-recorder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arciisine%2Fscreen-recorder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arciisine","download_url":"https://codeload.github.com/arciisine/screen-recorder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230788271,"owners_count":18280303,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","ffmpeg","linux","osx","screencapture","screencast","videorecord","win32","x11"],"created_at":"2024-12-16T16:44:33.725Z","updated_at":"2024-12-22T03:12:58.020Z","avatar_url":"https://github.com/arciisine.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @arcsine/screen-recorder\n\n`@arcsine/screen-recorder` is a cross-platform library for recording desktop screens. The application relies upon [FFmpeg](https://www.ffmpeg.org/) as the base for recording. The primary functionality of the library is to start and stop recordings for a specific process (or active window). Additionally, the recorder supports audio recording, but has some limitations on macOS.  \n\nOSX requires a [custom build of FFmpeg](https://github.com/arciisine/vscode-chronicler/tree/master/binaries/osx/ffmpeg) to bypass choppy audio.  More information on the custom build can be found [here](https://trac.ffmpeg.org/ticket/4513).\n\nThe library works on macOS, Windows and X11-based Desktops (Linux, BSD). Wayland support is missing.\n\n## Prereqs\n\n* [FFmpeg](https://www.ffmpeg.org/download.html), 4.1+ with libx264 support.\n\n## Install\n\n```\n$ npm install @arcsine/screen-recorder\n```\n\n## Usage\n\n```js\nconst { Recorder } = require('@arcsine/screen-recorder');\n\n(async () =\u003e {\n    const { finish, stop } = await Recorder.recordActiveWindow({\n      file: './test.mp4',\n      fps: 3,\n      duration: 5\n    });\n    \n    await finish;\n})();\n```\n\n## API\n\n### Recording\n\nThe recording api is for initiating and handling screen recordings.\n\n```typescript\n\nclass Recorder {\n  static async recordActiveWindow(opts: RecordingOptions): Promise\u003cRecordingResult\u003e;\n  static async recordWindowForProcess(pid: number, opts: RecordingOptions): Promise\u003cRecordingResult\u003e;\n  static async recordWindow(opts: RecordingOptions): Promise\u003cRecordingResult\u003e;\n}\n\ninterface RecordingOptions {\n  // The location you want to store your output to\n  file: string;\n  // The framerate for recording, defaults to ffmpeg's default if not specified\n  fps?: number;\n  // Record audio?\n  audio?: boolean;\n  // How long to record for, default is until stop is called\n  duration?: number;\n\n  ffmpeg: {\n    // Path to ffmpeg executable, if not specified, the library will attempt to find it on the path\n    binary?: string;\n    // Any specific transcoding flags  \n    transcode?: any;\n    // Any specific ffmpeg flags\n    flags?: any;\n  }\n}\n\ninterface RecordingResult {\n  // A promise that resolves when the recording finishes, the resolved options are returned and \n  //    are usable as inputs into the GIFCreator\n  finish: Promise\u003cRecordingOptions\u003e;\n  \n  // The raw child process of the ffmpeg operation\n  proc: ChildProcess;\n  \n  // A function to programmatically stop the recording\n  //  The now parameter indicates a hard stop or a soft stop\n  stop: (now?: boolean) =\u003e void;\n}\n```\n\n\n\n### Animated GIF Construction\n\nThe GIF generator handles files generated from screen recordings to produce animated gifs of the output\n\n```typescript\n\nclass GIFCreator  {\n  static async generate(opts: GIFOptions): Promise\u003cGIFResult\u003e;\n}\n\ninterface GIFOptions {\n  // The file you want to convert to an animated gif\n  file: string;\n  // Output file defaults to the file name with a .gif extension\n  output?: string;  \n  // The framerate for recording, defaults to ffmpeg's default if not specified\n  fps?: number;\n  // The scale factor on the final gif\n  scale?: number;\n\n  ffmpeg?: {\n    // Path to ffmpeg executable, if not specified, the library will attempt to find it on the path\n    binary?: string;\n  };\n}\n\ninterface GIFResult {\n  // A promise that resolves when the recording finishes, the final filename is returned\n  finish: Promise\u003cstring\u003e;\n  \n  // A function to programmatically stop the conversion\n  //  The now parameter indicates a hard stop or a soft stop\n  stop: (now?: boolean) =\u003e void;\n}\n```\n\n### DownloadUtil\nAdditionally, the library supports the ability to dynamically download an ffmpeg binary. This is meant to be used by library consumers to allow for \nprompting of downloads if the binary is not found.\n\n```typescript\nclass DownloadUtil {\n  /**\n   * Will download a component to the specified destination \n   */\n  static async downloadComponent(opts: {\n    // ffmpeg | ffplay | ffprobe\n    component?: Component,\n    // Where the executable should be stored\n    destination: string,\n    // The version you want installed, defaults to latest\n    version?: string,\n    // The os/arch you want to install, defaults to auto-detect\n    platform?: Platform,\n    // Listen on the download progress with percentage downloaded\n    progress?: (pct: number) =\u003e void\n  }):Promise\u003cstring\u003e;\n}\n```\n\n## Example\n\nRecording an active window, and converting to an animated gif\n\n```typescript\nimport { Recorder, GIFCreator } from './src';\n\n(async function () {\n  const { finish } = await Recorder.recordActiveWindow({\n    file: './test.mp4',\n    fps: 3,\n    duration: 5\n  });\n\n  const finalOpts = await finish;\n\n  const gifOpts = await GIFCreator.generate({\n    ...finalOpts,\n    scale: .25,\n    output: 'funny.gif'\n  });\n  await gifOpts!.finish;\n})();\n\n```\n\n## Maintainers\n- [Timothy Soehnlin](https://github.com/arciisine)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farciisine%2Fscreen-recorder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farciisine%2Fscreen-recorder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farciisine%2Fscreen-recorder/lists"}