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 - npm Package Compare versions

Comparing version
1.2.0
to
1.2.1
+39
-1
dist/index.js
#!/usr/bin/env node
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const commander_1 = require("commander");
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const merge_videos_1 = require("./commands/merge-videos");

@@ -9,2 +44,5 @@ const trim_silence_1 = require("./commands/trim-silence");

const remove_silence_of_videos_1 = require("./commands/remove-silence-of-videos");
// Read version from package.json
const packageJsonPath = path.resolve(__dirname, "../package.json");
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
const program = new commander_1.Command();

@@ -14,3 +52,3 @@ program

.description("Video Editor CLI utilities")
.version("1.0.0");
.version(packageJson.version);
(0, merge_videos_1.registerMergeVideosCommand)(program);

@@ -17,0 +55,0 @@ (0, trim_silence_1.registerTrimSilenceCommand)(program);

+1
-1
{
"name": "@codedimension/video-editor",
"version": "1.2.0",
"version": "1.2.1",
"description": "Video Editor CLI merges .mkv files to a single .mp4 file",

@@ -5,0 +5,0 @@ "files": [

+79
-79
# Video Editor CLI
Uma poderosa ferramenta de linha de comando (CLI) em Node.js para tarefas automatizadas de edição de vídeo, focada principalmente em arquivos `.mkv`. Ela otimiza fluxos de trabalho comuns como remoção de silêncio, mesclagem em lote e processamento de cursos com saída de alta qualidade.
A powerful Node.js command-line interface (CLI) tool for automated video editing tasks, primarily focused on `.mkv` files. It optimizes common workflows such as silence removal, batch merging, and course processing with high-quality output.
## Principais Recursos
## Key Features
- **Remoção Automática de Silêncio**: Detecta e remove silêncio (início, fim ou meio) usando filtros do FFmpeg.
- **Ordenação Natural**: Ordena arquivos de forma inteligente por número (ex: `parte2.mkv` vem antes de `parte10.mkv`).
- **Saída de Alta Qualidade**: A codificação padrão usa `libx264` com `CRF 18` e preset `slow` para resultados visualmente sem perdas.
- **Processamento em Lote**: Orquestra estruturas complexas de pastas para cursos ou grandes coleções.
- **Automatic Silence Removal**: Detects and removes silence (start, end, or middle) using FFmpeg filters.
- **Natural Sorting**: Intelligently sorts files numerically (e.g., `part2.mkv` comes before `part10.mkv`).
- **High-Quality Output**: Default encoding uses `libx264` with `CRF 18` and `slow` preset for visually lossless results.
- **Batch Processing**: Orchestrates complex folder structures for courses or large collections.
## Pré-requisitos
## Prerequisites
Esta ferramenta depende do [FFmpeg](https://ffmpeg.org/). Você deve ter o FFmpeg instalado e disponível no PATH do seu sistema.
This tool depends on [FFmpeg](https://ffmpeg.org/). You must have FFmpeg installed and available in your system's PATH.
- **Ubuntu/Debian**: `sudo apt install ffmpeg`
- **macOS**: `brew install ffmpeg`
- **Windows**: Baixe do site oficial ou use `winget install ffmpeg`
- **Windows**: Download from the official website or use `winget install ffmpeg`
## Instalação Global (Recomendado)
## Global Installation (Recommended)
Para instalar e usar o `video-editor` de qualquer lugar no seu terminal sem precisar baixar o código fonte:
To install and use `video-editor` from anywhere in your terminal without downloading the source code:

@@ -28,19 +28,19 @@ ```bash

Após a instalação, você pode rodar o comando `video-editor` diretamente.
After installation, you can run the `video-editor` command directly.
## Instalação para Desenvolvimento
## Development Installation
Se você deseja rodar a CLI a partir do código fonte:
If you want to run the CLI from source code:
```bash
# Instalar dependências
# Install dependencies
npm install
# Build do projeto
# Build the project
npm run build
```
Para usar o comando `video-editor` localmente durante o desenvolvimento:
To use the `video-editor` command locally during development:
1. Faça o build da versão mais recente:
1. Build the latest version:
```bash

@@ -50,3 +50,3 @@ npm run build

2. Vincule o pacote globalmente:
2. Link the package globally:
```bash

@@ -56,28 +56,28 @@ npm link

As alterações no código fonte serão refletidas após cada `npm run build`.
Source code changes will be reflected after each `npm run build`.
## Comandos
## Commands
### 1. Remover Silêncio de Vídeos (`remove-silence-of-videos` ou `rsov`)
### 1. Remove Silence from Videos (`remove-silence-of-videos` or `rsov`)
O comando de corte mais avançado. Ele remove **todas** as seções de silêncio de um lote de vídeos, incluindo silêncio no meio de uma gravação.
The most advanced trimming command. It removes **all** silence sections from a batch of videos, including silence in the middle of a recording.
**Argumentos:**
**Arguments:**
- `[directory]`: O diretório contendo arquivos `.mkv` (O padrão é o diretório atual).
- `[directory]`: The directory containing `.mkv` files (Defaults to the current directory).
**Opções:**
**Options:**
- `--start <number>`: Tempo de início manual em segundos (substitui a detecção de silêncio).
- `--end <number>`: Tempo de fim manual em segundos (substitui a detecção de silêncio).
- `--start <number>`: Manual start time in seconds (overrides silence detection).
- `--end <number>`: Manual end time in seconds (overrides silence detection).
**Recursos:**
**Features:**
- Remove **silêncio no meio** por padrão.
- Ignora automaticamente arquivos que contenham `[skip]` no nome.
- Exporta os arquivos processados para uma subpasta `trimmed-videos` como `.mp4`.
- Removes **middle silence** by default.
- Automatically skips files containing `[skip]` in their name.
- Exports processed files to a `trimmed-videos` subfolder as `.mp4`.
**Exemplo:**
**Example:**
```bash
video-editor rsov ./gravacoes_brutas --start 5 --end 120
video-editor rsov ./raw_recordings --start 5 --end 120
```

@@ -87,14 +87,14 @@

### 2. Cortar Silêncio (`trim-silence`)
### 2. Trim Silence (`trim-silence`)
Uma versão mais simples que foca em remover o silêncio apenas do **início e do fim** dos arquivos.
A simpler version that focuses on removing silence only from the **start and end** of files.
**Opções:**
**Options:**
- `--input <path>`: O caminho para um único arquivo `.mkv` ou um diretório. (Obrigatório)
- `--output <path>`: O caminho onde o(s) arquivo(s) cortado(s) deve(m) ser salvo(s). (Obrigatório)
- `--input <path>`: The path to a single `.mkv` file or a directory. (Required)
- `--output <path>`: The path where the trimmed file(s) should be saved. (Required)
**Exemplo:**
**Example:**
```bash
video-editor trim-silence --input gravacao.mkv --output ./cortados/
video-editor trim-silence --input recording.mkv --output ./trimmed/
```

@@ -104,20 +104,20 @@

### 3. Mesclar Vídeos (`merge-videos`)
### 3. Merge Videos (`merge-videos`)
Mescla múltiplos arquivos `.mkv` em um único arquivo `.mp4` de alta qualidade.
Merges multiple `.mkv` files into a single high-quality `.mp4` file.
**Opções:**
**Options:**
- `--videosDir <path>`: O diretório contendo os arquivos de vídeo `.mkv`. (Obrigatório)
- `--outputFile <path>`: O caminho exato e nome do arquivo para o `.mp4` resultante. (Obrigatório)
- `--videosDir <path>`: The directory containing the `.mkv` video files. (Required)
- `--outputFile <path>`: The exact path and filename for the resulting `.mp4`. (Required)
**Recursos:**
**Features:**
- **Corte Automático**: Detecta e remove silêncio nas extremidades de cada clipe antes de mesclar.
- **Ordem Natural**: Mescla os arquivos em ordem numérica/natural.
- **Alta Qualidade**: Usa `CRF 18` e preset `slow` para a exportação final.
- **Automatic Trimming**: Detects and removes silence at the ends of each clip before merging.
- **Natural Order**: Merges files in numerical/natural order.
- **High Quality**: Uses `CRF 18` and `slow` preset for the final export.
**Exemplo:**
**Example:**
```bash
video-editor merge-videos --videosDir ./partes/ --outputFile final.mp4
video-editor merge-videos --videosDir ./parts/ --outputFile final.mp4
```

@@ -127,50 +127,50 @@

### 4. Processar Curso (`process-course`)
### 4. Process Course (`process-course`)
Orquestra um fluxo completo de edição de curso através de uma estrutura de diretórios definida.
Orchestrates a complete course editing workflow through a defined directory structure.
**Estrutura de Entrada:**
**Input Structure:**
```
/MeuCurso
/MyCourse
/nao-editado
/Modulo-1
/Aula-A
/Module-1
/Lesson-A
- 1_intro.mkv
- 2_demo.mkv
- materiais.pdf
- materials.pdf
```
**Estrutura de Saída (pasta `/editado`):**
**Output Structure (`/editado` folder):**
```
/MeuCurso
/MyCourse
/editado
/Modulo-1
/Aula-A
- Aula-A.mp4 (Mesclado e cortado)
- materiais.pdf (Copiado automaticamente)
/Module-1
/Lesson-A
- Lesson-A.mp4 (Merged and trimmed)
- materials.pdf (Automatically copied)
```
**Opções:**
**Options:**
- `<coursePath>`: Caminho para a pasta raiz do curso. (Obrigatório)
- `--skip-existing`: Pula aulas que já possuem um arquivo `.mp4` de saída.
- `<coursePath>`: Path to the course root folder. (Required)
- `--skip-existing`: Skips lessons that already have an output `.mp4` file.
**Exemplo:**
**Example:**
```bash
video-editor process-course /caminho/para/MeuCurso --skip-existing
video-editor process-course /path/to/MyCourse --skip-existing
```
## Detalhes Técnicos
## Technical Details
- **Detecção de Silêncio**: Limite definido em `-30dB` por pelo menos `0.5s`.
- **Configurações de Codificação**:
- Vídeo: `libx264`, `pix_fmt yuv420p`
- Áudio: `aac`
- Qualidade: `CRF 18`, Preset: `slow` (otimizado para alta qualidade e tamanho de arquivo razoável).
- **Silence Detection**: Threshold set at `-30dB` for at least `0.5s`.
- **Encoding Settings**:
- Video: `libx264`, `pix_fmt yuv420p`
- Audio: `aac`
- Quality: `CRF 18`, Preset: `slow` (optimized for high quality and reasonable file size).
## Solução de Problemas
## Troubleshooting
- **FFmpeg não encontrado**: Certifique-se de que o comando `ffmpeg -version` funciona no seu terminal.
- **Nenhum silêncio detectado**: Se o ruído de fundo for superior a -30dB, a ferramenta pode não detectar o silêncio corretamente.
- **FFmpeg not found**: Make sure the `ffmpeg -version` command works in your terminal.
- **No silence detected**: If the background noise is higher than -30dB, the tool might not detect silence correctly.