"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects." (Robert A. Heinlein)

Tuesday, 18 August 2009

Recovering a unfinished DVD using Linux

I spent some of this summer days off converting my old VHS-C videos to DVD format. It's usually only matter of playing the old cassettes on a VHS recorder connected to my Panasonic DVD recorder, I only have to change cassette every 45 min. And finalize the DVD every three cassettes, just a long simple boring task.
Unfortunately last time (about a week ago) the DVD recorder refused to finalize two disks (which means four hours and half of work). I don't know if the problem was because of defective DVDs, recorder overheating or simple, plain bad luck. I so started looking in the 'net for a solution. Things started to become interesting when I found not only a solution but a Linux solution! This post on Rip Linton's Blog sounded a little odd at first but it worked and solved my problem.

Following Rip instructions I so installed DVDsaster from the “Add/Remove ...” tool and extracted an ISO image from the faulty DVD.
Then I had to split the resulting ISO file. Instead of following Rip directions I preferred to compile and use the handy C program posted in following comments. I simply had to modify some line line in order to get more than 100 split files. Here are the modified lines that appears twice in the code:
if(SubFileNumber++ >9999) exit4error("too many output files generated\n");
snprintf(OutputFileName, 64, "%s%.4dj.vob", argv[1], SubFileNumber);
I finally got over 200 small files all but three contained a valid video file. All I have to do, now, is re-join them all.

Thanks a lot to Rip Linton and David Savinkoff (the C program author).