A Rust port of the command line program playing with the cutscenes files (USM) from Genshin Impact.

Overview

GI-cutscenes : Rust Remix

A command line program playing with the cutscene files (USM) from Genshin Impact, reimplemented in Rust.

Much like its original C# implementation by ToaHartor, it is able to demux USM files, decrypt video and audio tracks, convert HCA files to WAV, convert SRT subtitles into ASS and merge all of these files into a single MKV file.

(note: the subtitle system is not ready yet)

In order to translate cutscenes of 2.7 check out the versions.json file provided by ToaHartor.

This implementation depends on ffmpeg being installed on the system (for now). We are working on being able to merge the different formats ourselves, but this is not yet operational.

Commits are typically verified with GPG key E30568E404157F2A932071532C5FA04C19678729. You can get it with

curl -L https://vulpinecitrus.info/Lymkwi.gpg.txt | gpg --import -

You can then verify release signatures using that key :

gpg --verify <release-file> <release-sig>.asc

Usage

You can simply call the program and provide it top-level arguments, a subcommand, and sub-command arguments.

TL;DR at the bottom.

The available top-level arguments are :

  • -o/--output : Outfile file or folder
  • -V/--version : Print version information
  • -h/--help : Print help information
  • --no-cleanup : Do not remove the extracted files after conversion/merging

The subcommands are :

  • demuxUsm : Demux a single USM file. Its arguments are :
    • -a/--key1 : the 4 lower bytes of the decryption key (hexadecimal)
    • -b/--key2 : the 4 higher bytes of the encryption key (hexadecimal)
    • -f/--demux-file : Path to the file to be demuxed
    • -k/--version-keys : Path to the versions.json file (defaults to ./versions.json)
    • -m/--merge : Flag to indicate we wish to merge the output IVF, WAV and ASS into a MKV container
    • -p/--merge-program : Path to the FFMpeg merge program (defaults to ffmpeg)
    • -s/--subtitles : Flag to indicate we want to add the subtitles to the MKV file
  • batchDemux : Demux a whole folder of USM files. Arguments are :
    • -u/--usm-folder : Path to the folder containing USM files
    • -k/--version-keys : Path to the versions.json file (defaults to ./versions.json)
    • -m/--merge : Flag to indicate we wish to merge the output IVF, WAV and ASS into a MKV container
    • -p/--merge-program : Path to the FFMpeg merge program (defaults to ffmpeg)
    • -s/--subtitles : Flag to indicate we want to add the subtitles to the MKV file
  • convertHca : Convert a HCA file to WAV
    • -i/--hca-input : Path to the input HCA file
    • -a/--key1 : the 4 lower bytes of the decryption key (hexadecimal)
    • -b/--key2 : the 4 higher bytes of the encryption key (hexadecimal)
    • -k/--version-keys : Path to the versions.json file (defaults to ./versions.json)
    • -n/--base-name : Base name to look for in the versions.json file to find keys

TL;DR

Here are the most common commands :

Demux a given cutscene

./gi-cutscenes-rs -o battlePass.mkv demuxUsm -m -f battlePass.usm -k ./versions.json

Demux a batch of cutscenes

./gi-cutscenes-rs -o cutscene-output batchDemux -m -u usm-files/ -k versions.json

Convert a HCA file to WAV

./gi-cutscenes-rs -o battlePass_0.wav convertHca -n battlePass -i battlePass_0.hca

Build & Install

This implementation is written in Rust for speed and efficiency. It can be built with cargo using :

cargo build --release

And installed in your cargo folder using :

cargo install --path .

External Requirements

While we aim to be able to only depend on the standard Rust library, and a crate here and there (notably clap), there is no crate suitable to let us manually merge the IVF, WAV and ASS files into a MKV. As such, we depend on ffmpeg for this.

While the original C# implementation of this tool relied on MKVMerge from the MKVToolNix suite, we figured ffmpeg would be better suited and more flexible.

It can be installed on

  • Windows using GyanDev's builds
  • Linux using your favourite package manager
  • MacOS
  • just about anything where you can compile the source code (I've heard people put it on embedded hardware, it's not that hard)

As soon as it is built, either the path to its binary is added in your path variable, or you can supply it using the -p/--merge-program argument described above.

Roadmap

  • Full pipeline of USM to (HCA + IVF) to (WAV + IVF) to MKV
  • Batch demux
  • Single HCA to WAV file
  • Merging of sub files (obtainable in Dimbreath's repository)

License

Just as the original, this is released under GPL 3.0.

Acknowledgements

I would like to thank ToaHartor for his commitment to understanding the encryption system used in Genshin Impact's USM files, as well as the code this implementation is based on.

You might also like...
png_defringe_rs is a port of Immorpher's PNG Defringe program written in Rust to achieve easier installation and faster performance.

png_defringe_rs png_defringe_rs is a port of Immorpher's PNG Defringe program written in Rust to achieve easier installation and faster performance. U

Command line tool to extract various data from Blender .blend files

blendtool Command line tool to extract various data from Blender .blend files. Currently supports dumping Eevee irradiance volumes to .dds, new featur

fixred is a command line utility to fix outdated links in files with redirect URLs.
fixred is a command line utility to fix outdated links in files with redirect URLs.

fixred fixred is a command line utility to fix outdated links in files with redirect URLs. Installation fixred is installed via cargo package manager.

 apkeep - A command-line tool for downloading APK files from various sources
apkeep - A command-line tool for downloading APK files from various sources

apkeep - A command-line tool for downloading APK files from various sources Installation Precompiled binaries for apkeep on various platforms can be d

RnR is a command-line tool to securely rename multiple files and directories that supports regular expressions
RnR is a command-line tool to securely rename multiple files and directories that supports regular expressions

RnR is a command-line tool to securely rename multiple files and directories that supports regular expressions. Features Batch rename files and direct

Anglosaxon is a command line tool to parse XML files using SAX
Anglosaxon is a command line tool to parse XML files using SAX

anglosaxon - Convert large XML files to other formats anglosaxon is a command line tool to parse XML files using SAX. You can do simple transformation

🍅 A command-line tool to get and set values in toml files while preserving comments and formatting

tomato Get, set, and delete values in TOML files while preserving comments and formatting. That's it. That's the feature set. I wrote tomato to satisf

Command line tool for editing .ini files

Edit-ini Command line tool for editing .ini files Usage Usage: edit-ini [OPTIONS] Options: -i, --input file Input file to read f

rsv is a command line tool to deal with small and big CSV, TXT, EXCEL files (especially 10G)

csv, excel toolkit written in Rust rsv is a command line tool to deal with small and big CSV, TXT, EXCEL files (especially 10G). rsv has following fe

Releases(v0.1.0)
Owner
Lymkwi
Software engineering student. Former Systems & Networks administrator for @InsaLan . Messing around in layer 3 since 2014
Lymkwi
A command line tool for playing with color gradients

gradient A command-line tool for playing with color gradients. Features Lots of preset gradients. Custom gradient. Read gradients from SVG & GIMP grad

Nor Khasyatillah 96 Dec 28, 2022
Small command-line tool to switch monitor inputs from command line

swmon Small command-line tool to switch monitor inputs from command line Installation git clone https://github.com/cr1901/swmon cargo install --path .

William D. Jones 5 Aug 20, 2022
This is a command line port of the game Wordle in Rust

Wordle.rs Welcome to Wordle.rs! This is a command line port of the game Wordle in Rust. I built this in order to get more familiar with programming in

Brock Herion 5 Apr 8, 2022
A cli utility for playing music mixes for programming & focus from musicforprogramming.net

mfp: music for programming A command-line utility for playing music mixes for programming & focus (from musicforprogramming.net), unlocking the flow s

Rohit Gupta 10 Jul 12, 2023
A command-line tool to easily kill processes running on a specified port.

killport killport is a command-line utility for killing processes listening on specific ports. It's designed to be simple, fast, and effective. The to

Francisco Jiménez Cabrera 6 Mar 29, 2023
A silly program written in Rust to output nonsensical sentences in the command line interface.

A silly program written in Rust to output nonsensical sentences in the command line interface.

Rachael Ava 1 Dec 13, 2021
A simple command-line calculator program writen with Rust.

Calculator.rs An simple command-line calculator program writen with Rust. Features Math functions support > sin(1) = 0.84147098 Variable support > a

BHznJNs 33 Apr 8, 2023
Command-Line program that takes images and produces the copy of the image with a thin frame and palette made of the 10 most frequent colors.

paleatra v.0.0.1 Command-Line program that takes an image and produces the copy of the image with a thin frame and palette made of the 10 most frequen

Beka Modebadze 24 Dec 29, 2022
Command-line program to manage PS battle logs. WIP.

psbattletools psbattletools is a command-line tool written in Rust for manipulating Pokémon Showdown battle logs. Installation psbattletools currently

Annika 2 Dec 27, 2022
A simple command line program to upload file or directory to web3.storage with optional encryption and compression

w3s-cli A simple command line program to upload file or directory to web3.storage with optional encryption and compression. Features Uploads single fi

qdwang 5 Oct 22, 2022