Recovering from read errors in Linux
Posted: Wed Jan 03, 2018 2:17 pm
I recently encountered a blu-ray disc that caused MakeMKV to consistently throw a read error when reading one of the titles. Fortunately, that title was not the main feature so I could still watch the movie. However, I realised the bad title was a behind the scenes feature in the disc extras that I really wanted too. After poking around these forums and using my Linux knowledge I found the following procedure to work. It's very manual and can probably be improved but I'm posting it in case this helps another MakeMKV Linux user rip a disc with bad sectors.
The key tool is ddrescue whose manual explains how to read faulty optical media:
https://www.gnu.org/software/ddrescue/m ... ical-media
Step 1:
Use ddrescue to make a raw copy of the blu-ray disc to an image file and also a map file which identifies the bad areas of the disc (the bytes it could not read):
This creates (in the current directory) an image file called brimage which is a byte for byte copy of the blu ray disc at /dev/sr0 (which refers to your blu-ray drive device). The file brimage will contain zeros for those parts of the disk that ddrescue could not read. The map file mapfile is a text file which lists the sections ddrescue failed to read.
Step 2:
Rerun ddrescue to repeatedly read the bad sectors and attempt to recover as much as it can:
This command updates the map file and the image file. It also reports the size of the read error. You may have to repeat the above command several times. Hopefully, the reported read error size decreases down to zero. (In my case it went down to 230K and no further. This turned out to be acceptable as that meant I'd only lost about 4 or 5 frames from the video stream.)
Step 3:
As described by JohnYaya, use MakeMKV to copy the blu-ray disc without decryption:
Step 4:
Delete the incomplete BDMV directory from the backup folder:
Mount the image file on /mnt
Copy the entire BDMV directory from within the image file to the MakeMKV backup folder:
Step 5:
Follow the last part of JohnYaya instructions:
And now you can use MakeMKV to rip the backup to mkv files. But first change the output folder in MakeMKV to something else, for example, ~/Videos/THE_MATRIX (i.e. where you usually rip your discs to).
Step 6:
Clean up. You can delete the backup folder and the disc image once you have the titles ripped to mkv files.
That's it. I hope it is helpful.
Cheers
The key tool is ddrescue whose manual explains how to read faulty optical media:
https://www.gnu.org/software/ddrescue/m ... ical-media
Step 1:
Use ddrescue to make a raw copy of the blu-ray disc to an image file and also a map file which identifies the bad areas of the disc (the bytes it could not read):
Code: Select all
ddrescue -n -b2048 /dev/sr0 brimage mapfile
Step 2:
Rerun ddrescue to repeatedly read the bad sectors and attempt to recover as much as it can:
Code: Select all
ddrescue -d -r1 -b2048 /dev/sr0 brimage mapfile
Step 3:
As described by JohnYaya, use MakeMKV to copy the blu-ray disc without decryption:
In these examples, I'm going to use ~/backup/THE_MATRIX as the sub-directory that is specified in MakeMKV as the output folder.JohnYaya wrote:Start a backup, uncheck the decrypt option. Let it run until it gets to the first m2ts file. At that point, it has saved the disc code, which is a file called "discatt.dat". Stop the backup, quit MakeMKV, [...]
Step 4:
Delete the incomplete BDMV directory from the backup folder:
Code: Select all
rm -rvf ~/backup/THE_MATRIX/BDMV
Code: Select all
sudo mount -o loop brimage /mnt
Code: Select all
cp -rv /mnt/BDMV ~/backup/THE_MATRIX/
Follow the last part of JohnYaya instructions:
The discatt.dat file will be somewhere within the backup folder ~/backup/THE_MATRIX/.JohnYaya wrote:[...] start MakeMKV, select File>Open Files and navigate to and double click the discatt.dat file.
And now you can use MakeMKV to rip the backup to mkv files. But first change the output folder in MakeMKV to something else, for example, ~/Videos/THE_MATRIX (i.e. where you usually rip your discs to).
Step 6:
Clean up. You can delete the backup folder and the disc image once you have the titles ripped to mkv files.
Code: Select all
rm -rvf ~/backup/THE_MATRIX
sudo umount /mnt
rm brimage mapfile
That's it. I hope it is helpful.
Cheers