"noscan" Still Scans All Drives

The place to discuss linux version of MakeMKV
Post Reply
zeroryouko
Posts: 10
Joined: Wed Jan 24, 2018 8:13 pm

"noscan" Still Scans All Drives

Post by zeroryouko » Sat Oct 19, 2024 9:08 pm

I am using MakeMKV + ddrescue to rescue a bunch of bad Bluray and DVD discs, and I am trying to setup a shell script to help automate this process. I'm using MakeMKV 1.17.8 on Linux Mint 22.

The first step is generally to "bless" the drive after a new disc is inserted, and for this I would like to run "makemkvcon --noscan info dev:/dev/sr#" where # is the actual drive I would like to use. This works...eventually, but takes a very long time to complete, because even with the --noscan option makemkvcon seems to still, in fact, scan all the drives, even though a specific device is specified e.g. dev:/dev/sr1 on the command line.

Since I have 7 drives of various brands and models, this means that startup can take a *very* long time, especially if I am running ddrescue or even MakeMKV concurrently on the other drives (particularly if one of the drives is reading a bad area and generating errors, and makemkvcon has to wait for the drive to timeout reading each bad sector to get a response). I would really love it if the --noscan option simply ignored the other drives and focused on the one I specified, but either it's not working right, or I'm doing something wrong. Can someone please suggest what I might be doing wrong and how to correct this, or confirm that this is either a bug or intended functionality?

Starting up the gui "makemkv" also takes a long time to start up under this scenario, but if I leave it running, it doesn't seem to incur this penalty even if I switch discs.

In addition to this, there is still one step I have to do manually, and that is to make an encrypted backup of the disc, but cancel it before it gets to ripping all the m2ts files (because ddrescue will do the bulk of the ripping so it's just wasted time). Actually I'm not sure how much of the backup I really need; I know I need discatt.dat but I'm not sure if I need any of the other files or if the ddrescue rip will suffice for those. So far I see no way to automate this (at least, the part about interrupting the backup). Not sure if anyone else has tried this and might have some suggestions.

Thank you in advance!

Woodstock
Posts: 10332
Joined: Sun Jul 24, 2011 11:21 pm

Re: "noscan" Still Scans All Drives

Post by Woodstock » Sat Oct 19, 2024 9:44 pm

Just checking that you've set MakeMKV to ask which drives to use each time it starts, and set up one copy for each drive, so that delays for particular drives only apply to that copy of MakeMKV?

In general, if you're starting the GUI, it will try to access every drive detected, which will slow things down. The non-GUI shouldn't do that, because it will get the drive to search from the command line. If there is a disk already in the drive, I don't know what --noscan would be used for, though.

flojo
Posts: 109
Joined: Thu Jun 22, 2023 4:27 am
Location: El Paso

Re: "noscan" Still Scans All Drives

Post by flojo » Sun Oct 20, 2024 12:54 am

I assume you're doing this because makemkvcon bails out on the first error? I did have success 1 time by using Dolphin to copy a disc then decrypt it, where as makemkvcon would always fail with the disc, so there is some merit to doing it this way.

"noscan" doesn't stop the probing of the all the drives, however, if you're specifying an exact drive and it still scans other drives, that seems like a bug. It might be faster to do something like have root exclusively claim the other devices while this scan operation happens, maybe makemkvcon failing due to permissions would be faster. If the other 6 drives are in use, then maybe have 6 VM's to use for ripping? Somehow you should be able to work around this problem.

Why are you using the GUi at all? We're you just checking if this problem was repeatable in the GUi?

I don't think determining how much you need is advantageous being that you probably want every unique file in BDMV/STREAM/*, which is basically 99% of the data. Everything else will copy in seconds, and from there it really is zero-sum in whether or not you can successfully rip. If it fails ripping the big files, the main movie, you might stop it. But if it fails copying little non-media files, I doubt you'll stop it, so just let it rip.

zeroryouko
Posts: 10
Joined: Wed Jan 24, 2018 8:13 pm

Re: "noscan" Still Scans All Drives

Post by zeroryouko » Sun Oct 20, 2024 1:30 am

So basically when ripping a bad Bluray, the procedure I found on this forum - which does work, I've used it many times - is to use either the GUI or the command line to start an unencrypted backup of the disc, and interrupt it when it starts ripping the larger m2ts files. By this point MakeMKV has ripped the data it needs to unencrypt the disc, but not most of the actual video data. After closing MakeMKV, eject and reinsert the disc. Let's call all of that "step 1".

Then in step 2, first "bless" the drive by either opening the disc in the MakeMKV GUI, or running makemkvcon info dev:/dev/sr#. I don't know why this is necessary but some discs seem to not work without it. Then ddrescue is used to rip a raw, fully encrypted ISO file from the disc. ddrescue will try the bad sectors again and again, and often if you retry enough times, you can get a good rip. ddrescue also allows a full disc image to be built by reading what you can from one drive, then putting the disc in another drive and trying again, as sometimes what one drive considers to be a bad sector can be read by another make/model of drive. If you have two or more absolutely identical copies of the same disc, ddrescue can also be used to build a full disc image by reading from one copy and trying again to read the bad sectors from a second copy, which hopefully is not bad in the same spot.

At the end you get a full, encrypted ISO of the disc. Then you go into the backup directory you made in step 1 and delete the BDMV directory entirely. Mount your ISO image on say /mnt, and create a symlink from the BDMV directory on the ISO you just mounted, to the step 1 backup directory.

Now use the MakeMKV GUI to open the discatt.dat file in the backup directory. MakeMKV will open this like a regular encrypted disc, and can then be used to rip the relevant title(s) to MKV.

So what I am trying to do is eliminate the use of the GUI and do all of this from a shell script. Step 1 currently seems impossible to do without manually cancelling the backup at the appropriate point. I know this step creates discatt.dat, which ddrescue cannot do, but I'm not sure what else I might need from this step that ddrescue does not cover. If it was just discatt.dat or a few other files, I might be able to figure out a way to have the script kill makemkvcon after that file or files is written.

Step 2, however, should theoretically be possible to automate - the problem is it takes forever and a day to do the "blessing the drive" part, because MakeMKV scans every drive.
Last edited by zeroryouko on Sun Oct 20, 2024 1:36 am, edited 1 time in total.

zeroryouko
Posts: 10
Joined: Wed Jan 24, 2018 8:13 pm

Re: "noscan" Still Scans All Drives

Post by zeroryouko » Sun Oct 20, 2024 1:35 am

Here's some example output:

$ time makemkvcon -r --noscan info dev:/dev/sr6
MSG:1005,0,1,"MakeMKV v1.17.8 linux(x64-release) started","%1 started","MakeMKV v1.17.8 linux(x64-release)"

<1 minute 55 seconds elapsed here>

DRV:0,0,999,0,"BD-RE ASUS BW-16D1HT 3.11 KLSN7EE5620","","/dev/sr6"
DRV:1,0,999,0,"BD-RE HL-DT-ST BD-RE WH12LS38 1.00 K93B6JL2922","","/dev/sr0"
DRV:2,0,999,0,"BD-RE PIONEER BD-RW BDR-212D 1.03 BDDL046481WL","","/dev/sr2"
DRV:3,0,999,0,"DVD+R-DL ASUS DRW-24F1ST d 1.00 K4SH6S84745","","/dev/sr4"
DRV:4,0,999,0,"BD-RE PIONEER BD-RW BDR-212V 1.02 DCDL025827WL","","/dev/sr5"
DRV:5,0,999,0,"DVD+R-DL PLEXTOR PX-891SAF 1.JN 2D8314502882","","/dev/sr3"
DRV:6,0,999,0,"BD-RE HL-DT-ST BD-RE WH16NS60 1.03 M00M5DM1055","","/dev/sr1"
DRV:7,256,999,0,"","",""
DRV:8,256,999,0,"","",""
DRV:9,256,999,0,"","",""
DRV:10,256,999,0,"","",""
DRV:11,256,999,0,"","",""
DRV:12,256,999,0,"","",""
DRV:13,256,999,0,"","",""
DRV:14,256,999,0,"","",""
DRV:15,256,999,0,"","",""
MSG:3007,0,0,"Using direct disc access mode","Using direct disc access mode"
MSG:5085,0,0,"Loaded content hash table, will verify integrity of M2TS files.","Loaded content hash table, will verify integrity of M2TS files."
MSG:3307,0,2,"File 00009.mpls was added as title #0","File %1 was added as title #%2","00009.mpls","0"

<many lines of disc info omitted>

MSG:5011,0,0,"Operation successfully completed","Operation successfully completed"
TCOUNT:12
CINFO:1,6209,"Blu-ray disc"

<more lines of disc info omitted>

SINFO:11,6,42,5088,"( Lossless conversion )"

real 2m52.777s
user 0m2.808s
sys 0m0.574s

flojo
Posts: 109
Joined: Thu Jun 22, 2023 4:27 am
Location: El Paso

Re: "noscan" Still Scans All Drives

Post by flojo » Sun Oct 20, 2024 2:25 am

With the exception of MAKEMKV/CMAP, which I don't know what that is, everything is written before the BDMV/STREAM/* copy operations.

Yeh, if it's taking 2 minutes to get to that point you need to work around that.

If you're really scripting with python, perl, js, etc., then simply capture the stdout and find when it starts to actually rip a stream by parsing one of the printed strings, then abort it with SIGINT (or SIGTERM or whatever) then start ddrescue. Everything _should_ be trivial.

I'd say that "Processing titles" or "Loaded content hash table" are 2 strings to start trying. I see the below in the stdout, and at this point you should be ready to abort:

Code: Select all

# output from ripping a 4K bluray
PRGC:3103,0,"Processing titles"
PRGV:65536,0,65536
MSG:5085,0,0,"Loaded content hash table, will verify integrity of M2TS files.","Loaded content hash table, will verify integrity of M2TS files."
PRGT:5047,0,"Copying all files"

Post Reply