Lab

Camcorder disc rescue

Done its job

Recovers 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
Step one: the mapper lists every track with its start block and length, and probes the first sector to tell video from blank. Mockup with sample data.
$ 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
Step two: each track is read sector by sector, with bad sectors counted and checked for run-out at the end of a recording. Mockup with sample data.
$ 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
Steps three and four: each recording becomes one MP4, and the verification line compares output frames with the frames read from the disc. Mockup with sample data.

How it works

disclooks blank mapdrutil + probe extractraw sectors convertffmpeg verifyframes read-only the whole way
  1. 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.
  2. 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.
  3. 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.
  4. Convert with ffmpeg. Each recording becomes one deinterlaced H.264 MP4, with an optional lossless MKV copy as an archive master.
  5. 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

Decisions