Touhou Cannonball .mv video file

Codecs, formats, encoding/decoding of game audio, video and music
Genoard
Posts: 4
Joined: Tue Oct 08, 2019 7:50 pm

Touhou Cannonball .mv video file

Post by Genoard »

I initially wanted to post here hoping to receive an advice on extracting a video file, but in the process of writing my message i have discovered that the decryption key for the game in question have been made public, which led me to successful extraction of the the needed file. However, for the sake of those who might potentially run into the same issues i did, i am posting my original message as well as further steps i've performed.

Original message wrote:Hello. Lately i've taken interest in extracting intro videos of japanese video games. I've had a number of successes following the guides and using the tools i've found online and managed to successfully get the video out of few games on Android, Unreal Engine 4 and some fighting games. But, having no prior experience in data mining, i've hit a wall with one case and hope somebody can help me with this.

The video i am trying to extract is in .mv format of a recently released Touhou Cannonball game for Android. Here's what i tried:

1. Feeding the file to VGMToolbox' Video Demultiplexer using "USM (CRI Movie 2)" setting (all other games on Android that i've checked used this one). The output was two files: first in .m2v format, second in .bin. Opening the .m2v file in video player showed just a black screen with no sound, however MediaInfo was able to read the video parameters such as resolution, bitrate, framerate, aspect ratio and others. I tried opening .bin file in Hex editor, but couldn't see anything useful there.

2. Then i opened the original .mv file in a hex editor. There, 2 words stood out for me: CRID and CRIUSF_DIR_STREAM. I looked it up on the search engine and discovered the "CRI USM Decrypter" tool, so next i fed the file to it and got three files in the output: .m2v ; .wav ; .ini. This time the .m2v file managed to play but appeared very corrupted- almost all of the video was just plain green colour. The .wav appeared to be 0 bytes in size and completely empty. The .ini file contained what appears to be the structure of the original file with multiple parameters under headers like "CRIUSF_DIR_STREAM", "VIDEO_HDRINFO", "AUDIO_HDRINFO", "VIDEO_SEEKINFO" and "AUDIO_HEADER". I've attached this file.


3. Seeing how the description of the tool and various guides about extracting files from mobile games mentioned the decryption keys, i've looked for them online and found them just as i was initially writing this post (thank you hca_keys.h maintainers). i then applied the decryption key to the same process as step 2 (the tool actually asks you for decryption key but i just skipped that step before) and this time the playback of the output .m2v file was successful! However, the output .wav file is still 0 bytes in size, and the .m2v contains only video, not the audio.

4. Looking back at the output i got from step 1 i made an assumption that the .bin file might in fact be the audio i am missing. Сonsidering what i've read about common Android game's audio file formats and processing them, i changed that file's extension to .hca and processed it with another tool- DereTore, applying the discovered decryption key once again. To my surprise, it have successfully output a readable .wav file containing the matching audio for the video i strived to extract.

So, that's it. Hoping whoever might find this information useful will find it.

TL;DR (sort of):
  1. Process the .mv file with CRI USM Decrypter using the decryption key: use Decryption.bat on your file, when it asks for decryption key, enter the hexadecimal value. As of the process of acquiring said keys, i've no idea but to look up "hca_keys.h"- it might contain the needed one. In the output you should get the "%FILENAME%.demux" folder containing the decrypted .m2v video.
  2. Process the .mv file with VGMToolbox's Video Demultiplexer (located at VGMToolbox->Misc. Tools->Stream Tools): Select "USM (CRI Movie 2)" in Format field and input the .mv file. In the output you should get 2 files: .m2v and .bin
  3. Change .bin file's resolution to .hca and process it with DereTore tool's hca2wav.exe, inputting the aforementioned decryption key as -a and -b parameters (input the first 8 hex digits of key for -b parameter and the last 8 hex digits of key for -a parameter). In the output you should get a decrypted .wav audio file.
Eleiyas
Posts: 12
Joined: Tue Dec 22, 2020 8:02 pm

Re: Touhou Cannonball .mv video file

Post by Eleiyas »

I can't find that CRI USM Decrypter anywhere.... :/ any chance you still have it OP?
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: Touhou Cannonball .mv video file

Post by spiritovod »

@Eleiyas: It seems original version is outdated, there is mod from bnnm with some fixes and additional parameters.
Eleiyas
Posts: 12
Joined: Tue Dec 22, 2020 8:02 pm

Re: Touhou Cannonball .mv video file

Post by Eleiyas »

spiritovod wrote:@Eleiyas: It seems original version is outdated, there is mod from bnnm with some fixes and additional parameters.


you're a star!

now I just need to understand this hex techno-babble of 0x140 and repeating 0x20 to try and figure out where the keys are >.<