An open API service indexing awesome lists of open source software.

https://github.com/hariharen9/ffmpeg-this

A powerful script for converting, manipulating, and inspecting media files within CLI 🖥️
https://github.com/hariharen9/ffmpeg-this

audio-converter batch-script converter ffmpeg media-manipulation video-converter windows

Last synced: 5 months ago
JSON representation

A powerful script for converting, manipulating, and inspecting media files within CLI 🖥️

Awesome Lists containing this project

README

          

FFmPEG-this



PyPI Version


Downloads


GitHub Stars


GitHub Forks


GitHub Issues


License




Supported Platforms


FFmpeg


OpenAI Whisper

Your Editor within CLI

A powerful and user-friendly Python CLI tool for converting, manipulating, and inspecting media files using the power of FFmpeg. This tool provides a simple command-line menu to perform common audio and video tasks without needing to memorize complex FFmpeg commands.



## Features at a Glance

| Category | Feature | Description |
|----------|---------|-------------|
| **Inspect** | Media Properties | View detailed codec, resolution, frame rate, bitrate, and stream information |
| **Convert** | Video Formats | Convert to MP4, MKV, MOV, AVI, WebM with quality presets (CRF 18/23/28) |
| | Audio Formats | Convert to MP3 (128k-320k bitrate), FLAC, WAV |
| | GIF Creation | Convert video clips to animated GIFs with optimized palette |
| | Image Formats | Convert between JPG, PNG, WebP, BMP, TIFF with quality control |
| | Compress Video | Target file size (e.g., 25MB for Discord) or CRF quality presets |
| | Change Resolution | Scale to 4K, 1080p, 720p, 480p, or custom resolution |
| **Subtitles** | AI Transcription | Generate subtitles using Whisper AI (7 model sizes available) |
| | Sidecar Export | Save as `.srt`, `.vtt`, `.txt`, or `.lrc` files |
| | Soft Subtitles | Embed toggleable subtitle track into video |
| | Hard Subtitles | Burn permanent subtitles directly into video |
| | Multi-language | Support for 99+ languages with auto-detection |
| **Edit** | Trim/Cut | Extract video segments by start/end time (lossless, no re-encoding) |
| | Visual Crop | Interactive GUI to select crop area on video/image |
| | Split Video | Divide video into equal parts or by duration |
| | Join/Concatenate | Merge multiple videos with automatic resolution matching |
| **Audio** | Extract Audio | Rip audio track to MP3, FLAC, or WAV |
| | Remove Audio | Create silent version of video (keeps video intact) |
| | Merge Audio | Replace or mix audio track with video |
| | Adjust Volume | Increase/decrease volume (presets, dB, multiplier) |
| | Audio Fade In/Out | Fade audio at start/end (6 curve types) |
| | Normalize Audio | EBU R128, Peak, RMS, or Dynamic normalization |
| **Effects** | Change Speed | Adjust playback speed (0.25x to 4x) with audio pitch preservation |
| | Reverse Video | Play video backwards (includes audio) |
| | Video Fade In/Out | Fade to/from black or white at start/end |
| | Loop Video | Repeat video N times or to target duration |
| | Color Correction | Brightness, contrast, saturation with presets |
| | Denoise Video | Reduce grain/noise (hqdn3d fast / nlmeans quality) |
| | Blur/Pixelate Region | Visual selection to blur or pixelate areas |
| | Auto Blur Faces (AI) | AI-powered automatic face detection and blur |
| | Add Watermark | Overlay image or text with custom positioning |
| | Picture-in-Picture | Overlay smaller video on main video |
| | Video Stabilization | Reduce camera shake (Light/Medium/Heavy) |
| | Extract Frames | Export single frame, every N seconds, or all frames as images |
| **Image** | Resize | Scale images with aspect ratio preservation |
| | Rotate | Rotate 90°, 180°, or 270° |
| | Flip | Flip horizontally or vertically |
| | Crop | Visual cropping with click-and-drag selection |
| **Other** | Create Slideshow | Create video from images with background music |
| | Metadata Editor | View, edit, clear, or copy video metadata |
| | Create GIF (Advanced) | Custom FPS, size, quality, loop options |
| **Batch** | Batch Convert | Convert all media files in directory at once |

Detailed Feature Breakdown

### Video Operations

| Operation | Input | Output | Method | Re-encoding |
|-----------|-------|--------|--------|-------------|
| **Convert** | Any video | MP4, MKV, MOV, AVI, WebM | FFmpeg transcode | Yes (CRF quality) |
| **Compress** | Any video | Same format | 2-pass encoding | Yes (target size/CRF) |
| **Change Resolution** | Any video | Same format | Scale filter | Yes |
| **Trim** | Any video | Same format | Stream copy | No (lossless) |
| **Crop** | Any video | Same format | Visual selection + crop filter | Yes |
| **Split** | Any video | Multiple segments | Stream copy or re-encode | Configurable |
| **Join** | Multiple videos | Single MP4 | Concat filter + normalize | Yes |
| **Change Speed** | Any video | Same format | setpts + atempo filters | Yes |
| **Reverse** | Any video | Same format | Reverse filter | Yes |
| **Video Fade** | Any video | Same format | fade filter | Yes |
| **Loop Video** | Any video | Same format | stream_loop | No (stream copy) |
| **Color Correction** | Any video | Same format | eq filter | Yes |
| **Denoise** | Any video | Same format | hqdn3d/nlmeans filter | Yes |
| **Blur/Pixelate** | Any video | Same format | Visual selection + boxblur/scale | Yes |
| **Auto Blur Faces** | Any video | Same format | MediaPipe AI + frame-by-frame | Yes |
| **Picture-in-Picture** | Two videos | Same format | overlay filter | Yes |
| **Stabilize** | Any video | Same format | vidstab (two-pass) | Yes |
| **Add Watermark** | Any video | Same format | Overlay filter | Yes |
| **Extract Frames** | Any video | PNG/JPG images | Frame extraction | N/A |
| **To GIF** | Any video | Animated GIF | 2-pass palette optimization | Yes |

### Audio Operations

| Operation | Input | Output | Notes |
|-----------|-------|--------|-------|
| **Extract** | Video with audio | MP3, FLAC, WAV | Preserves original quality for FLAC/WAV |
| **Remove** | Video with audio | Silent video | Stream copy (fast, no re-encoding) |
| **Merge** | Video + Audio file | Video with new audio | Replace or mix audio tracks |
| **Adjust Volume** | Video/Audio | Same format | Presets, multiplier, or dB value |
| **Audio Fade** | Video/Audio | Same format | 6 curve types (linear, log, exp, sine) |
| **Normalize** | Video/Audio | Same format | EBU R128, Peak, RMS, Dynamic |
| **Convert** | Audio file | MP3, FLAC, WAV | Bitrate selection for MP3 |

### Subtitle Generation

| Model | Size | Speed | Accuracy | Languages |
|-------|------|-------|----------|-----------|
| `tiny.en` | ~75 MB | Fastest | Good | English only |
| `base.en` | ~150 MB | Fast | Better | English only |
| `small.en` | ~500 MB | Balanced | Great | English only |
| `medium.en` | ~1.5 GB | Slower | Excellent | English only |
| `small` | ~500 MB | Balanced | Great | 99+ languages |
| `medium` | ~1.5 GB | Slower | Excellent | 99+ languages |
| `large-v3` | ~3 GB | Slowest | Best | 99+ languages |

**Output Options:**
| Type | File Extension | Description |
|------|----------------|-------------|
| Sidecar | `.srt` | SubRip - most compatible format |
| Sidecar | `.vtt` | WebVTT - for web/HTML5 players |
| Sidecar | `.txt` | Plain text transcript |
| Sidecar | `.lrc` | Lyrics format with timestamps |
| Soft Subs | `.mp4/.mkv` | Embedded, toggleable in players |
| Hard Subs | `.mp4/.mkv` | Burned in, always visible |

### Image Operations

| Operation | Options | Notes |
|-----------|---------|-------|
| **Convert** | JPG, PNG, WebP, BMP, TIFF | Quality presets (95%, 80%, 60%) |
| **Resize** | Custom width/height | Use `-1` to preserve aspect ratio |
| **Rotate** | 90° CW, 90° CCW, 180° | Lossless rotation |
| **Flip** | Horizontal, Vertical | Mirror image |
| **Crop** | Visual selection | Interactive GUI with preview |

### Supported Formats

| Type | Supported Formats |
|------|-------------------|
| **Video Input** | `.mp4`, `.mkv`, `.avi`, `.mov`, `.webm`, `.flv`, `.wmv`, `.gif` |
| **Video Output** | `.mp4`, `.mkv`, `.mov`, `.avi`, `.webm`, `.gif` |
| **Audio Input** | `.mp3`, `.flac`, `.wav`, `.ogg`, `.aac`, `.m4a` |
| **Audio Output** | `.mp3`, `.flac`, `.wav` |
| **Image Input** | `.jpg`, `.jpeg`, `.png`, `.webp`, `.bmp`, `.tiff` |
| **Image Output** | `.jpg`, `.png`, `.webp`, `.bmp`, `.tiff` |
| **Subtitle Output** | `.srt`, `.vtt`, `.txt`, `.lrc` |

## Usage

### Prerequisite: Install FFmpeg

> [NOTE]
> `peg_this` uses a library called `ffmpeg-python` which acts as a controller for the main FFmpeg program. It does not include FFmpeg itself. Therefore, you must have FFmpeg installed on your system and available in your terminal's PATH.

For **macOS** users, the easiest way to install it is with [Homebrew](https://brew.sh/):
```bash
brew install ffmpeg
```

For **Windows** users, you can use a package manager like [Chocolatey](https://chocolatey.org/) or [Scoop](https://scoop.sh/):
```bash
# Using Chocolatey
choco install ffmpeg

# Using Scoop
scoop install ffmpeg
```

For other systems, please see the official download page: **[ffmpeg.org/download.html](https://ffmpeg.org/download.html)**

There are three ways to use `peg_this`:

### 1. Pip Install (Recommended)
This is the easiest way to get started. This will install the tool and all its dependencies.

```bash
pip install peg_this
```

Once installed, you can run the tool from your terminal:

```bash
peg_this
```

### 2. Download from Release
If you prefer not to install the package, you can download a pre-built executable from the [Releases](https://github.com/hariharen9/ffmpeg-this/releases/latest) page.

1. Download the executable for your operating system (Windows, macOS, or Linux).
2. Place it in a directory with your media files.
3. Run the executable directly from your terminal.

### 3. Run from Source
If you want to run the tool directly from the source code:

1. **Clone the repository:**
```bash
git clone https://github.com/hariharen9/ffmpeg-this.git
cd ffmpeg-this
```
2. **Install dependencies:**
```bash
pip install -r requirements.txt
```
3. **Run the tool:**
```bash
python -m src.peg_this.peg_this
```

## Subtitle Generation

The subtitle feature uses [faster-whisper](https://github.com/SYSTRAN/faster-whisper), a fast and accurate speech-to-text engine powered by OpenAI's Whisper model.

### How it works

1. Select a video file
2. Choose "Generate Subtitles (Whisper)"
3. Pick a model size (tiny to large-v3)
4. Select processing mode (Fast or Accurate)
5. Choose output type:
- **Sidecar file**: Export as `.srt`, `.vtt`, `.txt`, or `.lrc`
- **Soft subtitles**: Embed into video (can be toggled on/off in players)
- **Hard subtitles**: Burn into video (permanent, always visible)

### Supported Languages

Using multilingual models (`small`, `medium`, `large-v3`), you can transcribe audio in 99+ languages including English, Spanish, French, German, Chinese, Japanese, Korean, Hindi, Arabic, and many more.

## Star History



Star History Chart

## Sponsor



GitHub Sponsors


Buy Me a Coffee

## Contributors



## Contributing

Contributions are welcome! Please see the [Contributing Guidelines](CONTRIBUTING.md) for more information.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.


Made with ❤️ by Hariharen