Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.


Go Back   Doom9's Forum > General > Decrypting

Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 20th August 2016, 21:45   #1  |  Link
Registered User
Join Date: Dec 2013
Posts: 402
BlurayTestAndDecrypt - tool to test bluray files and remove AACS

Created another small tool mainly for my personal needs, but enhanced it a little bit because of @Hironimo s question for a tool to decrypt m2ts files.

In short:
  • can be used to check if a bluray m2ts or bluray iso file is damaged or not
  • can be used to remove aacs protection from a bluray m2ts or bluray iso file in case the VUK is available in the keydb.cfg file
  • can repair BD+ protection damages in case a fixuptable is provided
  • can dump/rip discs and check the final is for errors

I've >1000 DVDs in my collection and also >100 Blurays but simply no space in the living rooms - so I decided to rip them all to harddisk and store the discs in the basement. Unfortunately not all rips are 100% correct - I noticed problems during the playback for a few of them and so I started this tool to verify if the iso created from a bluray has errors or not.

This is now 'Mode 1' in the tool. When I copied the decrypt-procedures from FindVUK into this tool I created the other 3 modes.

# Mode 1 - Simple Test
Each m2ts file on a bluray can be sliced into units of 6144 bytes length and the first 16 bytes of each unit are always unprotected and can be used to check 2 details.
In case the 'copy permission indicator' is set to 'unit encrypted': is the mpg-ts-synchronisation-byte of the first mpg-block correct? (this is byte 5 of each unit and has to be 0x47)
And in case it is not protected: check if all synchronisation-bytes are set correctly (unit is further sliced into mpg-transport-packets of 192bytes length) and the synchronisation byte for each packet is verified.

This mode is the fastest test mode and does not require a VUK for the bluray! (but it cannot detect all defective units in encrypted files)

>> this test takes ~3 Min for an encrypted bluray iso read from my internal SSD (it detects 491 error-units in my damaged test-iso file)

# Mode 2 - Test incl. decryption of each encrypted unit
performs the same tests as before and additionally checks if each encrypted unit can be correctly decrypted with VUK (read from keydb.cfg) (>> all synchronisation bytes are set correctly after decryption)

This mode requires a VUK in the local keydb.cfg file for the disc!

>> this test takes ~7 Min for an encrypted bluray iso read from my internal SSD (it detects 514 error-units in my damaged test-iso file)

# Mode 3 - Decrypt but stop on error
Basically the same as Mode 2 - but this time all decrypted units are written to disc but it stops in case a defective unit is encountered.

# Mode 4 - Decrypt but continue on error
Identical to Mode 3 with the small difference that it continues in case of an error (but only successfully decoded units are written to the destination file)

# Mode 5 - ISO2ISO or ISO-Inplace Decrypt (decrypts AACS and repairs BD+)
New mode introduced with 0.41 (ISO-Inplace since 0.61) - complete disc structure remains unchanged!

# Mode 6 - List UnitKeys
New mode introduced with 0.48 - the correct unit keys for all files are listed (nothing get's decrypted - just an info mode)

# Mode 7 - Dump disc and test final iso file for errors
New mode introduced with 0.62

To use it simply drag one of the supported items on the exe-File:
  • m2ts File
  • ISO File
  • a drive letter with a bluray

A few settings can be set in an ini-file, the most important ones are:
  • AlwaysAskMode >> if set to 1 you get always the menu to select the desired mode, if set to 0 the previous mode is used
  • AlwaysAskDest >> if set to 1 you'll always have to choose the destination directory, if set to 0 the previous destination directory is used

And now a few words about the BD+ repair feature:
Basically BD+ introduces damages to the video files and usually all the BD+ fuzz is to get hands on the fixup-table to repair those damages.
libbdplus stopped working a long time ago - so at the moment there's no 'open source' way to get hands on fixup tables - but there are commercial applications that help us in this case
Pavtube BdMagic is the tool of my choice (honestly I haven't found it myself - got a hint from another member here in the forum - so kudos to him! ) - if you need a table for a disc just start the tool, open the disc and it downloads the table for this and stores it in your userfolder.
BTD now scans all available tables and in case it finds one that matches the current disc if converts it into the 'open source' convtab format and stores the converted table in the directory userfolder\appdata\roaming\bdplus\convtab
You can view those tables with 'ConvTableView' if you're interested.
In case you don't need the Pavtube application for something else, you can set the ini value 'DeletePavtubeTableAfterConversion' to 1 so the source table is always deleted after the conversion to the convtab format.
But be aware that Pavtube is sometimes wrong - I've one disc in my collection were it downloads a fixup table that does not belong to the disc... so usually it's working fine, but sometimes it fails.

Finally the video files are correctly playable - but it's possible that the BD-J menu is not working. Usually the BD+ VM and the BD-J menu interact with each other - and in case the BD+ VM isn't running at all, the menu doesn't load at all (e.g. on the disc 'Hitman' I get a message that my player needs a firmware update - but the original disc plays without problems and in case I'll remove all protections with the fox it's also working as expected - but in this the JAR files of the menu are completely different in comparison to the original files, so this is nothing that can be done easily and will never be part of BTD

History of the tool:
20160820 .. 0.18 First public release

20160821 .. 0.20
  • FIX: endless loop when multiple files are dragged on the exe
  • FIX: do not write a single logline for each defective unit
  • FIX: MemoryLeak in 'AACS_DecryptUnit'
  • CHANGE: added OnError support (provides useful details in case of a crash)
  • FEATURE: rename ISO file depending on result (either add (OK) or (ERR) to file) - can be enabled in ini-file
  • FIX: crash in case a file already starts with a completely empty unit

20161030 .. 0.41
  • FEATURE: ISO files can be read directly virtual drive not necessary any longer
  • FEATURE: ISO2ISO decryption possible (complete disc structure remains unchanged, only AACS and BD+ are decrypted/repaired)
  • FEATURE: BD+ repair with fixuptables
  • CHANGE: ini parameters to define if mode selection is always possible
  • CHANGE: ini parameters to define if input of destination folder is always possible
  • CHANGE: new ini parameter to define if pavtube bd+ tables should get deleted after conversion to convtab format
  • CHANGE: new bdplus-convtab path: "?FOLDERID_RoamingAppData?\bdplus\convtab" (because \bdplus\ is already used by libbdplus)
  • FIX: crash in case the file disappears (e.g. unmount of iso)
  • FIX: error in case an unprotected iso should be checked - now the AACS values are only initialized in case an AACS folder can be found on the disc

20161110 .. 0.42
  • FIX: check if the outputdir has a \ at the end (stupid error - already implemented check never did something useful - fixed it now )
  • FIX: take care that 1) correct and 2) identical outputdir/file are used for aacs and bd+ processing

20161111 .. 0.43
  • FIX: drive mode didn't work at all (wrong destination file used - now the name of the destination file is also written to logfile in case it fails)

20161111 .. 0.47
  • FIX: error processing unencrypted m2ts files
  • FEATURE: get BD+ fixuptables from leawo blurayplayer
  • FEATURE: read also mediakey+volumeid or unitkeys from keydb.cfg file
  • CHANGE: rewrite of logging engine (and splitting 90% of the source into separate modules for easier maintenance)

20170121 .. 0.48
  • FIX: removed preceding whitespace in loglevelprefix for logoutput
  • CHANGE: settings module integrated
  • CHANGE: new mode - list correct unit keys for files
  • CHANGE: changed to console-mode
  • CHANGE: added icon

20170203 .. 0.51
  • CHANGE: new ini parameter to decide if destination file should be deleted in case of an error
  • BUGFIX: now rename of directories in ISO is working again
  • BUGFIX: TestSimple repaired
  • CHANGE: Continue in case of an error in TestAdvanced Mode
  • CHANGE: after testing in TestSimple mode, rename to OK_SIMPLE or ERR_SIMPLE
  • CHANGE: less output in console window for test-modes in DRIVE mode (is now identical to ISO mode)

20170228 .. 0.53
  • BUGFIX: Updated UDF module
  • CHANGE: Progress Display in Title

20170302 .. 0.54
  • CHANGE: also support bluray file copies in folders

20180130 .. 0.61
  • BUGFIX: removed additional empty block (2KB) at the end of an iso2iso decryption
  • BUGFIX: AlwaysAskDest now also works in 'drive' mode
  • FEATURE: alternative aacs keydb file can be specified in ini file
  • FEATURE: Support Undo Files created during BD+ repair (to reverse the repair in case the BD+-FUT file is faulty)
  • FEATURE: massive speedboost due to internal changes and switch to libgcrypt aes library
  • CHANGE: small udf support enhancement
  • FEATURE: new undo-module
  • FEATURE: iso files now also support to skip AACS decryption and carry on with BD+ and PlaylistObfuscation detection
  • FEATURE: iso mount now supported with native windows-iso support in Windows8 and later
  • BUGFIX: Leawo BD+ table are correctly converted now
  • BUGFIX: PlOb correction should work now (untested)
  • BUGFIX: error in case an unencrypted file is reached in mode 4 - DecryptISO2ISO
  • BUGFIX: open ISO file in write mode to allow correction in mode 9 (correct playlist obfuscation)
  • BUGFIX: removed automatic switch to inplace decryption for ISO2ISO in case destination file already exists
  • BUGFIX: calculation of progress for iso files corrected
  • FEATURE: request acknowledge from user for InPlace decryption
  • BUGFIX: do not ask for destination directory in case InPlace decryption is requested

20180319 .. BTAD 0.62
  • BUGFIX: udf implementation ignored 'ImplementationUse' -> failed to parse disc 'RED_BIRD_2D_F2'
  • FEATURE: mode 'Dump and Test' to rip discs from drive and test the resulting ISO file

20180321 .. BTAD 0.63
  • BUGFIX: udf implementation ignored 'ImplementationUse' (also fixed in 2nd location _UDF_readwriteFileIdentifierDescriptor )

20180324 .. BTAD 0.64
  • BUGFIX: udf implementation ignored 'ImplementationUse' (also fixed in 3rd location BRUDF_File_Rename )

20181015 .. BTAD 0.70
  • CHANGE: new keydb-module
  • BUGFIX: udf implementation
  • CHANGE: required changes for changed aacs module
  • FEATURE: simple test for DVD VOB files
  • FEATURE: test of DVD-ISO files (only if DVD filesystem is valid - if files in directory \VIDEO_TS are identical in ISO9660 and UDF filesystem and also check if .IFO and .BUP files have identical size)
  • BUGFIX: udf implementation (do not write error in case an entry does not have allocation extents)
  • BUGFIX: correctly determine old scan result in case it has been 'ERR_Simple' (do not rename again .. )

20191212 .. BTAD 0.77
  • FEATURE: added test-filesystem mode for bluray isos (to check if there's an ISO9660 filesystem available)
  • FIX: memory leak in drive_ms
  • FIX: correctly calculate UnitKeys when decrypting UDF ISO files
  • FIX: alloc mem error corrected when dumping drive to iso
  • FIX: crash after dump/before validation
  • FIX: error renaming AACS to BTD! after iso2iso decoding
  • FEATURE: add progress to title when dumping drive

20200420 .. Download BTAD 0.79
  • FIX: invalid memory access when trying to decode BD+ protected discs
  • FIX: open keydb-file in shared readonly mode

Last edited by nalor; 7th October 2020 at 21:00. Reason: Release 0.79
nalor is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 06:55.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.