Recovering from read errors in Linux

Discussion of advanced MakeMKV functionality, expert mode, conversion profiles
Post Reply
Cobalt
Posts: 3
Joined: Tue Nov 14, 2017 3:37 pm

Recovering from read errors in Linux

Post by Cobalt » 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):

Code: Select all

ddrescue -n -b2048  /dev/sr0 brimage mapfile
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:

Code: Select all

ddrescue -d -r1 -b2048 /dev/sr0 brimage mapfile
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:
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, [...]
In these examples, I'm going to use ~/backup/THE_MATRIX as the sub-directory that is specified in MakeMKV as the output folder.

Step 4:

Delete the incomplete BDMV directory from the backup folder:

Code: Select all

rm  -rvf ~/backup/THE_MATRIX/BDMV
Mount the image file on /mnt

Code: Select all

sudo mount -o loop brimage /mnt
Copy the entire BDMV directory from within the image file to the MakeMKV backup folder:

Code: Select all

cp -rv /mnt/BDMV ~/backup/THE_MATRIX/
Step 5:

Follow the last part of JohnYaya instructions:
JohnYaya wrote:[...] start MakeMKV, select File>Open Files and navigate to and double click the discatt.dat file.
The discatt.dat file will be somewhere within the backup folder ~/backup/THE_MATRIX/.

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

kaligari
Posts: 1
Joined: Fri Mar 02, 2018 4:33 pm

Re: Recovering from read errors in Linux

Post by kaligari » Fri Mar 02, 2018 4:35 pm

hi Cobalt,

is it possible to do the same recovering on Windows? I found only this video recovery software and it doesn't help me. THanks!

Edited to remove link; the link has nothing to do with recovering from optical media read errors.

Cobalt
Posts: 3
Joined: Tue Nov 14, 2017 3:37 pm

Re: Recovering from read errors in Linux

Post by Cobalt » Mon Mar 05, 2018 4:36 pm

kaligari wrote:hi Cobalt,

is it possible to do the same recovering on Windows? I found only this video recovery software and it doesn't help me. THanks!

I am sorry, this technique is for Linux. I do not think that ddrescue is available for Windows. I do not use Windows and do not know what Windows software would do the same task as ddrescue.

Good luck with recovering your disc.

crackers8199
Posts: 4
Joined: Thu Mar 08, 2018 9:11 am

Re: Recovering from read errors in Linux

Post by crackers8199 » Sun Mar 11, 2018 1:45 am

is there a trick to getting this to work that i'm missing? i followed everything exactly and i still can't get makemkv to get past the "corrupt or invalid at offset xxxxxx, attempting to work around" parts of the file...it has been running for 4+ hours and is stuck in the same spot. the "time remaining" counter just keeps increasing. now it's up to 24+ hours remaining.

nilpin
Posts: 1
Joined: Tue May 15, 2018 9:12 pm

Re: Recovering from read errors in Linux

Post by nilpin » Tue May 15, 2018 9:17 pm

kaligari wrote:hi Cobalt,

is it possible to do the same recovering on Windows? I found only this video recovery software and it doesn't help me. THanks!

Edited to remove link; the link has nothing to do with recovering from optical media read errors.
For Windows systems, I suggest using a Linux Live cd - the following page details how to install ddrescue using Knoppix Linux. https://www.data-medics.com/forum/how-t ... -t133.html

I found this post while looking for a way of doing this on a Mac. I'm currently trying this on a Mac and I'll come back with any steps that are different when/if I get this working.

Post Reply