# DVD to NAS video helper

This folder contains `rip-dvd-to-video.sh`, a Bash helper for converting an **unencrypted DVD** or an already-decrypted `VIDEO_TS`/DVD folder into an MP4/MKV file and optionally copying it to a mounted NAS folder.

## Legal/safety boundary

Use this only for DVDs you own where copying is legally permitted, and for unencrypted sources. The script does **not** bypass, disable, or provide instructions for defeating DVD DRM/encryption/Macrovision. If HandBrake cannot read the disc due to encryption/DRM, the script stops with a clear error.

## Install dependencies on Debian/Zorin/Ubuntu

```bash
sudo apt update
sudo apt install -y handbrake-cli ffmpeg rsync eject
```

## Find your DVD device

Common paths are `/dev/dvd` or `/dev/sr0`.

```bash
lsblk -o NAME,PATH,TYPE,SIZE,MODEL,MOUNTPOINTS
```

## Scan the disc first

```bash
./rip-dvd-to-video.sh --scan --source /dev/sr0
```

Look for the main/longest title number if automatic detection is not right.

## Rip to local folder

```bash
./rip-dvd-to-video.sh \
  --title-name "My Bought DVD" \
  --source /dev/sr0 \
  --title 1 \
  --out-dir "$HOME/Videos/DVD-Rips"
```

## Rip and copy to a mounted NAS folder

First make sure your NAS path is mounted and visible, for example:

```bash
findmnt /mnt/media_primary
```

Then run:

```bash
./rip-dvd-to-video.sh \
  --title-name "My Bought DVD" \
  --source /dev/sr0 \
  --title 1 \
  --out-dir "$HOME/Videos/DVD-Rips" \
  --nas-dir /mnt/media_primary/Movies
```

The script writes:

- the video file: `.mp4` by default,
- a HandBrake log,
- a small metadata `.txt` file,
- and verifies the output with `ffmpeg` before copying to the NAS.

## Container choice

Default is MP4:

```bash
--format mp4
```

Use MKV if you want a more flexible container for multiple audio/subtitle tracks:

```bash
--format mkv
```

## Dry run

```bash
./rip-dvd-to-video.sh --title-name "Test" --source /dev/sr0 --title 1 --dry-run
```
