evilclive
15th April 2008, 09:34
One of my USB IDE hard disk caddies is faulty, and has been corrupting my files. At random intervals every few hundred megabytes, it places the first two bytes of a 512-byte sector at the end of the sector, and shifts the rest of the sector backwards two bytes.
I've been able to work this out because my files are MPEG-2 recordings captured directly off UK Freeview, and every 188 bytes there is a synchronisation word: in hex, 47 02 BD xy, where x is a flag nybble usually equal to 0x1, and y counts cyclicly from 0x0 to 0xF.
ProjectX 0.90.4.00 uses these synchronisation words to detect MPEG-2 errors, but it doesn't do a perfect job. When a synch word is missing, it searches forward from its expected location until it finds the next synch word, and discards the intervening data.
It would be easy enough for me to write a program to fix the simpler errors, and list the more awkward cases for me to intervene manually with a hex editor. It would take longer to automate the process fully, to produce something robust enough to put onto Sourceforge.
Is this something that might be useful to someone else?
I've been able to work this out because my files are MPEG-2 recordings captured directly off UK Freeview, and every 188 bytes there is a synchronisation word: in hex, 47 02 BD xy, where x is a flag nybble usually equal to 0x1, and y counts cyclicly from 0x0 to 0xF.
ProjectX 0.90.4.00 uses these synchronisation words to detect MPEG-2 errors, but it doesn't do a perfect job. When a synch word is missing, it searches forward from its expected location until it finds the next synch word, and discards the intervening data.
It would be easy enough for me to write a program to fix the simpler errors, and list the more awkward cases for me to intervene manually with a hex editor. It would take longer to automate the process fully, to produce something robust enough to put onto Sourceforge.
Is this something that might be useful to someone else?