{"id":20047027,"url":"https://github.com/bartste/snapshot","last_synced_at":"2026-04-14T03:32:23.758Z","repository":{"id":178002873,"uuid":"661232210","full_name":"BartSte/snapshot","owner":"BartSte","description":"Command line tool to find/display/record a video from a camera/stream/file. Ideal for creating displaying videos from the command line and creating a timelapse.","archived":false,"fork":false,"pushed_at":"2026-01-02T16:51:18.000Z","size":49434,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-29T05:32:59.071Z","etag":null,"topics":["boost","cmake","cplusplus","cpp","cxxopts","ffmpeg","git","ninja","qmediaplayer","qt6","spdlog"],"latest_commit_sha":null,"homepage":"","language":"C++","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/BartSte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2023-07-02T07:48:17.000Z","updated_at":"2025-12-20T20:07:18.000Z","dependencies_parsed_at":"2024-03-23T11:25:45.063Z","dependency_job_id":"0f582e1a-ba49-4b65-9122-9dff7ca708cb","html_url":"https://github.com/BartSte/snapshot","commit_stats":null,"previous_names":["bartste/snapshot"],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/BartSte/snapshot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BartSte%2Fsnapshot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BartSte%2Fsnapshot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BartSte%2Fsnapshot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BartSte%2Fsnapshot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BartSte","download_url":"https://codeload.github.com/BartSte/snapshot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BartSte%2Fsnapshot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31781292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T02:24:21.117Z","status":"ssl_error","status_checked_at":"2026-04-14T02:24:20.627Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["boost","cmake","cplusplus","cpp","cxxopts","ffmpeg","git","ninja","qmediaplayer","qt6","spdlog"],"created_at":"2024-11-13T11:33:04.590Z","updated_at":"2026-04-14T03:32:23.741Z","avatar_url":"https://github.com/BartSte.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Snapshot\n\n[![Tests](https://github.com/BartSte/snapshot/actions/workflows/tests.yml/badge.svg)](https://github.com/BartSte/snapshot/actions/workflows/tests.yml)  \n[![Release](https://github.com/BartSte/snapshot/actions/workflows/release.yml/badge.svg)](https://github.com/BartSte/snapshot/actions/workflows/release.yml)\n\n\u003c!--toc:start--\u003e\n\n- [Summary](#summary)\n  - [Features](#features)\n  - [Limitations](#limitations)\n- [Installation](#installation)\n  - [Stand-alone tarball](#stand-alone-tarball)\n  - [From source](#from-source)\n  - [Raspberry Pi OS](#raspberry-pi-os)\n- [Usage](#usage)\n  - [List the available cameras](#list-the-available-cameras)\n  - [Display a video](#display-a-video)\n  - [Record a video stream](#record-a-video-stream)\n  - [Using the configuration file](#using-the-configuration-file)\n  - [Set the logging level](#set-the-logging-level)\n- [Development](#development)\n  - [Test](#test)\n  - [Tarball](#tarball)\n  - [Debugging](#debugging)\n- [License](#license)\n- [Troubleshooting](#troubleshooting)\n- [Contributing](#contributing)\n- [FAQ](#faq)\n\u003c!--toc:end--\u003e\n\n## Summary\n\n`Snapshot` is an application that allows you to view a video and record it as a\nset of snapshots. This is useful when you want to make a time-lapse of a video.\nThe application has a graphical user interface to view the video and a command\nline interface to configure the application. It can also be configured using a\nconfiguration file. The project is written in C++ and uses\n[Qt6](https://www.qt.io/). For more information, run `snapshot --help`, or\ncontinue reading.\n\n### Features\n\nIn short, `snapshot` contains the following features:\n\n- [x] List the available cameras.\n- [x] Display a video stream:\n  - [x] using RTSP, UDP or HTTP.\n  - [x] from a file.\n  - [x] from a (built-in) camera.\n- [x] Record a video in a set of snapshots at a given interval and duration.\n- [x] Configure the application using a configuration file.\n- [x] Has a command line interface.\n- [ ] Runs on linux (including raspberry pi).\n\n### Limitations\n\n- 64 bit Linux systems only\n- glibc $\\geq$ 2.35 (when using the tarball)\n- X11, Wayland are supported. EGLFS is support is added, but not tested.\n- Tested on Ubuntu 22.04, Arch linux and Raspberry Pi OS (bullseye).\n\n## Installation\n\nThe following sections explain how to install the project. You have two\noptions: using the pre-built binaries. The easiest way is to use the pre-built\nbinaries, i.e., the stand-alone tarball.\n\n### Stand-alone tarball\n\n\u003e Requires that glibc $\\geq$ 2.35\n\nThis is the easiest way to install the application.\n\nGo to the [releases](https://github.com/BartSte/snapshot/releases) page and\ndownload the latest `tar.gz` file. Extract the file using the following\ncommand:\n\n```bash\ntar -xvf snapshot-\u003cversion\u003e-Linux.tar.gz\n```\n\nThis creates a `snapshot-\u003cversion\u003e` directory with the following structure:\n\n```bash\nsnapshot-\u003cversion\u003e\n  ├── runtime/\n  └── snapshot\n```\n\nthe `runtime` directory contains files you should not touch. The `snapshot`\nscript is the one that you should use to interact with the application. For\nexample:\n\n```bash\n./snapshot-\u003cversion\u003e/snapshot --help\n```\n\nwill print the help message. For convenience, you can place the\n`snapshot-\u003cversion\u003e` folder anywhere you like, and create a symlink to the\n`snapshot` script in a directory that is in your `PATH`. For example:\n\n```bash\nln -s /path/to/snapshot-\u003cversion\u003e/snapshot $HOME/bin/snapshot\n```\n\nhere it is assumed that the `$HOME/bin` directory is in your `PATH`.\n\nExtra information about the tarball is provided in [Development](#development).\n\n### From source\n\nIn this section, the steps to build the project from source are explained. In\nshort:\n\n- You can use the `setup` script to install the dependencies.\n- A static or shared Qt build can be selected.\n- A Qt account is needed in order to use the `setup` script.\n- Using the `configure` script, the build can be configured.\n\n#### Dependencies\n\nSnapshot relies on the following dependencies:\n\n| Dependency                                           | Version     |\n| ---------------------------------------------------- | ----------- |\n| [Qt6](https://www.qt.io/download): base \u0026 multimedia | 6.6         |\n| [ffmpeg](https://ffmpeg.org/)                        | 6.0, 6.1    |\n| [boost](https://www.boost.org/)                      | $\\geq$ 1.74 |\n| [spdlog](https://github.com/gabime/spdlog)           | $\\geq$ 1.9  |\n\nHere, the Qt6 version is fixed. Other versions of ffmpeg, boost, and spdlog\nmight work, but are not tested.\n\nFor building the project, the following dependencies are required:\n\n- [git](https://git-scm.com/)\n- [CMake](https://cmake.org/download/)\n- [Ninja](https://ninja-build.org/)\n\nBuilding the project was tested using $\\text{clang}\\geq 14$ and $\\text{gcc}\\geq\n11$\n\n`cxxopts` and `googletest` are also dependencies, but they are included in the\nproject. The former as a header file in the `3rdparty` directory, and the latter\nis installed using `cmake`.\n\n#### Installing dependencies\n\n\u003e The `setup` script only supports Arch Linux and Ubuntu 22.04. If you are\n\u003e using a different distribution, you need to install the dependencies\n\u003e yourself.\n\nThe following sections explain how to set up the environment for building the\nproject. Since you need a specific version of Qt6, it is recommended to use the\nonline installer of Qt which is included in this project.\n\n\u003e Using the local installer is recommended as it installs the correct version\n\u003e in a subdirectory of the project. This way, the system Qt version is not\n\u003e affected.\n\nDo the following:\n\n- Clone the project:\n\n  ```bash\n  git clone https://github.com/BartSte/snapshot\n  ```\n\n  and `cd` into root directly the project (containing the `.git` directory).\n\n- Register a Qt account on the [website of Qt](https://www.qt.io).\n\n- Run the `login-qt` script with your credentials:\n\n  ```bash\n  ./scripts/login-qt --pw \u003cpassword\u003e --email \u003cemail\u003e\n  ```\n\n  This creates a `qtaccount.ini` file at `~/.local/share/Qt` which is used when\n  downloading Qt.\n\n- Run the `setup` script to install the dependencies:\n\n  ```bash\n  ./scripts/setup\n  ```\n\n  You can pass the `--static` (default) or `--shared` option to the script, to\n  build Qt as a static or shared library. The `--static` option results in a\n  longer build time, when compared do `--shared`, as Qt and ffmpeg are built\n  from source. The `--shared` option results in a less build time as pre built\n  Qt and ffmpeg libraries are used. However, the `--shared` option results in\n  more libraries (\\*.so files) that need to be installed on your system.\n\n  Once, the script is done, you can find the Qt libraries in the `3rdparty/Qt`\n  directory (ffmpeg is included). If you choose the `--shared` option, you can\n  also find the ffmpeg libraries in the `3rdparty/ffmpeg` directory.\n\n#### Configure the build\n\nEnsure that the root of the project is your current work directory. Run the\n`configure` script to configure the build:\n\n```bash\n./scripts/configure\n```\n\nThis script creates a `build` directory containing the ninja build files. You\ncan pass `-- -DDBUILD_TESTING=ON` to the script to enable the tests. Here, all\narguments after the `--` are passed to `cmake` directly.\n\n#### Build\n\nBuild the project by running the following command:\n\n```bash\ncmake --build ./build\n```\n\nThis creates the `snapshot` executable in the `build/bin` directory.\n\n#### Install\n\nInstall the project by running the following command:\n\n```bash\nsudo cmake --install ./build\n```\n\nThis will install the project in the `/opt/snapshot` directory. The `/opt`\ndirectory is chosen as `snapshot` is a self-contained application. The installed\nfiles tree is as follows:\n\n```bash\n/opt/snapshot\n ├── runtime/\n │   └── libs, bins, and qt plugins\n └── snapshot\n```\n\nWhere `snapshot` is the entry point of the application. If you want to add the\n`snapshot` executable to your `PATH`, you can create a symlink to\n`/usr/local/bin`:\n\n```bash\nsudo ln -s /opt/snapshot/snapshot /usr/local/bin/snapshot\n```\n\nOr you can add the `/opt/snapshot` directory to your `PATH`.\n\nIf you have no root access, you can install the project in you home directory by\nusing the `--prefix` option. For example, if you want to install the project in\nthe `$HOME/opt/snapshot` directory, you can run the following:\n\n```bash\ncmake --install ./build --prefix $HOME/opt/snapshot\n```\n\nThis will install the project in the `$HOME/opt/snapshot` directory, instead of\nthe `/opt/snapshot` directory.\n\n### Raspberry Pi OS\n\n- **TODO**\n\n## Usage\n\nThe `snapshot` executable should be executed from the command line. The\nfollowing sections explain how to use the application. You can also run\n`snapshot --help` to get more information.\n\n### List the available cameras\n\nBy running the following command, a list of available cameras is shown:\n\n```bash\nsnapshot --list\n```\n\nthis outputs something like:\n\n```bash\nIndex | Name                    | ID          | Is Default |\n0     | HP TrueVision HD Camera | /dev/video0 | true       |\n```\n\nwhich means that there is one camera available, with index `0`, name `HP\nTrueVision HD Camera`, id `/dev/video0` and is the default camera.\n\n### Display a video\n\nIf we want to display a video stream from the default camera, we can run the\nfollowing command:\n\n```bash\nsnapshot --gui\n```\n\nIf a camera is found, it will opens a window with the video stream from the\ndefault camera. You can also specify the camera to use. By doing:\n\n```bash\nsnapshot --gui --camera \"HP TrueVision HD Camera\"\n```\n\nThis will display the video stream from the camera with the name that matches\nthe name given by the `--list` command in the previous section.\n\nIf we want to display a video stream from a file, we can run the following:\n\n```bash\nsnapshot --gui --camera sample.mp4\n```\n\nIf we want to display a video stream from a URL `rtsp://localhost:8090/stream`,\nwe can run the following:\n\n```bash\nsnapshot --gui --camera rtsp://localhost:8090/stream\n```\n\nNote that we can feed the `--camera` option with a file, a URL or a camera\nname. Lastly, the `--timeout` option can be used to specify how long the app\nshould be searching for a video at startup, or when the connection is lost. By\ndefault, this is set to `30s`.\n\n### Record a video stream\n\nWhen you want to record snapshots from a video stream, you can use the\n`--record` option. For example, if we want to record a video stream from the\ndefault camera, we can run the following command:\n\n```bash\nsnapshot --record\n```\n\nThis will save snapshots of the default camera with the default values for the\n`--interval`, `--duration` and `--folder` options, i.e., every second for 10\nseconds, for an unlimited time, in the `./snapshot` folder. Most likely, you\nwant to change these values. For example:\n\n```bash\nsnapshot --record --interval 5 --duration 60 --folder /path/to/folder\n```\n\nthis will save snapshots every 5 seconds for 60 seconds in the `/path/to/folder`\nfolder. If the folder does not exist, it will be created, as long as the parent\nfolder exists.\n\nTo ensure that the disk does not fill up the snapshots when you forget to stop\nthe recording, the `--max-snapshots` is set to `10e9` bytes (10 GB) by default,\nwhich means that the recording will stop when the current session exceeds this\nsize.\n\n### Using the configuration file\n\nInstead of using the command line options, a cnfiguration file can be used. By\ndefault, the application looks for a file called `config.json` in the\n`$HOME/.config/snapshot` directory. If no configuration file is found, the\napplication uses the default configuration which is equivalent to the default\nvalues of the command line interface (see `snapshot --help`).\n\nBelow an example of a configuration file is shown that has the default values:\n\n```json\n{\n  \"gui\": false,\n  \"list\": false,\n  \"record\": false,\n  \"camera\": \"default\",\n  \"folder\": \"./snapshot\",\n  \"timeout\": \"30s\",\n  \"duration\": \"0s\",\n  \"interval\": \"10s\",\n  \"max-bytes\": \"10e9\",\n  \"loglevel\": \"warning\",\n  \"pattern\": \"[%Y-%m-%d %H:%M:%S.%e] [%l] [%s:%# @ %!] %v\"\n}\n```\n\nNaturally, you can change the values to your liking. For example, by setting\nthe `gui` option to `true`, the application will open the gui by default. This\nis equivalent to running `snapshot --gui`. Note that the command line options\noverride the configuration file options when they are given.\n\nIf you want to put your configuration file in a different location, you can\nspecify the location using the `--config` option:\n\n```bash\nsnapshot --config \"$HOME/some/other/location/config.json\"\n```\n\nNote that the `~` character and environment variables are expanded. Environment\nvariables must be specified using the `${VAR}` or `$VAR` syntax.\n\n### Set the logging level\n\nBy default, the logging level is set to `warning`. If we want to set the\nlogging level to `debug`, we can run the following command:\n\n```bash\nsnapshot --log-level debug \u003cother options\u003e\n```\n\nThe following logging levels are available: `trace`, `debug`, `info`,\n`warning`, `error`, and `critical`.\n\n## Development\n\nIf you want to contribute to this project, you should start by reading\n[CONTRIBUTING](./CONTRIBUTING.md), and installing the project [from\nsource](#from-source). This section provides information about: the tarball, the\nunit tests, and ways to debug the application.\n\n### Test\n\nGoogletest and QTest are used for building the unit tests and the end-to-end\ntests. To build the tests, the `BUILD_TESTING` option must be set to `ON` when\nconfiguring cmake:\n\n```bash\n./scripts/configure --build_type Debug -- -DBUILD_TESTING=ON\n```\n\nthis will use the `Debug` build type with the tests enabled. To run the tests,\nrun the following command:\n\n```bash\nctest --test-dir ./build\n```\n\n### Tarball\n\nAdditional information about the stand-alone tarball is provided here.\n\n- `snapshot` is an executable in the form of a bash script. This script:\n  - sets the `LD_LIBRARY_PATH` to the `lib` directory and runs the `snapshot`\n    binary.\n  - resolves the path to the script if it is referenced using a symlink.\n- the `runtime` directory contains shared libraries and binaries that the\n  `snapshot` script depends on. In case the project is built with the `--shared`\n  option, the `runtime` folder will also contain subdirectories with the\n  libraries of the Qt plugins. The `runtime` directory does not include the\n  standard `c/c++` libraries (`libc`, `libstdc++`, `libm`, `libdbm`,\n  `libpthread`) together with the dynamic linker as they are assumed to be\n  present on the system.\n- `snapshot_test` is an executable in the form of a bash script. This script is\n  only present when the project is built with the `cmake` option\n  `-DBUILD_TESTING=ON`. If so, when running the `snapshot_test` script, all\n  tests are executed.\n\n### Debugging\n\nYou can use one of the following ways to run the application with a video stream:\n\n#### Using a file\n\nA sample video file is provided in the `tests/static`. It can be played using\nthe following command:\n\n```bash\nsnapshot -g -c tests/static/sample.mp4\n```\n\nThis opens the gui and plays the `sample.mp4` file.\n\n#### Using an http stream\n\nIf you have internet access, you can use the following command to play a video\nfrom a public http stream:\n\n```bash\nsnapshot -g -c http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4\n```\n\nThis opens the gui and plays the video.\n\n#### Running the rtsp stream\n\nBy running the following command, a video stream is published using the rtsp\nprotocol:\n\n```bash\n./scripts/rtsp-stream tests/static/sample.mp4 rtsp://localhost:8090/stream\n```\n\nThis stream can be viewed using the following command:\n\n```bash\nsnapshot -g -c rtsp://localhost:8090/stream\n```\n\nThis displays the video stream using the GUI.\n\n#### Running the udp stream\n\nSimilar to [running the rtsp stream](#running-the-rtsp-stream), an udp stream\ncan be published using the following command:\n\n```bash\n./scripts/udp-stream tests/static/sample.mp4 udp://localhost:8090\n```\n\nThis stream can be viewed using the following command:\n\n```bash\nsnapshot -g -c udp://localhost:8090\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](./LICENSE)\nfile for details.\n\n## Troubleshooting\n\nIf you encounter any issues, please report them on the issue tracker at:\n[snapshot issues](https://github.com/BartSte/snapshot/issues)\n\n## Contributing\n\nContributions are welcome! Please see [CONTRIBUTING](./CONTRIBUTING.md) for\nmore information. Also, read the section on [Development](#development) for\nadditional information.\n\n## FAQ\n\n#### WSL2 fontconfig\n\nOn WSL2, if you encounter the following error:\n\n```bash\nFontconfig error: Cannot load default config file\n```\n\ninstall fontconfig on your system as is describe on the [website of Qt](https://doc.qt.io/qt-6/qt-embedded-fonts.html)\n\n#### Hardware acceleration\n\nIssues with your graphics card need to be resolved by the user itself, as this\napplication has no control over it. The following pages from the arch wiki are\nvery useful when you encounter issues with hardware acceleration:\n\n- [General](https://wiki.archlinux.org/title/Hardware_video_acceleration)\n- [Intel](https://wiki.archlinux.org/title/Intel_graphics)\n- [Nvidia](https://wiki.archlinux.org/title/NVIDIA)\n- [Nouveau](https://wiki.archlinux.org/title/Nouveau)\n- [AMD](https://wiki.archlinux.org/title/AMDGPU)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartste%2Fsnapshot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbartste%2Fsnapshot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartste%2Fsnapshot/lists"}