Lab
Camcorder disc rescue
Done its jobRecovers home video from unfinalized DVD camcorder discs that the Mac sees as blank.
$ python3 scripts/map_disc.py --json-out disc.json
drive ready, media present
media DVD-R, 1x writable
mounted no (finalized: false)
track start blocks kind
1 0 16 blank
2 16 311872 video
3 311888 148224 video
4 460112 2097152 blank
2 video tracks, 0.94 GB to read
read-only: nothing is written to the disc
$ python3 scripts/extract_disc.py --map disc.json --out ~/Desktop/Trip
[1/2] track 2: 311872 sectors
100% 2.6 MB/s
0 bad sectors [clean]
video 28,410 frames audio 947.9 s
recordings 6
[2/2] track 3: 148224 sectors
100% 2.4 MB/s
32 bad sectors [tail only]
video 12,882 frames audio 429.8 s
recordings 3
damage_is_tail_only: true
report: Trip/extract_report.json
$ python3 scripts/convert_clips.py --in ~/Desktop/Trip --crf 20
=== track_02: 720x480, 29.97 fps
clip_001.mp4 41 MB 02:31 frames ok
clip_002.mp4 96 MB 05:58 frames ok
clip_003.mp4 27 MB 01:44 frames ok
=== track_03: 720x480, 29.97 fps
clip_004.mp4 63 MB 03:52 frames ok
clip_005.mp4 38 MB 02:20 frames ok
verified 5 clips, 22:25 total
duration = frames / frame rate
How it works
- Check the drive and the disc. drutil confirms the burner is attached and media is present, and a short wait avoids reading blank data from a disc that is still spinning up.
- Map the disc. The mapper reports whether a filesystem exists, then lists every track with its start block, length and content type, probed from the first sector instead of guessed.
- Extract the video objects. Each video track is read sector by sector into a folder I name first. Bad sectors are counted, and damage only at the end of a track is treated as harmless run-out.
- Convert with ffmpeg. Each recording becomes one deinterlaced H.264 MP4, with an optional lossless MKV copy as an archive master.
- Verify and report. Output frames are compared with the frames read from the disc, and the true duration comes from frames divided by frame rate.
Built with
- PythonThree scripts: map the disc, extract the tracks, convert the clips.
- ffmpegEncodes each recording to MP4 and optionally keeps a lossless MKV.
- macOS drutilReports the drive, the media and the device node, read-only.
- Claude Code skillPackages the workflow and its rules so an agent walks through it the same way each time.
Decisions
- Never write to the disc. No burn, erase or finalize command is ever run. Closing the session would stop the camcorder from finalizing the disc properly later, and a read-only rip can always be retried.
- Convert through raw streams. Camcorder files restart their timestamps at every recording, so a direct conversion either adds silence or drifts out of sync. Going through elementary streams and rebuilding the timing avoids both.
- Trust frame counts, not file metadata. The duration a tool reports for a raw carve is wrong, so the report uses frames divided by frame rate and checks it against the audio length.