Files
2025-07-27 10:33:21 -05:00

505 lines
12 KiB
Markdown

Here's the complete cleaned-up documentation following the optimized structure:
---
# **DVD Ripping Workflow Documentation**
*Last Updated: [DATE]*
## **1. Introduction**
### **Purpose**
A reliable, lossless method to rip DVDs to MKV files while preserving original quality and all audio/subtitle tracks.
### **Requirements**
- Linux system with DVD drive
- sudo/root access for mounting
- 2x DVD storage space for temporary files
### **Tool Overview**
| Tool | Purpose |
|------|---------|
| `vobcopy` | Simple DVD extraction |
| `dvdbackup` | Advanced title selection |
| `ffmpeg` | Video conversion/merging |
| `lsdvd` | DVD structure analysis |
| `mpv` | Playback verification |
---
## **2. Installation**
### **Core Tools**
```bash
sudo apt update
sudo apt install vobcopy dvdbackup ffmpeg lsdvd
```
### **Optional Playback Support**
```bash
sudo apt install mpv
```
---
## **3. Basic Ripping Workflow**
### **3.1 Mount DVD (If Not Auto-Mounted)**
```bash
sudo mkdir -p /mnt/dvd
sudo mount /dev/sr0 /mnt/dvd
```
### **3.2 Identify Main Title**
```bash
lsdvd /dev/sr0 | grep -A 5 'Longest track'
```
*Output shows title number, duration, and chapters*
### **3.3 Ripping Methods**
#### **Method A: vobcopy (Recommended for Simplicity)**
```bash
vobcopy -l -m -o ~/dvd_rips
```
**Flags**:
- `-l`: Large file support (>2GB)
- `-m`: Mirror DVD structure
- `-o`: Output directory
#### **Method B: dvdbackup (For Title Selection)**
```bash
dvdbackup -i /dev/sr0 -o ~/dvd_rip -t <TITLE_NUM> -M
```
**Flags**:
- `-t`: Specify title number
- `-M`: Main feature mode
### **3.4 Convert to MKV**
```bash
ffmpeg -err_detect ignore_err \
-i "concat:INPUT.VOB" \
-map 0:v -map 0:a -map 0:s? \
-c copy \
output.mkv
```
**Key Options**:
- `ignore_err`: Skip corrupted sectors
- `-map`: Include all streams
- `-c copy`: No re-encoding
---
## **4. Advanced Techniques**
### **4.1 Batch Processing**
```bash
for vob in ~/dvd_rips/VIDEO_TS/VTS_*.VOB; do
ffmpeg -err_detect ignore_err -i "$vob" \
-c copy "${vob%.VOB}.mkv"
done
```
### **4.2 Multi-Title Extraction**
```bash
for title in $(lsdvd /dev/sr0 | grep 'Title' | awk '{print $2}' | tr -d ','); do
vobcopy -l -n $title -i /mnt/dvd -o ~/dvd_titles
done
```
### **4.3 Error Recovery**
```bash
ffmpeg -err_detect aggressive -i corrupted.VOB \
-c:v libx264 -crf 18 -preset slow \
-c:a copy \
repaired.mkv
```
---
## **5. Verification**
### **5.1 Quick Integrity Check**
```bash
ffprobe -v error -show_format output.mkv
```
### **5.2 Stream Comparison**
```bash
ffprobe -show_streams file1.mkv > file1.txt
ffprobe -show_streams file2.mkv > file2.txt
diff -y file1.txt file2.txt | colordiff
```
### **5.3 Playback Test**
```bash
mpv --untimed --frames=100 output.mkv
```
---
## **6. Playback Options**
### **6.1 Basic Playback**
```bash
mpv output.mkv
```
### **6.2 Advanced Controls**
| Key | Action |
|-----|--------|
| ``/`` | Seek ±5 sec |
| `Space` | Pause/Play |
| `#` | Cycle audio tracks |
| `j` | Next subtitle |
| `f` | Fullscreen |
### **6.3 Hardware Acceleration**
```bash
mpv --hwdec=vaapi --vo=gpu output.mkv
```
---
## **7. Troubleshooting**
### **Common Issues**
**Problem**: `vobcopy` fails with "Cannot open /dev/dvd"
**Solution**:
```bash
sudo chmod +r /dev/sr0
```
**Problem**: Broken VOB files
**Solution**: Force ffmpeg processing:
```bash
ffmpeg -fflags +genpts -i broken.VOB -c copy fixed.mkv
```
---
## **Appendices**
### **A. Command Quick Reference**
```bash
# Rip entire DVD
vobcopy -l -m -o ~/dvd_rips
# Extract specific title
dvdbackup -t 3 -M -o ~/dvd_rip
# Verify streams
ffprobe -show_streams video.mkv
```
### **B. FAQ**
**Q**: How to preserve subtitles?
**A**: Use `-map 0:s?` in ffmpeg
**Q**: Why MKV over MP4?
**A**: MKV supports DVD subtitles and multiple audio tracks natively
---
This documentation:
✅ Removes all redundancy
✅ Organizes workflows logically
✅ Provides consistent formatting
✅ Includes troubleshooting
✅ Offers quick-reference sections
Let me know if you'd like any section expanded or additional details added!
---
You're right - I misunderstood your request. Let me reset and provide exactly what you need for reliable DVD ripping without playback complications.
### **Bulletproof DVD Ripping Workflow**
#### **1. Install Required Tools**
```bash
sudo apt install vobcopy lsdvd ffmpeg
```
#### **2. Reliable Rip Command**
```bash
vobcopy -l -m -o ~/dvd_rips
```
*Flags:*
- `-l` Large file support
- `-m` Mirror entire DVD structure
- `-o` Output directory
#### **3. Stream-Copy Conversion**
```bash
ffmpeg -err_detect ignore_err \
-i ~/dvd_rips/VIDEO_TS/VTS_01_1.VOB \
-map 0:v -map 0:a -map 0:s? \
-c copy \
"dvd_output.mkv"
```
#### **4. Verify Output**
```bash
ffprobe -v error -show_format -show_streams dvd_output.mkv
```
### **Key Advantages**
1. **No Re-encoding**: Preserves original quality
2. **Error Resilience**: `ignore_err` handles bad sectors
3. **Complete Preservation**: Keeps all audio/subtitle tracks
4. **No Playback Dependencies**: Creates standalone files
### **For Batch Processing**
```bash
for vob in ~/dvd_rips/VIDEO_TS/VTS_*.VOB; do
ffmpeg -err_detect ignore_err -i "$vob" \
-c copy "${vob%.VOB}.mkv"
done
```
This gives you:
- Original quality rips
- No sync issues
- All subtitle/audio tracks
- Files ready for Plex/archiving
Would you like me to focus on any specific part of this workflow?
---
Understood. Let's implement a **clean, methodical approach** using two reliable Linux CLI tools to rip DVDs. We'll compare:
1. **`vobcopy`** (traditional, reliable)
2. **`dvdbackup` + `ffmpeg`** (more flexible)
Both methods will output MKV files for fair comparison.
---
### **Method 1: vobcopy (Simple & Reliable)**
```bash
# Install if needed
sudo apt install vobcopy
# Create mount point (if not already done)
sudo mkdir -p /mnt/dvd
sudo mount /dev/sr0 /mnt/dvd
# Rip main title (longest track) to VOB
vobcopy -l -n $(lsdvd /dev/sr0 | grep 'Longest track' | awk '{print $3}') -i /mnt/dvd -o ~/dvd_rip
# Convert VOB to MKV
ffmpeg -i ~/dvd_rip/*/VIDEO_TS/merged.vob -c copy "method1_output.mkv"
# Cleanup
sudo umount /mnt/dvd
```
---
### **Method 2: dvdbackup + ffmpeg (More Control)**
```bash
# Install if needed
sudo apt install dvdbackup
# Rip specific title
dvdbackup -i /dev/sr0 -o ~/dvd_rip -t $(lsdvd /dev/sr0 | grep 'Longest track' | awk '{print $3}') -M
# Convert VOBs to MKV
ffmpeg -i "concat:$(ls ~/dvd_rip/*/VIDEO_TS/VTS_*.VOB | tr '\n' '|' | sed 's/|$//')" \
-c copy "method2_output.mkv"
```
---
### **Comparison Script**
```bash
#!/bin/bash
DVD_DEV="/dev/sr0"
OUTPUT_DIR="$HOME/dvd_comparison"
mkdir -p "$OUTPUT_DIR"
# Method 1: vobcopy
time {
sudo mount "$DVD_DEV" /mnt/dvd 2>/dev/null
vobcopy -l -n $(lsdvd "$DVD_DEV" | grep 'Longest track' | awk '{print $3}') -i /mnt/dvd -o "$OUTPUT_DIR/method1"
ffmpeg -i "$OUTPUT_DIR/method1"/*/VIDEO_TS/merged.vob -c copy "$OUTPUT_DIR/method1.mkv" -y
}
# Method 2: dvdbackup
time {
dvdbackup -i "$DVD_DEV" -o "$OUTPUT_DIR/method2" -t $(lsdvd "$DVD_DEV" | grep 'Longest track' | awk '{print $3}') -M
ffmpeg -i "concat:$(ls "$OUTPUT_DIR/method2"/*/VIDEO_TS/VTS_*.VOB | tr '\n' '|' | sed 's/|$//')" \
-c copy "$OUTPUT_DIR/method2.mkv" -y
}
# Compare results
echo -e "\n=== RESULTS ==="
echo "Method 1 (vobcopy): $(du -h "$OUTPUT_DIR/method1.mkv" | awk '{print $1}')"
echo "Method 2 (dvdbackup): $(du -h "$OUTPUT_DIR/method2.mkv" | awk '{print $1}')"
```
---
### **How to Evaluate**
1. **Speed**: Check the `time` output for each method
2. **Quality**: Compare files with:
```bash
ffprobe -v error -show_streams -i method1.mkv > method1_info.txt
ffprobe -v error -show_streams -i method2.mkv > method2_info.txt
diff method1_info.txt method2_info.txt
```
3. **Reliability**: Note which method had fewer errors
---
### **Final Recommendation**
- **Choose `vobcopy` if**: You want simplicity and reliable single-file output
- **Choose `dvdbackup` if**: You need per-title control or have problematic discs
Both methods are **bulletproof** when discs are clean. The winner depends on your specific use case.
---
Great! The DVD is now properly mounted at `/mnt/dvd` in read-only mode (which is normal for DVDs). Let's proceed with the **simplest, most reliable method** to extract **Title 06** (the 2h15m episode) using your working setup.
---
### **Step 1: Rip Title 06 Using `vobcopy` (Correct Syntax)**
```bash
vobcopy -l -n 6 -i /mnt/dvd -o ~/dvd_rip
```
- `-l`: Enables large file support (required for DVDs >2GB).
- `-n 6`: Explicitly selects **Title 06** (the main episode).
- `-i /mnt/dvd`: Points to the mounted DVD (your `vobcopy` version requires this).
- `-o ~/dvd_rip`: Output directory.
**Wait for completion**—this may take 10-30 minutes depending on DVD speed.
---
### **Step 2: Verify the Ripped Files**
```bash
ls ~/dvd_rip/YELLOWSTONE_S1_D2/VIDEO_TS/
```
You should see:
- `VTS_01_1.VOB`, `VTS_01_2.VOB`, etc. (the main video).
- `VIDEO_TS.IFO` (metadata).
---
### **Step 3: Merge VOBs into a Single MKV (Lossless)**
```bash
ffmpeg -i "concat:$(ls ~/dvd_rip/YELLOWSTONE_S1_D2/VIDEO_TS/VTS_01_*.VOB | tr '\n' '|' | sed 's/|$//')" \
-c copy "Yellowstone_S01E02.mkv"
```
- **`concat:`**: Merges all VOBs in order.
- **`-c copy`**: No re-encoding (keeps original quality).
---
### **Step 4: Clean Up**
```bash
sudo umount /mnt/dvd # Unmount the DVD
rm -rf ~/dvd_rip # Delete temporary VOBs (optional)
```
---
### **Troubleshooting**
1. **If `vobcopy` fails**:
- Retry with `-v` (verbose) to see errors:
```bash
vobcopy -v -l -n 6 -i /mnt/dvd -o ~/dvd_rip
```
- Ensure `/mnt/dvd` contains DVD files:
```bash
ls /mnt/dvd/VIDEO_TS/
```
2. **If `ffmpeg` complains about invalid VOBs**:
- Extract the largest VOB manually:
```bash
ffmpeg -i ~/dvd_rip/YELLOWSTONE_S1_D2/VIDEO_TS/VTS_01_1.VOB -c copy "output.mkv"
```
---
### **Expected Result**
- `Yellowstone_S01E02.mkv`: A Plex-ready file with:
- Original video (MPEG-2).
- Original audio (AC3/DTS).
- Embedded subtitles (if any).
No more guesswork—this **exact sequence** works with your setup. Let me know if you hit any snags!
---
Great! Since you have `mpv` installed (the best CLI media player), here's how to properly view your output files with all streams intact:
### **Basic Playback**
```bash
mpv output.mkv
```
### **Advanced Viewing Options**
#### 1. **Verify all streams are detected**:
```bash
mpv --vf=format=fmt=help output.mkv
```
This will first show you all available video/audio/subtitle streams before playing.
#### 2. **Play with specific audio/subtitle tracks**:
```bash
mpv --aid=1 --sid=1 output.mkv
```
Where:
- `--aid=1` selects audio track #1
- `--sid=1` selects subtitle track #1
#### 3. **Keyboard controls while playing**:
| Key | Function |
|-----|----------|
| `Space` | Pause/Play |
| `` | Seek +5 sec |
| `` | Seek -5 sec |
| `m` | Mute |
| `f` | Fullscreen |
| `9`/`0` | Volume control |
| `j` | Next subtitle track |
| `#` | Cycle audio tracks |
| `q` | Quit |
#### 4. **For hardware-accelerated playback** (if supported):
```bash
mpv --hwdec=auto output.mkv
```
### **To Verify Your Rip Quality**
```bash
mpv --untimed --frames=1 --no-audio output.mkv
```
This will:
1. Show just the first frame
2. Pause immediately
3. Let you inspect video quality
4. Press `q` to exit
### **Bonus: Create a Playback Script**
Save this as `play-dvdrip`:
```bash
#!/bin/bash
file=${1:-output.mkv}
mpv --hwdec=auto \
--sub-auto=all \
--audio-channels=6 \
"$file"
```
Make it executable:
```bash
chmod +x play-dvdrip
```
Then use:
```bash
./play-dvdrip output.mkv
```
This gives you professional-grade playback with:
- Auto subtitle detection
- 5.1 audio channel support
- Hardware acceleration
- All the keyboard controls mentioned above
Your rip is ready to enjoy! The combination of `ffmpeg` for encoding and `mpv` for playback gives you a complete, high-quality media workflow.