{"id":50367626,"url":"https://github.com/lenik/picam","last_synced_at":"2026-05-30T05:02:09.714Z","repository":{"id":356874521,"uuid":"1234407594","full_name":"lenik/picam","owner":"lenik","description":"Raspberry Pi 5 (and compatible) CSI/MIPI camera preview, still capture, and timed H.264 recording using GStreamer (libcamera) and GTK 4 — a Cheese-like camview. Meson build and Debian packaging. AGPL-3.0-or-later.","archived":false,"fork":false,"pushed_at":"2026-05-10T06:52:47.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-10T08:39:48.181Z","etag":null,"topics":["csi-camera","debian","gstreamer","gtk4","libcamera","meson","raspberry-pi","raspberry-pi-5"],"latest_commit_sha":null,"homepage":"https://github.com/lenik/picam","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lenik.png","metadata":{"files":{"readme":"README-zh.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-10T06:24:54.000Z","updated_at":"2026-05-10T06:52:51.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lenik/picam","commit_stats":null,"previous_names":["lenik/picam"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/lenik/picam","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenik%2Fpicam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenik%2Fpicam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenik%2Fpicam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenik%2Fpicam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lenik","download_url":"https://codeload.github.com/lenik/picam/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenik%2Fpicam/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33680527,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["csi-camera","debian","gstreamer","gtk4","libcamera","meson","raspberry-pi","raspberry-pi-5"],"created_at":"2026-05-30T05:02:08.955Z","updated_at":"2026-05-30T05:02:09.709Z","avatar_url":"https://github.com/lenik.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# picam\n\n`picam` 是基于 Meson 的 Raspberry Pi **CSI / MIPI** 摄像头项目，提供 **`camview`** 工具：类似 GNOME **Cheese** 的实时预览、拍照与定时录像，技术栈为 **GStreamer**（`libcamerasrc`）与 **GTK 4**。\n\n仓库同时构建小型共享库 **`libpicam`**（`src/lib.c`）。\n\n## 功能（`camview`）\n\n- **预览**：图形窗口（`gtk4paintablesink`）。**P** 将当前画面存为 JPEG（默认在用户「图片」目录）；**Q** 退出。\n- **无头拍照**：`-s` / `--still`，支持 JPEG / PNG，可选分辨率与对焦等待时间。\n- **无头录像**：`-d` / `--duration`，H.264 封装为 **MP4**、**MOV** 或 **MKV**；在树莓派上优先使用硬件编码（`v4l2h264enc`，若可用）。\n- **双 CSI**：`-i` / `--device` 为 **从 1 开始的序号**（**2** 表示第二路摄像头）。通过 `rpicam-hello --list-cameras` 或 `libcamera-hello --list-cameras` 解析路径，也可用 `--camera-name` 直接指定 libcamera 设备 id。\n\n## 示例\n\n```bash\n# 实时预览（需要图形环境）\ncamview\n\n# 使用第二路摄像头预览\ncamview -i 2\n\n# 拍一张 JPEG，默认文件名 camview_YYYYMMDD_HHMMSS.jpg\ncamview -s\n\n# PNG、指定路径、1920x1080\ncamview -s -f png -o shot.png -r 1920x1080\n\n# 录制 15 秒 MP4\ncamview -d 15s -o clip.mp4\n\n# 极短 MOV 样片\ncamview -d 500ms -f mov -o short.mov\n```\n\n## 仓库结构\n\n| 路径 | 说明 |\n|------|------|\n| `src/camview*.c`, `src/camview*.h` | `camview` 命令行与 GStreamer 逻辑 |\n| `src/lib.c` | 共享库 `libpicam` |\n| `tests/*_test.c` | 基于 Check 的测试（如 `duration_test`、`lib_test`） |\n| `debian/` | Debian 打包 |\n| `po/` | gettext 翻译 |\n| `meson.build` | 构建定义 |\n\n## 构建依赖\n\n在 Debian / Raspberry Pi OS 上典型依赖：\n\n```bash\nsudo apt install meson ninja-build pkg-config gcc \\\n  libbas-c-dev \\\n  libglib2.0-dev libgtk-4-dev \\\n  libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev \\\n  check\n```\n\n运行时已安装的二进制需要：GStreamer **libcamera** 插件、**GTK 4** 的 GStreamer 插件（`gstreamer1.0-gtk4`）、good/bad/base 插件、`libgtk-4-1` 等，详见 `debian/control`。枚举多路摄像头时建议安装 **`rpicam-hello`** 或 **`libcamera-hello`**（打包中为 `Recommends`）。\n\n## 配置与编译\n\n说明文档中可使用绝对构建目录 `/build`；任意可写目录均可：\n\n```bash\nmeson setup build\nninja -C build\n```\n\n## 测试\n\n```bash\nmeson test -C build\n```\n\n## 手册与补全\n\n- **手册**：由 `camview.1.in` 生成 `camview(1)`。\n- **Bash**：安装后位于 `share/bash-completion/completions/`；开发时可参考仓库内 `camview.bash`。\n\n## i18n（gettext）\n\n可翻译字符串在 `po/`，由 `POTFILES` 指定源文件；gettext 域名为 **`picam`**。\n\n从源码更新模板并把新增/变更的 `msgid` 合并进各语言 `*.po`：\n\n```bash\nninja -C build picam-pot picam-update-po\nninja -C build picam-gmo\n```\n\n随后在每种语言中填写 `msgstr`（或用 PO 编辑器）。可用 `msgfmt -c po/\u003c语言\u003e.po` 做校验。\n\n**说明：** 某些环境下的命令行工具 `poedit`（`poedit --help`）是 **TSV 批量写入工具**，不是 [Poedit](https://poedit.net/) 图形客户端，也不能代替 `msgmerge`；更新模板请用上面的 `ninja` 目标。\n\n```bash\nLANGUAGE=zh_CN ./build/camview -h\n```\n\n## 安装 / 符号链接\n\n```bash\nmeson install -C build\nninja -C build install-symlinks\nninja -C build uninstall-symlinks\n```\n\n## Debian 打包\n\n```bash\ndpkg-buildpackage -us -uc\n```\n\n## 故障排除\n\n- **`GST_DEBUG`**：例如 `GST_DEBUG=libcamera:4 camview -s -o test.jpg` 排查流水线。\n- **超时 / 无画面**：拍照会等待管道进入 `PLAYING`、对焦稳定，再最多等待 **30s** 取帧；请确认无其他进程占用摄像头。\n- **编码器**：非树莓派开发机上可能回退到 **x264enc** / **openh264enc**。\n\n## 许可证\n\nCopyright (C) 2026 Lenik \u003cpicam@bodz.net\u003e\n\n采用 **AGPL-3.0-or-later**。本项目明确反对 AI 剥削与 AI 霸权，反对无脑 MIT 式许可证和政治上幼稚的 BSD 式许可证。完整文本及补充条款见 `LICENSE`。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flenik%2Fpicam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flenik%2Fpicam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flenik%2Fpicam/lists"}