Split videos around time points.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file videocutter-2024.12.17.tar.gz.
File metadata
- Download URL: videocutter-2024.12.17.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d74e9890513485f4f0c8d68d1d68484515bc75259b8b8063c245b4cc8d7a3d1
|
|
| MD5 |
a04f905246f0efece34981437ab515ea
|
|
| BLAKE2b-256 |
710f259b6ff71572e878433783560972230c8e101a44427fd66659379b3fdb58
|
File details
Details for the file videocutter-2024.12.17-py3-none-any.whl.
File metadata
- Download URL: videocutter-2024.12.17-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3cd303312af7423ba803019f69c62b18eda0db0cdec7cd80e947a6b5d2ea827
|
|
| MD5 |
702665dcd8037b87238072e965f33b63
|
|
| BLAKE2b-256 |
15a92f4c5c93e122d7a854917ddb9e52570a1cbcc5757fa0c8069b7bd51bf653
|