Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@codedimension/video-editor

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codedimension/video-editor

Video Editor CLI merges .mkv files to a single .mp4 file

npmnpm
Version
1.1.0
Version published
Weekly downloads
259
-21.52%
Maintainers
1
Weekly downloads
 
Created
Source

Video Editor CLI

A simple Node.js CLI tool for common video editing tasks, primarily focused on .mkv files.

This tool provides three main commands:

  • trim-silence: Detects and removes silence from the beginning and end of .mkv files.
  • merge-videos: Merges multiple .mkv files sequentially into a single .mp4 file.
  • process-course: Orchestrates the processing of an entire folder structure, merging videos per class and copying auxiliary files.

Prerequisites

This tool relies on FFmpeg. You must have FFmpeg installed and available in your system's PATH.

  • Ubuntu/Debian: sudo apt install ffmpeg
  • macOS: brew install ffmpeg
  • Windows: Download from the official website or use winget install ffmpeg

Installation

You can run the CLI directly if you are inside the project folder:

Install dependencies

npm install

Build the project

npm run build


## How to use locally

To use the `video-editor` command directly from any directory in your terminal (like a global system command), you need to link it using npm.

1. Ensure you have built the latest version of the code:
   ```bash
   npm run build
  • Link the package globally:
    npm link
    

Now you can open a new terminal anywhere on your computer and run commands directly, for example:

cd /my/course/directory
video-editor process-course ./MyCourse

Note: Whenever you modify the TypeScript source code, you only need to run npm run build again. Because the package is linked, the global video-editor command will automatically use the newly built files in the dist folder.

Usage

If you linked the package, you can run video-editor directly from any directory. Otherwise, run node dist/index.js or npx video-editor instead.

1. Trim Silence (trim-silence)

Automatically detects silence (below -30dB) at the start and end of your video recordings and trims it out. This is useful for removing the 1-2 seconds of dead air when starting or stopping a recording.

Options:

  • --input <path>: The path to a single .mkv file, or a directory containing multiple .mkv files. (Required)
  • --output <path>: The path where the trimmed file(s) should be saved. Can be a directory or a specific file name. (Required)

Examples:

Process a single file:

video-editor trim-silence --input my-recording.mkv --output ./trimmed-recording.mkv

Batch process an entire directory of .mkv files (saves them to a folder named trimmed_videos):

video-editor trim-silence --input ./raw_videos/ --output ./trimmed_videos/

2. Merge Videos (merge-videos)

Merges all .mkv files within a specified directory into a single .mp4 output file. The files are merged in alphabetical order. As part of this process, the command automatically detects and trims silence from the beginning and end of each .mkv file before merging them.

Options:

  • --videosDir <path>: The directory containing the .mkv files you want to merge. (Required)
  • --outputFile <path>: The exact path and filename for the resulting .mp4 file. (Required)

Example:

Merge all MKV files in the raw_clips directory into final_video.mp4:

video-editor merge-videos --videosDir ./raw_clips/ --outputFile ./final_video.mp4

3. Process Course (process-course)

Orchestrates the video editing workflow across a defined directory structure. It expects a course directory containing a nao-editado folder, which in turn contains a two-level structure: module/class. For each class, the tool merges all .mkv files into a .mp4 named after the class folder itself, and copies any auxiliary files (like .pdf or .txt) to an editado folder, preserving the structure.

Options:

  • <coursePath>: The path to the root course directory containing the nao-editado folder. (Required)
  • --skip-existing: Skip classes that already have a generated .mp4 file in the editado folder. Useful for resuming an interrupted process. (Optional)

Example Structure:

/MyCourse
  /nao-editado
    /Module-1
      /Class-A
        - video1.mkv
        - video2.mkv
        - notes.pdf

Output Structure:

/MyCourse
  /editado
    /Module-1
      /Class-A
        - Class-A.mp4
        - notes.pdf

Example:

Process a whole course:

video-editor process-course /path/to/MyCourse

Resume processing by skipping existing files:

video-editor process-course /path/to/MyCourse --skip-existing

Troubleshooting

  • FFmpeg not installed/found: Ensure ffmpeg is accessible from your terminal by running ffmpeg -version.
  • No silence detected: The trim-silence command looks for audio below -30dB lasting at least 0.5 seconds. If your background noise is louder than -30dB, it might not detect the start/end as "silence".

FAQs

Package last updated on 20 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts