npm package: @srtkit/cli
Description: Command line interface for SRTKit - utilities for processing SRT subtitle files
Author: Max Chang
Latest version: 0.2.0


<h1 align="center">🛠️ <code>@srtkit/cli</code> </h1>

<p align="center">CLI for SRT Kit — utilities for processing SRT (SubRip) subtitle files.</p>

<pre align="center">
    pnpx @srtkit/cli
</pre>


<!-- automd:badges color="yellow" license name="@srtkit/cli" bundlephobia -->

[![npm version](https://img.shields.io/npm/v/@srtkit/cli?color=yellow)](https://npmjs.com/package/@srtkit/cli)
[![npm downloads](https://img.shields.io/npm/dm/@srtkit/cli?color=yellow)](https://npm.chart.dev/@srtkit/cli)
[![bundle size](https://img.shields.io/bundlephobia/minzip/@srtkit/cli?color=yellow)](https://bundlephobia.com/package/@srtkit/cli)
[![license](https://img.shields.io/github/license/maxchang3/srtkit?color=yellow)](https://github.com/maxchang3/srtkit/blob/main/LICENSE)

<!-- /automd -->

## Usage

<!-- automd:pm-x name="@srtkit/cli" -->

```sh
# npm
npx @srtkit/cli

# pnpm
pnpm dlx @srtkit/cli

# bun
bunx @srtkit/cli

# deno
deno run -A npm:@srtkit/cli
```

<!-- /automd -->

<!-- automd:cliCommands bin="./bin/srtkit.mjs" -->

## Commands

### `srtkit clean`

```sh
srtkit clean [-o,--output #0] <input>
```

Clean and process SRT subtitle files

This command processes SRT files to clean and normalize them. It can remove SDH 
cues, speaker labels, music cues, and more.

If no output file is specified, the cleaned file will be saved with "_cleaned" 
suffix. Use --overwrite to replace the original file.

**Examples**

- Clean with auto-generated output
    ```sh
    srtkit clean input.srt
    ```

- Clean and overwrite original
    ```sh
    srtkit clean input.srt --overwrite
    ```

- Clean with custom output
    ```sh
    srtkit clean input.srt -o output.srt
    ```

- Remove SDH and speaker labels
    ```sh
    srtkit clean input.srt -o output.srt --remove-sdh --remove-speaker-labels
    ```

**Options**

- `--overwrite` — Overwrite the original file Required: No

- `--remove-sdh` — Remove Subtitles for the Deaf and Hard of Hearing (SDH) cues Required: No

- `--remove-speaker-labels` — Remove speaker identification labels Required: No

- `--remove-music-cues` — Remove cues containing music notes (♪) Required: No

- `--remove-line-breaks` — Remove all line breaks within cues Required: No

- `--merge-same-text` — Merge consecutive cues with identical text Required: No

- `--remove-trailing-period` — Remove trailing period (`。` or `.`) at the end of cues Required: No

- `--normalize-text-case` — Change fully UPPERCASE cues to normal case Required: No

---
### `srtkit merge`

```sh
srtkit merge [-o,--output #0] <firstFile> <secondFile>
```

Merge two subtitle files into a bilingual subtitle

This command merges two monolingual subtitle files into a single bilingual file. 
The text from both files will be combined with a newline separator.

If no output file is specified, the merged file will be saved in the same 
directory as the first file with an auto-generated name:

- If filenames are different: `<file1>+<file2>_merged.srt`

- If filenames are same: `<filename>_merged.srt`

**Examples**

- Merge with custom output
    ```sh
    srtkit merge english.srt chinese.srt -o bilingual.srt
    ```

- Merge with auto-generated output
    ```sh
    srtkit merge english.srt chinese.srt
    ```

**Options**

- `--mode` — Merge mode (currently only "simple" is supported) Required: No

---
### `srtkit split`

```sh
srtkit split <input> [outputA] [outputB]
```

Split a bilingual subtitle into two separate files

This command splits a bilingual subtitle file into two monolingual files. It can 
split by newlines or by even/odd index positions.

**Examples**

- Split by newlines
    ```sh
    srtkit split bilingual.srt -a first.srt -b second.srt
    ```

- Split by even/odd indices
    ```sh
    srtkit split bilingual.srt -a odd.srt -b even.srt --mode evenOdd
    ```

**Options**

- `--mode` — Split mode (newline | evenOdd) Required: No

<!-- /automd -->

## License

[MIT](./LICENSE) License © [maxchang3](https://github.com/maxchang3)

<!-- automd:with-automd -->

---

_🤖 auto updated with [automd](https://automd.unjs.io)_

<!-- /automd -->