vobtomp4 – Convert VOB to MP4 on macOS with ffmpeg + Python

If you’ve ever ripped a DVD and ended up with `.VOB` files, you may want to convert them into widely compatible `.mp4` files (H.264/AAC) for easy playback on phones, TVs, and streaming apps. This post shows a simple, reliable way to do that using a lightweight Python script around `ffmpeg`.

vobtomp4 – Convert VOB to MP4 on macOS with ffmpeg + Python
# Convert VOB to MP4 on macOS with ffmpeg + Python

If you’ve ever ripped a DVD and ended up with `.VOB` files, you may want to convert them into widely compatible `.mp4` files (H.264/AAC) for easy playback on phones, TVs, and streaming apps. This post shows a simple, reliable way to do that using a lightweight Python script around `ffmpeg`.

## What It Is

A tiny Python script (`vobtomp4.py`) that discovers `.VOB` files in a file or folder and converts them to `.mp4` using H.264 for video and AAC for audio. It exposes sensible options (quality via CRF, encoder preset, deinterlacing, threads) while keeping the command line simple.

## Prerequisites

- macOS (or any OS with Python 3)
- Python 3.8+
- `ffmpeg` installed and available in `PATH`

Install ffmpeg on macOS via Homebrew:

```bash
brew install ffmpeg
```

## Quick Start

From the project folder, run:

```bash
python3 vobtomp4.py /path/to/vob_folder_or_file -o /path/to/output \
  --crf 20 --preset medium --deinterlace --overwrite
```

This will:
- Locate `.VOB` files (from a single file or recursively in a folder)
- Re-encode video to H.264 and audio to AAC
- Save `.mp4` files to the output directory (or beside the inputs)

## Key Options

- `input`: a single `.VOB` file or a directory containing multiple `.VOB` files.
- `-o, --output-dir`: output directory (default: same directory as the input file).
- `--crf`: video quality (typical 18–23; lower = better; default 20).
- `--preset`: x264 speed vs compression (`ultrafast` … `veryslow`), default `medium`.
- `--deinterlace`: apply the `yadif` filter (DVDs are often interlaced).
- `--overwrite`: overwrite existing outputs.
- `--dry-run`: only print the `ffmpeg` commands, without executing.
- `--threads`: set number of `ffmpeg` threads.

## Examples

Convert a specific file, saving next to it:

```bash
python3 vobtomp4.py /Volumes/DVD/VIDEO_TS/VTS_01_1.VOB --deinterlace
```

Convert all `.VOB` files in a directory to a chosen output folder:

```bash
python3 vobtomp4.py /Volumes/DVD/VIDEO_TS -o ~/Movies/DVD01 --crf 20 --preset medium
```

Preview the commands without running them:

```bash
python3 vobtomp4.py /Volumes/DVD/VIDEO_TS -o ~/Movies/DVD01 --dry-run
```

## Notes on Quality & Compatibility

- The script re-encodes to H.264/AAC for broad device and app support. Remuxing (no re-encode) from MPEG-2 in `.VOB` to MP4 is not widely supported, so re-encoding is the safe default.
- For better quality at moderate size, try `--crf 18` or stick with `--crf 20`, and consider `--preset slow` if you can spare time.
- DVDs are often 480i/576i (interlaced). `--deinterlace` usually improves the look on modern displays.

## Troubleshooting

- "ffmpeg not found": install via `brew install ffmpeg` and ensure `ffmpeg` is in your `PATH`.
- Permission errors on external volumes: check read/write permissions for your source and destination directories.

## Why Use This Script?

While you could write raw `ffmpeg` commands yourself, this script:
- Handles file discovery (single file or full folders)
- Applies sensible defaults for H.264/AAC encoding
- Makes quality/performance trade-offs straightforward via `--crf` and `--preset`
- Offers `--dry-run` to inspect generated commands before running

It’s ideal when you want clean, compatible `.mp4` outputs from `.VOB` without memorizing complex `ffmpeg` flags.

A

Admin

Escritor e criador de conteúdo