Shell script for creating preservation-quality archival copies of DVD-VIDEO discs on macOS. Creates ISO disk images as the core preservation object, extracts DVD titles to MKV format as native-compression title masters, and generates access MP4 files with bob deinterlacing.
- ISO Creation: Uses ddrescue with 5% safety margin for reliable disk imaging
- MKV Extraction: Extracts all titles (greater than 5 seconds long) using MakeMKV
- Extraction Validation: Automatic duration comparison detects incomplete MakeMKV extractions
- Access Files: Generates MP4 files with automatic field order detection
- Bob Deinterlacing: Uses
bwdif=mode=send_fieldto preserve original temporal resolution - Error Recovery: Comprehensive error handling and logging throughout
- Smart Naming: Automatic file renaming from MakeMKV format to PM (Preservation Master) format
- macOS 10.15 Catalina or later
- Admin privileges (for disk imaging with ddrescue)
- External or internal DVD drive
- At least 10GB free disk space per DVD
- ffmpeg - Video transcoding
- ffprobe - Media analysis (included with ffmpeg)
- ddrescue - Disk imaging with error recovery
- makemkvcon - DVD title extraction
- diskutil - Disk management (included with macOS)
These tools are not required for the script to run, but enhance functionality:
- bc - Basic calculator for extraction validation (highly recommended)
- jq - Faster JSON parsing for field order detection
- lsdvd - Displays info about DVD disks and disk images; use
lsdvd -c path-to-.iso - dvdbackup - DVD backup utility which can also display info about DVDs; use
dvdbackup -I -i path-to-.iso
For a complete archival workflow:
- exiftool - Extract and analyze file metadata
- mediainfo - Display technical metadata about media files
- Invisor - Improved MediaInfo wrapper (Mac App Store)
- IINA - Modern video player for verification (or VLC)
- amiaos - AMIA Open Source archival tool suite
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"brew install ffmpeg ddrescue makemkv bc jqThese tools support a complete archival workflow:
# Install archival utilities
brew install exiftool mediainfo
# Install AMIA Open Source tools
brew install amiaopensource/amiaos
# Install video player
brew install iina
# Cleanup
brew cleanup
brew doctorInvisor (media file inspector) must be installed separately from the Mac App Store.
Add Homebrew and MakeMKV to your PATH permanently:
# For Apple Silicon Macs (M1/M2/M3):
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc
# For Intel Macs:
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.zshrc
# Add MakeMKV CLI:
echo 'export PATH="/Applications/MakeMKV.app/Contents/MacOS:$PATH"' >> ~/.zshrc
# Apply changes:
source ~/.zshrccd ~/Documents # or your preferred location
git clone https://github.com/tomackroyd/archive-dvd.git
cd archive-dvd
chmod +x "ARCHIVE-DVD-VIDEO.zsh"which ffmpeg # Should show /opt/homebrew/bin/ffmpeg
which ddrescue # Should show /opt/homebrew/bin/ddrescue
which makemkvcon # Should show /Applications/MakeMKV.app/Contents/MacOS/makemkvconcd ~/Documents/archive-dvd
zsh "ARCHIVE-DVD-VIDEO.zsh"The script presents an interactive menu with options for your workflow.
Purpose: Create a disk image from a physical DVD.
Requirements:
- Admin privileges (script will prompt for sudo password)
- Physical DVD inserted in drive
Steps:
- Insert DVD
- Choose Option 1
- Enter device identifier (e.g.,
disk3)- Script shows available devices to help you choose
- Enter output filename (e.g.,
CA0001234567)- Script adds
.isoextension automatically
- Script adds
- Confirm overwrite if file exists
- Wait for ddrescue to complete
What Happens:
- DVD is unmounted
- Raw disk image created with 3 retry passes (
-r3) - 5% safety margin added to prevent data truncation
- Progress and time remaining displayed
- Log file created:
FILENAME.iso.log
Output:
FILENAME.iso- Disk image fileFILENAME.iso.log- ddrescue log for error tracking
Purpose: Extract preservation masters (MKV) and create access files (MP4).
Requirements: ISO file (from Option 1 or existing)
Steps:
- Choose Option 2
- Select ISO file (uses just-created ISO or prompts for path)
- Optionally eject physical DVD
- Wait for processing
What Happens:
- MakeMKV extracts all titles ≥5 seconds to MKV
- Files renamed:
title_t00.mkv→FILENAME-PM01.mkv - Extraction validated: VOB duration compared with MKV duration
- Field order detected for each title
- Access MP4 created with appropriate deinterlacing
- Log file moved to output directory on exit
Validation Check: After extraction, the script automatically validates that MakeMKV extracted all content by comparing total VOB duration with total MKV duration. If validation fails (MKVs < 98% of VOB duration), you'll be prompted to investigate. See VALIDATION-TROUBLESHOOTING.md for workarounds.
Output:
FILENAME-PM01.mkv,FILENAME-PM02.mkv, etc. - Preservation mastersFILENAME-A01.mp4,FILENAME-A02.mp4, etc. - Access filesFILENAME-RF.log- Complete operation log
Purpose: Extract preservation masters without creating access files.
Use Case:
- Batch processing where you'll create access files later
- When you only need archival MKVs
- Saves time when processing multiple discs
Same as Option 2 but skips MP4 generation. Includes extraction validation.
Output:
FILENAME-PM##.mkv- Preservation master files only
Note: Validation still runs to detect incomplete extractions.
Purpose: Generate access MP4s from existing MKV files.
Use Case:
- Regenerate access files with different settings
- Create access files after using Option 3
- Replace corrupted access files
Steps:
- Choose Option 4
- Enter path to directory containing MKV files
- Script processes all
.mkvfiles found - Shows success/failure count
Supported Naming:
FILENAME-PM##.mkv(Preservation Master)FILENAME-A##.mkv(Access - will regenerate)
Output:
FILENAME-A##.mp4- Access files for all MKVs
Safely exits script and moves log file to output directory (if available).
- Format:
IDENTIFIER-PM##.mkv - Example:
CA0001234567-PM01.mkv - PM = Preservation Master
- Numbers start at 01 (MakeMKV title 0 becomes PM01)
- Format:
IDENTIFIER-A##.mp4 - Example:
CA0001234567-A01.mp4 - A = Access
- Numbers match corresponding PM file
- Format:
archive_dvd_video_YYYYMMDD_HHMMSS.log - Final:
IDENTIFIER-RF.log(moved to output directory on exit) - Contains complete terminal output for audit trail
- Format:
IDENTIFIER.iso - Example:
CA0001234567.iso - Log:
IDENTIFIER.iso.log(ddrescue error log)
The script automatically detects field order and applies appropriate processing:
| Field Order | Action | FFmpeg Filter |
|---|---|---|
| Progressive | None | Direct encode (no deinterlacing) |
| Top Field First (TFF) | Bob deinterlace | bwdif=mode=send_field:parity=tff:deint=all |
| Bottom Field First (BFF) | Bob deinterlace | bwdif=mode=send_field:parity=bff:deint=all |
| Unknown/Empty | Bob deinterlace | bwdif=mode=send_field:parity=tff:deint=all |
Bob deinterlacing (send_field mode):
- Preserves original temporal resolution (25fps interlaced becomes 50fps progressive)
- Ideal for standard archival access copies that reflect source temporal resolution
MP4 files use these settings for broad compatibility:
Video:
- Codec: H.264 (libx264)
- Bitrate: 3 Mbps (min 3M, max 6M, buffer 6M)
- Preset: medium
- Profile: High, Level 3.1
- Pixel Format: yuv420p
Audio:
- Codec: AAC
- Bitrate: 192 kbps
- Channels: Stereo (2.0)
Container:
- Format: MP4
- Fast start enabled (web streaming)
- Chapters preserved
- Subtitles excluded
The script adds a 5% safety margin to the OS-reported DVD size.
Why?
- OS may underestimate disc size on damaged discs
- Prevents data truncation at end of disc
- Dual-layer DVDs may report inconsistent sizes
How it works:
Detected size: 4,700,372,992 bytes
Safety margin (5%): 235,018,650 bytes
Total read: 4,935,391,642 bytes
This ensures complete capture while maintaining progress reporting.
DDrescue provides:
- 3 retry passes on read errors (
-r3) - Continues on errors instead of aborting
- Detailed log files showing bad sectors
- Can resume interrupted operations
Check the .iso.log file after imaging for any read errors.
- Insert DVD
- Run script → Option 1 (create ISO)
- Continue → Option 2 (create MKV + MP4)
- Verify output files
Phase 1: Imaging (requires admin privileges)
- Create ISOs for all discs using Option 1
- Name systematically:
CA0001234567,CA0001234568, etc. - Store ISOs in staging directory and pass to Phase 2
Phase 2: Processing (can run as standard user)
- Use Option 2 to process each ISO
- Can run on different machine
- Can interrupt and resume
Phase 3: Quality Control
- Verify MKV files play correctly
- Check access MP4 files for quality
- Verify file sizes are reasonable
Preservation Masters (ISO and MKV):
- Store on redundant storage (RAID, cloud backup)
- Never delete after creating derivatives
- Consider LTO tape for long-term archival
- These are your master copies
Access Copies (MP4):
- Suitable for streaming servers and general use
- Can be regenerated from MKV if lost
- Lower storage priority than masters
- Delete and regenerate if quality standards change
Solution:
brew install ffmpeg ddrescue makemkv
which ffmpeg
which makemkvconSolution:
- Run
diskutil listto see all devices - Look for your DVD (shows disc name)
- Use device identifier (e.g.,
disk3not/dev/disk3)
Solution:
- Close applications accessing the DVD
- Try:
diskutil unmountDisk /dev/disk3 - Eject and reinsert disc if persistent
MakeMKV is free during beta but requires periodic key updates.
Solution:
- Visit MakeMKV Forum
- Copy latest key from first post
- Open MakeMKV GUI → Help → Register
- Paste key and apply
Beta keys last 30-60 days. Bookmark the forum link.
Solution:
echo 'export PATH="/Applications/MakeMKV.app/Contents/MacOS:$PATH"' >> ~/.zshrc
source ~/.zshrc
which makemkvconSolution: Troubleshoot at this page: https://forum.makemkv.com/forum/viewtopic.php?t=35350
Solution:
- Script uses
sudoand will prompt for password - Ensure your account has admin privileges
- Or run entire script with:
sudo zsh "ARCHIVE DVD-VIDEO.zsh"
Solution:
- Check
.iso.logfile for progress - Press Ctrl+C to cancel (safe - can resume)
- Try cleaning disc
- Try different DVD drive
Solution: Bob deinterlacing (doubles frame rate) is best for preserving temporal resolution. If playback looks choppy, ensure your player supports 50fps playback.
When you see:
⚠️ VALIDATION FAILED: Extracted MKVs are significantly shorter than source VOBs!
This means MakeMKV failed to extract all DVD cells. The extracted MKVs are incomplete.
Solution: See VALIDATION-TROUBLESHOOTING.md for detailed workarounds including:
- Direct ffmpeg extraction from VOBs (recommended)
- HandBrake CLI as alternative
- MakeMKV GUI troubleshooting
- When to report bugs to MakeMKV developers
Script: ARCHIVE-DVD-VIDEO.zsh
Deinterlacing: Bob (send_field mode, doubles frame rate)
Frame Rate: 50fps output from 25fps interlaced source
Dependencies: ffmpeg, ddrescue, makemkvcon
Platform: macOS 10.15+
See LICENSE file for details.
- GNU ddrescue - Disk imaging
- MakeMKV - DVD extraction
- FFmpeg - Video transcoding
- bwdif filter - High-quality deinterlacing