Electronic Arts MGAV audio variant

Codecs, formats, encoding/decoding of game audio, video and music
BloodRaynare
Posts: 367
Joined: Fri Mar 10, 2017 7:23 am

Electronic Arts MGAV audio variant

Post by BloodRaynare »

Can anyone help me to remove the chunks from MGAV audio used by EA in some of their games to become playable PlayStation ADPCM?

Here's the sample file (it's from NASCAR Rumble, MGAV variant)

MENU.zip


(note: the filenames and extension were made up by me. I'm actually extracted the files from the game's TRK archive with hex editor.)

the MGAV structure I gathered so far from opening them in Hex editor:

0x00 - 0x3F = file header

data starts at 0x40 (Actually it's just a normal PlayStation ADPCM).

each 0x5F80 of the data there's a chunk with string "LLIF". the first chunk (offset 0x5FC0) has a size of 0x5C, then the rest of chunks was 0x80, and then at the end of the file there's another chunk sized 0x64.
mauzerX
Posts: 7
Joined: Tue Mar 14, 2017 5:06 am

Re: Electronic Arts MGAV audio variant

Post by mauzerX »

1)QuickBMS script “gen_split.bms" by Alpha23(extract)
------------------------------------
Note: edit script with
math SEARCH += 4 .... FindLoc SIZE string "MGAV" 0 ""

2)delete files *._ with small size

3)VGM tool box (cut audio)
---------------------------
Note: Go to Misc.Tools->Extraction Tools->Generic ->Simple Cutter
Batch Mode:+
Start Adress: 12
Lenght: 24448
Output File Extension: .MIB
End of File(EOF):+
Source Files: muscuts(MGAV)

This my tutorial for Freekstyle (PS2) [SLUS-20367],m.b. will help you.
QuickBMS script “gen_split.bms"(extract)
------------------------------------
Note: edit script with math SEARCH += 4 .... FindLoc SIZE string "MGAV" 0 ""
DEV\\SXDATA\AV\ALL.AV - soundpack
DEV\\SXDATA\OPENING\*.FLM - sound in video
Note2: edit script with math SEARCH += 4 .... FindLoc SIZE string "BGAV" 0 ""
DEV\\SXDATA\AV\ALL.AV ->ALL_1._ - speechpack
DEV\\SXDATA\AV\ALL.AV - soundpack
Note3: edit script with math SEARCH += 4 .... FindLoc SIZE string "2GPM" 0 ""
DEV\\SXDATA\OPENING\*.FLM - video
DEV\\SXDATA\ABOUTEA\*.FLM - video

TotalCommander (delete)
------------------------------------
Note: delete files *._ with 16 byte size and file ALL_1._ with 158023744 byte size
DEV\\SXDATA\AV\ALL.AV ->*._ - muscuts(MGAV)
DEV\\SXDATA\*\*.FLM ->*._ - sound in video(MGAV)
DEV\\SXDATA\AV\ALL.AV ->*._ - speech(BGAV)

VGM tool box (cut audio)
----------------------------
Note: Go to Misc.Tools->Extraction Tools->Generic ->Simple Cutter
Batch Mode:+
Start Adress: 0x30
Lenght: 24448
Output File Extension: .MIB
End of File(EOF):+
Source Files: DEV\\SXDATA\AV\ALL.AV ->*._ - muscuts(MGAV)
Source Files: DEV\\SXDATA\*\*.FLM ->*._ - sound in video(MGAV)

TotalCommander (rename audio)
------------------------------------
Note: Select All *.MIB, Go to->Files->Multi-Rename Tool
Rename mask: MUS_[C]
Digits: 4
Start! +
DEV\\SXDATA\AV\ALL.AV ->*._ ->*.MIB - muscuts
DEV\\SXDATA\*\*.FLM ->*._ ->*.MIB - sound in video

TotalCommander (sort audio)
------------------------------------
Note: Go to->Mark->Select Group->Define
Search for: _*\d*[02468]\.mib
RegEx: +
Save: +
Ok +
Ok(Expand selection) +
Note2: after marking .MIB files with 2,4,6,8 numbers, move them to other folder
DEV\\SXDATA\AV\ALL.AV ->*._ ->*.MIB ->MUS_*.MIB - muscuts
DEV\\SXDATA\*\*.FLM ->*._ ->*.MIB ->MUS_*.MIB - sound in video

commandline (clue audio)
------------------------------------
Note: crate batch file with command in each folder:
@echo off
copy /b *.mib 1.bin
pause

DEV\\SXDATA\AV\ALL.AV ->*._ ->*.MIB ->\1folder\MUS_*.MIB - muscuts with 1,3,5,7,9 numbers
DEV\\SXDATA\AV\ALL.AV ->*._ ->*.MIB ->\2folder\MUS_*.MIB - muscuts with 0,2,4,6,8 numbers
DEV\\SXDATA\*\*.FLM ->*._ ->*.MIB ->\1folder\MUS_*.MIB - sound in video with 1,3,5,7,9 numbers
DEV\\SXDATA\*\*.FLM ->*._ ->*.MIB ->\2folder\MUS_*.MIB - sound in video with 0,2,4,6,8 numbers

PS2 VAG interleave value guesser and files extractor 0.1.1(extract audio with adding SS2 header)
-----------------------------------
Note: crate batch file with command:
for %%a in (*.bin) do MKDIR "@%%a"
for %%a in (*.bin) do vagguess.exe -d "@%%a"


OR

for %%a in (*.bin) do MKDIR "@%%a"
for %%a in (*.bin) do vagguess.exe -d "@%%a" -s 22050 "%%a"


OR

for %%a in (*.bin) do MKDIR "@%%a"
for %%a in (*.bin) do vagguess.exe -d "@%%a" -s 22050 -g "%%a"


OR

for %%a in (*.bin) do vagguess.exe -l "%%a"
pause


DEV\\SXDATA\AV\ALL.AV ->*._ ->*.MIB ->\1folder\MUS_*.MIB ->1.BIN - muspack with 1,3,5,7,9 numbers
DEV\\SXDATA\AV\ALL.AV ->*._ ->*.MIB ->\2folder\MUS_*.MIB ->1.BIN - muspack with 0,2,4,6,8 numbers

VGM tool box (create headers for audio)
----------------------------
Note:Go to GENH->Create\Extract GENH
Source Files: DEV\\SXDATA\AV\ALL.AV ->*._ ->*.MIB ->\*folder\MUS_*.MIB ->1.BIN ->*.SS2 - music
Source Files: DEV\\SXDATA\AV\ALL.AV ->*._ ->*.GENH - speech
Source Files: DEV\\SXDATA\AV\ALL.AV ->ALL_1._ ->*.GENH - speech
Source Files: DEV\\SXDATA\*\*.FLM ->*._ ->*.MIB ->\*folder\MUS_*.MIB ->1.BIN - sound in video
Header Skip: 0x28, 0x0
Interleave: from SS2, 0x2fd0, 0x10
Channels: 2, 1
Frequency: 22050, 24000
No Loops: +
Click Create GENHs

in_vgmstream (winamp plugin)(play \ convert to wav)
------------------------------------
DEV\\SXDATA\AV\ALL.AV ->*._ ->*.MIB ->\*folder\MUS_*.MIB ->1.BIN ->*.SS2 - music(PlayStation 4-bit ADPCM: Sshd header)
DEV\\SXDATA\AV\ALL.AV ->*._ ->*.MIB ->\*folder\MUS_*.MIB ->1.BIN ->*.SS2 ->*.GENH - music(PlayStation 4-bit ADPCM: GENH Generic Header)
DEV\\SXDATA\AV\ALL.AV ->*._ ->*.MIB ->\*folder\MUS_*.MIB ->1.BIN ->*.SVAG - music(Playstation 4-bit ADPCM: Konami SVAG header)
DEV\\SXDATA\AV\ALL.AV ->*._ ->*.GENH - speech(PlayStation 4-bit ADPCM: GENH Generic Header)
DEV\\SXDATA\AV\ALL.AV ->ALL_1._ ->*.GENH - speech(PlayStation 4-bit ADPCM: GENH Generic Header)
DEV\\SXDATA\*\*.FLM ->*._ ->*.MIB ->\*folder\MUS_*.MIB ->1.BIN ->*.GENH - sound in video(PlayStation 4-bit ADPCM: GENH Generic Header)
frequency: 32000, 22050, 24000
Interleave: MIB, 0x2fd0
Channels: 2, 1

VGM tool box (cut video)
----------------------------
Note: Go to Misc.Tools->Extraction Tools->Generic ->Simple Cutter
Batch Mode:+
Start Adress: 0x40
Lenght: 4032
Output File Extension: .MIB
End of File(EOF):+
Source Files: DEV\\SXDATA\ABOUTEA\*.FLM ->*._ - videocuts(2GPM)
Source Files: DEV\\SXDATA\OPENING\*.FLM ->*._ - videocuts(2GPM)

TotalCommander (rename video)
------------------------------------
Note: Select All *.MIB, Go to->Files->Multi-Rename Tool
Rename mask: VID_[C]
Digits: 4
Start! +
DEV\\SXDATA\ABOUTEA\*.FLM ->*._ ->*.MIB - videocuts
DEV\\SXDATA\OPENING\*.FLM ->*._ ->*.MIB - videocuts

commandline (clue video)
------------------------------------
Note: crate batch file with command:
@echo off
copy /b *.mib 1.m2v
pause
DEV\\SXDATA\ABOUTEA\*.FLM ->*._ ->*.MIB ->VID_*.MIB - videocuts
DEV\\SXDATA\OPENING\*.FLM ->*._ ->*.MIB ->VID_*.MIB - videocuts

Media Player Classic HC
--------------------------------------------
DEV\\SXDATA\ABOUTEA\*.FLM ->*._ ->*.MIB ->VID_*.MIB ->*.M2V - video(Video: MPEG2 Video 512x448 29.97fps 6144kbps)
DEV\\SXDATA\OPENING\*.FLM ->*._ ->*.MIB ->VID_*.MIB ->*.M2V - video(Video: MPEG2 Video 512x448 29.97fps 6144kbps)
BloodRaynare
Posts: 367
Joined: Fri Mar 10, 2017 7:23 am

Re: Electronic Arts MGAV audio variant

Post by BloodRaynare »

Thanks for the solution (By the way, I have a quicker way to do it.)

1. Extract the chunks with gen_split.bms script
2. Cut the 24448 bytes (offset 0xC - 0x5F8B) for each chunks with vgmtoolbox.
3. Then concatenate those cutted chunks with HxD Hex Editor's concatenate feature
4. create the genh with VGMToolbox with these settings:
Format: PlayStation 4-bit ADPCM
Headerskip: Leave it blank
Channels: 2
Frequency: 14250 (PSX EA games which used that format usually using this frequency, well it's my guesses after all)
Interleave: 0x2FC0
Loops: No Loops
BloodRaynare
Posts: 367
Joined: Fri Mar 10, 2017 7:23 am

Re: Electronic Arts MGAV audio variant

Post by BloodRaynare »

Solved. It's been playable directly with the current version of vgmstream without need to convert it to another format.