Skip to content

Automatically collects data of screen recording and cursor/keyboard input from desktop environment, supporting windows/linux and macos

License

Notifications You must be signed in to change notification settings

maxwellVisual/desktop-data-collector

Repository files navigation

desktop-data-collector

项目简介

desktop-data-collector 是一个跨平台的数据采集服务,为训练桌面级transformer模型和微调桌面智能体的数据采集任务设计,支持采集键盘、鼠标、音频、屏幕等多种输入和环境信息。项目采用模块化设计,用户可通过配置文件灵活启用或关闭各采集模块,采集数据统一存储于本地指定目录,便于后续分析和处理。

功能模块

  • 键盘采集(KeyboardLogger)
    记录所有键盘按键(按下/释放)事件,保存为 jsonl 文件,包含事件类型、按键、时间戳、操作系统、桌面环境和元数据。

  • 鼠标采集(MouseLogger)
    记录鼠标移动、点击、滚动事件,保存为 jsonl 文件,包含事件类型、位置、按钮、滚动距离、时间戳、操作系统、桌面环境和元数据。

  • 音频采集(AudioCapture)
    录制系统音频(默认麦克风),每次采集 60 秒,保存为 mp3 文件,并生成包含操作系统、桌面环境、时间戳和元数据的 json 文件。依赖 sounddevice、soundfile、ffmpeg。

  • 屏幕采集(ScreenCapture)
    使用 ffmpeg 跨平台录制屏幕,保存为 mp4 文件,并生成包含操作系统、桌面环境、时间戳、ffmpeg 命令等信息的 json 元数据。支持 Windows、macOS、Linux(Wayland/X11)。

安装

依赖

  1. 安装 Python 3.7 及以上版本。
  2. 需安装以下系统依赖:
    • ffmpeg(屏幕和音频采集)
    • ffprobe(屏幕采集校验)
    • libportaudio2(Linux 音频采集,sudo apt-get install libportaudio2
    • g++/libstdc++(部分 Linux 发行版需更新以支持音频采集)

pip自动安装

pip install git+https://github.com/maxwellVisual/desktop-data-collector

手动安装

git clone https://github.com/maxwellVisual/desktop-data-collector
cd desktop-data-collector
pip install -r requirements.txt
pip install -e .

配置方法

编辑 collector/config.yaml,可按需启用/关闭各模块并设置存储路径。例如:

modules:
  screen: true
  audio: true
  keyboard: true
  mouse: true
  system: true
storage_path: "./data"
metadata:
  additional_info: ""

运行方式

在项目根目录下运行主程序:

python -m collector.main

python collector/main.py

数据存储说明

  • 所有采集数据均存储于 storage_path 指定目录(默认 ./data)。
  • 键盘、鼠标数据为 jsonl 格式,音频为 mp3+json,屏幕为 mp4+json。
  • 每条数据均包含操作系统、桌面环境、时间戳和可选元数据,便于后续分析。

注意事项

  • 屏幕采集需安装并配置好 ffmpeg,Linux 下需区分 X11/Wayland 环境。
  • 音频采集需安装 libportaudio2(Linux),并确保 ffmpeg 可用。
  • 部分模块需管理员权限(如 PipeWire 屏幕采集)。
  • 如遇 GLIBCXX 相关错误,请更新系统 g++/libstdc++。

贡献与反馈

欢迎提交 issue 或 PR 以完善功能或修复问题。

About

Automatically collects data of screen recording and cursor/keyboard input from desktop environment, supporting windows/linux and macos

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published