Skip to content

Instantly share code, notes, and snippets.

@squaresmile
Last active January 27, 2024 03:30
Show Gist options
  • Save squaresmile/d2bb08da3578234ee6f9d205868f71bb to your computer and use it in GitHub Desktop.
Save squaresmile/d2bb08da3578234ee6f9d205868f71bb to your computer and use it in GitHub Desktop.
Extract the video file from Criware .usm file
$key_b = ""
$key_a = ""
Get-ChildItem | ForEach-Object {
if ($_.Extension -eq ".usm") {
$VideoName = $_.BaseName
$AudioFiles = Get-ChildItem -Filter "$($VideoName)*.bin"
if ($AudioFiles -ne $null) {
$AudioFile = $AudioFiles | Select-Object -First 1
crid_mod.exe -b $key_b -a $key_a -v $_.Name
$m2v = "$($VideoName).m2v"
hca2wav.exe -b $key_b -a $key_a $AudioFile.Name
$wav = "$($AudioFile.BaseName).wav"
ffmpeg -y -i $m2v -i $wav -c:v copy -c:a aac -b:a 128k "$($VideoName).mp4"
Remove-Item $m2v
Remove-Item $wav
Remove-Item $AudioFile
}
}
}
@squaresmile
Copy link
Author

Requires extracted HCA audio files in the same folder from VGMToolbox: Misc. Tools > Stream Tools > Video Demultiplexer > USM (CRI Movie 2) / Extract Audio Only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment