videocutter
This script (/scripts/video_cutter.py) is used to cut long recordings containing multiple stimulations into single-stimulation clips.
It uses the video file and a corresponding stimulation trace stored as a text (Labscribe) or binary file (Bonsai)
The script processes all videos found in the input directory that have a txt/csv/bin file with the same name. The latter is read to determine the stimulation onsets. Extracted clips are created in {video-name}-cropped subfolder and are numbered from 0 to the number of stimulations found in the stimulation file.
The stimulation trace files can either be :
- A text/CSV file with two columns, the first one being the time and the second the voltage.
- A binary file saved with Bonsai, with three columns, the first one being the time steps, the second one being the blue laser voltage and the third one the orange laser voltage.
Install
Within a virtual environment with Python 3.12, install with pip from the terminal :
pip install videocutter
Usage
As a command line interface (CLI)
From a terminal within the virtual environment in which you installed videocutter, you can check the default values with :
videocutter --help
Then, use it like so :
- With text files, with all default values
videocutter /path/to/your/videos
- With Bonsai files, extract blue laser and use all default values
videocutter /path/to/your/videos blue
- With text files, changing the time before and after onset :
videocutter /path/to/your/videos --time-before 1 --time-after 2
- With binary files, extract another laser color and change video files extension :
videocutter /path/to/your/videos orange --video-ext avi
From a Python script
Copy the example from examples/cut_videos.py, fill in the parameters and run the script.
Notes
- The format of txt files exported from Labscribe depends on its version... Sometimes the values are separated by commas (
,), sometimes tabulations. To be sure, open the file with a text editor and see if there are "," or big spaces between values on a row. Edit theSEPparameter accordingly in the example script or with the--separgument in the CLI. - Again with Labscribe, it's unclear when or which versions creates a header to this text file (names for each columns). The two should work : if there are non-numeric values on the first line of the file, it will be considered as a header and discarded.
- If the stimulation trace was edited in Labscribe (for example, if you annotated the traces), the exported file might contain a third column and it will most likely not work.
Credits
videocutter has been primarly developed by Guillaume Le Goc in Julien Bouvier's lab at NeuroPSI, with Edwin Gatier's algorithm for trial detection.
Metadata
Release files for videocutter 2024.12.17.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| videocutter-2024.12.17.1.tar.gz | 10.5 kB | With provenance | Details for videocutter-2024.12.17.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| videocutter-2024.12.17.1-py3-none-any.whl | Python 3 | none | any | Details for videocutter-2024.12.17.1-py3-none-any.whl |
Total release size: 19.2 kB
Release files / videocutter-2024.12.17.1.tar.gz
| Download URL | videocutter-2024.12.17.1.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a7f2b02814a52c3f250216ac62ede14a73642a6bf0fd637083429e8ed79196f9
|
|
BLAKE2b-256 checksum How to use checksums |
8769ba859db015310d67e812034753ab497a0248825fdc4dc96bf3068de050e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 17, 2024.
Transparency logRelease files / videocutter-2024.12.17.1-py3-none-any.whl
| Download URL | videocutter-2024.12.17.1-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7a7f716c7aabac3513d670ee0a022c97f42627ae1495ecd42f63888f397a0016
|
|
BLAKE2b-256 checksum How to use checksums |
6a8408292efc6f0577299531d46a980625a854f1b5d7e3d706df546a738bd236
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 17, 2024.
Transparency logSecurity for videocutter 2024.12.17.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for videocutter-2024.12.17.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 17, 2024.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.