Git Product home page Git Product logo

moseq-compression's Introduction

moseq-compression

Helper functions to compress depth and infrared video acquired using the Datta Lab MoSeq platform.

How to install

Make sure you have a version of ffmpeg installed that supports the libx265 codec. Recent versions of ffmpeg should support this codec, but you can check by running ffmpeg -hide_banner -codecs | grep libx265 in the terminal and looking for any output containing libx265.

Activate the conda environment you choose to install this script in.

Then pip install it: pip install git+https://github.com/wingillis/[email protected]

Change v0.1.1 to the version you want to install. The current version as of 2024-04-14 is v0.1.3.

To upgrade, run the following command with the new version number. For example: pip install -U git+https://github.com/wingillis/[email protected]

How to use

After installation, you can use the moseq-compress command in the terminal to select a MoSeq recording folder and compress the depth and infrared (if present) videos within.

Depth videos (depth.avi) can be compressed into .mp4 files without the requirement of extraction.

However, folders must be extracted first using moseq2-extract before using the --crop flag to further reduce file size.

There are two main ways to use this tool:

  1. Interactive mode: Run moseq-compress in the terminal and use the user interface to select a recording folder. The script will look inside to find the depth and infrared videos and compress them. This mode is useful for

  2. Batch mode: Run moseq-compress --path /path/to/recording/folder in the terminal to skip the user interface section and compress the depth and infrared videos within the specified folder. This mode is useful for automated scripts or pipelines.

Behavior

The script will look for depth and infrared videos in the specified folder. If it does not find a depth video with the name depth.avi, it will throw an error and stop. However, if it does not find an infrared video with the name ir.avi, it will continue, but print a warning that the infrared video was not found. Then, it will compress them using the ffmpeg library and save the compressed videos in the same folder. The original videos will not be deleted.

It will create two versions of the depth videos. The first, depth_cropped.avi, removes the extra surrounding pixels that are not part of the MoSeq arena. It is saved with a lossless compression, so has the original raw depth values. The second, depth_cropped.mp4, is a lossy compressed version of the first video. This version is much smaller, so is useful for data storage constraints, but is in the alpha stage at the moment and is not supported by moseq2-extract. Therefore, if you can keep the depth_cropped.avi file, it is recommended to do so.

If the infrared video is found, it will be lossy compressed and saved as ir.mp4. Since the infrared video is not used by moseq2-extract, it is safe to delete the original ir.avi file after compression. The ir.mp4 file has enough fidelity to be used effectively for keypoint tracking.

moseq-compression's People

Contributors

wingillis avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.