Jump to content

Recommended Posts

Posted (edited)

I need some help. In general, I need help extracting audio from the Spider-Man: Shattered Dimensions game(Streams.dat file). I'm trying to figure out how to do this, maybe someone can suggest some tools or programs that will help extract game audio clips and sounds from this file.

Edited by Kelain
Marked the platform for the game
Posted
On 7/16/2025 at 1:57 AM, Hazza12555 said:

I found something similar, but it won't work because as the author says, "The script is for who wants to work on the format and how to read the raw data, NOT for extraction." But maybe this script can somehow be changed to suit the task that I need and make it extract?

https://web.archive.org/web/20230429100701fw_/https://zenhax.com/viewtopic.php?f=9&t=3335

  • Engineers
Posted

Is that file Streams.dat complete? Coz I see some offsets exceeding total file size. Anyway I was able to play some of raw data in Audacity.

Posted
45 minutes ago, h3x3r said:

Is that file Streams.dat complete? Coz I see some offsets exceeding total file size. Anyway I was able to play some of raw data in Audacity.

This is one of the files in which audio fragments are stored, there are three of them in total. I threw one off for an example.
 

изображение.png

Posted
55 minutes ago, h3x3r said:

Is that file Streams.dat complete? Coz I see some offsets exceeding total file size. Anyway I was able to play some of raw data in Audacity.

Will it be possible to create a script for BMS so that it can manually extract audio materials from these files, or only manually if?

  • Engineers
Posted

Well, send all streams i will look at it. I believe that rest of streams are raw data. First streams include TOC + raw data.

  • Engineers
Posted

All right. So here's some info. Most of streams are with unknown compression and I don't know which. This template prints some info. Check Output tab.

Firts of all. Create bat file and put this text to it and save.

copy /b Streams.dat + Streams1.dat + Streams2.dat + Streams3.dat Streams_all.dat

Then put the bat file next to the streams and run. It will create one Streams_all.dat

Then you can use 010 Editor Template on on it.

//------------------------------------------------
//--- 010 Editor v14.0 Binary Template
//
//      File: 
//   Authors: 
//   Version: 
//   Purpose: 
//  Category: 
// File Mask: 
//  ID Bytes: 
//   History: 
//------------------------------------------------
LittleEndian();OutputPaneClear();

local uint32 i,j,TotalFileSize=FileSize();

uint32 Sign;
uint32 UnkTableIndex;
uint32 LangResourceIndex;
uint32 LangIndex;
uint32 Unknown_0;
uint32 Unknown_1;
uint32 Unknown_2;
uint32 Unknown_3;
uint32 Unknown_4;
uint32 Unknown_5;
uint32 Unknown_6;

struct
{
    uint32 Unknown_0;
    uint32 Unknown_1;
    uint32 Unknown_2;
    uint32 Unknown_3;
    uint32 Unknown_4;
}UnkTable[UnkTableIndex];

for (i=0; i < LangIndex; i++)
struct
{
    for (j=0; j < LangResourceIndex; j++)
    struct
    {
        uint32 ResourceName;
        uint32 ResourceSize;
        uint32 ResourceOffset;
        uint32 Unknown_0;
        uint32 Unknown_1;
        uint32 Unknown_2;
        uint32 Unknown_3;
        uint32 FFFFFFFF;
        uint32 Unknown_4;
        float Duration;    //Seconds
        uint32 ResourceInfoSize;
        uint32 Unknown_5;
        uint32 Unknown_6;
        uint32 PaddSize;
        uint32 Unknown_7;  //Not sure but decompressed size maybe?
        uint16 Unknown_8;
        uint16 Channels;
        uint32 Frequency;
        uint32 Interleave; //Not sure
        enum <uint16>
        {
            Type_0002_Uncompressed_PCM  = 2,
            Type_0004_Uncompressed_PCM  = 4,
            Type_0012_Uncompressed_PCM = 12,
            Type_2230_UnknownCompression = 2230,
            Type_8192_UnknownCompression = 8192,
            Type_8917_UnknownCompression = 8917,
        }ResourceType;
        local string TypeEnum=EnumToString(ResourceType);
        uint16 BitDepth;
        uint16 Unknown_9;
        uint16 Unknown_10;
        uint32 Unknown_11;
        uint32 Unknown_12;
        uint32 Unknown_13;
        uint32 Unknown_14;
        uint32 Unknown_15;
        uint32 Unknown_16;
        uint32 Unknown_17;
        uint32 Unknown_18;
        uint32 Unknown_19;
        uint32 Unknown_20;
        local uint32 StreamOffset=ResourceInfoSize + PaddSize;
        local uint32 StreamSize=ResourceSize - ResourceInfoSize - PaddSize;
        if (ResourceOffset != 4294967295)
            Printf("     Lang Index: %u\n   Resource Num: %04u\n  Resource Name: 0x%08x\n      Frequency: %u\n       Channels: %u\n     Interleave: %u\n       Duration: %f sec\n      Bit Depth: %u-bit\n  Resource Type: %s\nResource Offset: %u\n  Resource Size: %u\n  Stream Offset: %u\n    Stream Size: %u\n\n",
                    i,j,ResourceName,Frequency,Channels,Interleave,Duration,BitDepth,TypeEnum,ResourceOffset,ResourceSize,StreamOffset,StreamSize);
    }ResourceInfo;
    Printf("\n\n");
}Lang;

 

Posted
7 hours ago, h3x3r said:

All right. So here's some info. Most of streams are with unknown compression and I don't know which. This template prints some info. Check Output tab.

Firts of all. Create bat file and put this text to it and save.

copy /b Streams.dat + Streams1.dat + Streams2.dat + Streams3.dat Streams_all.dat

Then put the bat file next to the streams and run. It will create one Streams_all.dat

Then you can use 010 Editor Template on on it.

//------------------------------------------------
//--- 010 Editor v14.0 Binary Template
//
//      File: 
//   Authors: 
//   Version: 
//   Purpose: 
//  Category: 
// File Mask: 
//  ID Bytes: 
//   History: 
//------------------------------------------------
LittleEndian();OutputPaneClear();

local uint32 i,j,TotalFileSize=FileSize();

uint32 Sign;
uint32 UnkTableIndex;
uint32 LangResourceIndex;
uint32 LangIndex;
uint32 Unknown_0;
uint32 Unknown_1;
uint32 Unknown_2;
uint32 Unknown_3;
uint32 Unknown_4;
uint32 Unknown_5;
uint32 Unknown_6;

struct
{
    uint32 Unknown_0;
    uint32 Unknown_1;
    uint32 Unknown_2;
    uint32 Unknown_3;
    uint32 Unknown_4;
}UnkTable[UnkTableIndex];

for (i=0; i < LangIndex; i++)
struct
{
    for (j=0; j < LangResourceIndex; j++)
    struct
    {
        uint32 ResourceName;
        uint32 ResourceSize;
        uint32 ResourceOffset;
        uint32 Unknown_0;
        uint32 Unknown_1;
        uint32 Unknown_2;
        uint32 Unknown_3;
        uint32 FFFFFFFF;
        uint32 Unknown_4;
        float Duration;    //Seconds
        uint32 ResourceInfoSize;
        uint32 Unknown_5;
        uint32 Unknown_6;
        uint32 PaddSize;
        uint32 Unknown_7;  //Not sure but decompressed size maybe?
        uint16 Unknown_8;
        uint16 Channels;
        uint32 Frequency;
        uint32 Interleave; //Not sure
        enum <uint16>
        {
            Type_0002_Uncompressed_PCM  = 2,
            Type_0004_Uncompressed_PCM  = 4,
            Type_0012_Uncompressed_PCM = 12,
            Type_2230_UnknownCompression = 2230,
            Type_8192_UnknownCompression = 8192,
            Type_8917_UnknownCompression = 8917,
        }ResourceType;
        local string TypeEnum=EnumToString(ResourceType);
        uint16 BitDepth;
        uint16 Unknown_9;
        uint16 Unknown_10;
        uint32 Unknown_11;
        uint32 Unknown_12;
        uint32 Unknown_13;
        uint32 Unknown_14;
        uint32 Unknown_15;
        uint32 Unknown_16;
        uint32 Unknown_17;
        uint32 Unknown_18;
        uint32 Unknown_19;
        uint32 Unknown_20;
        local uint32 StreamOffset=ResourceInfoSize + PaddSize;
        local uint32 StreamSize=ResourceSize - ResourceInfoSize - PaddSize;
        if (ResourceOffset != 4294967295)
            Printf("     Lang Index: %u\n   Resource Num: %04u\n  Resource Name: 0x%08x\n      Frequency: %u\n       Channels: %u\n     Interleave: %u\n       Duration: %f sec\n      Bit Depth: %u-bit\n  Resource Type: %s\nResource Offset: %u\n  Resource Size: %u\n  Stream Offset: %u\n    Stream Size: %u\n\n",
                    i,j,ResourceName,Frequency,Channels,Interleave,Duration,BitDepth,TypeEnum,ResourceOffset,ResourceSize,StreamOffset,StreamSize);
    }ResourceInfo;
    Printf("\n\n");
}Lang;

 

Thanks, it's working. I tried to extract one audio file, but it has a format.bin how can I play and listen?

  • Engineers
Posted (edited)

Here's BMS to unpack Streams_all.dat

get BaseFileName basename

get Sign uint32
get UnkTableIndex uint32
get LangResourceIndex uint32
get LangIndex uint32
get Unknown_0 uint32
get Unknown_1 uint32
get Unknown_2 uint32
get Unknown_3 uint32
get Unknown_4 uint32
get Unknown_5 uint32
get Unknown_6 uint32

for i = 0 < LangIndex
	get Unknown_0 uint32
	get Unknown_1 uint32
	get Unknown_2 uint32
	get Unknown_3 uint32
	get Unknown_4 uint32
next i


for i = 0 < LangIndex
	for j = 0 < LangResourceIndex
		get ResourceName uint32
		get ResourceSize uint32
		get ResourceOffset uint32
		get Unknown_0 uint32
		get Unknown_1 uint32
		get Unknown_2 uint32
		get Unknown_3 uint32
		get FFFFFFFF uint32
		get Unknown_4 uint32
		get Duration float
		get ResourceInfoSize uint32
		get Unknown_5 uint32
		get Unknown_6 uint32
		get PaddSize uint32
		get Unknown_7 uint32
		get Unknown_8 ushort
		get Channels ushort
		get Frequency uint32
		get Interleave uint32
		get ResourceType ushort
		get BitDepth ushort
		get Unknown_9 ushort
		get Unknown_10 ushort
		get Unknown_11 uint32
		get Unknown_12 uint32
		get Unknown_13 uint32
		get Unknown_14 uint32
		get Unknown_15 uint32
		get Unknown_16 uint32
		get Unknown_17 uint32
		get Unknown_18 uint32
		get Unknown_19 uint32
		get Unknown_20 uint32
		string Name p "%s/Lang_%u/0x%08x.stream" BaseFileName i ResourceName

		if ResourceOffset != 4294967295
			log Name ResourceOffset ResourceSize
		endif
	next j
next i

If it's not compressed you can use Audacity. File > Import Raw > and set the specification printed out by 010 editor

Edited by h3x3r
Posted
7 minutes ago, h3x3r said:

Here's BMS to unpack Streams_all.dat

get BaseFileName basename

get Sign uint32
get UnkTableIndex uint32
get LangResourceIndex uint32
get LangIndex uint32
get Unknown_0 uint32
get Unknown_1 uint32
get Unknown_2 uint32
get Unknown_3 uint32
get Unknown_4 uint32
get Unknown_5 uint32
get Unknown_6 uint32

for i = 0 < LangIndex
	get Unknown_0 uint32
	get Unknown_1 uint32
	get Unknown_2 uint32
	get Unknown_3 uint32
	get Unknown_4 uint32
next i


for i = 0 < LangIndex
	for j = 0 < LangResourceIndex
		get ResourceName uint32
		get ResourceSize uint32
		get ResourceOffset uint32
		get Unknown_0 uint32
		get Unknown_1 uint32
		get Unknown_2 uint32
		get Unknown_3 uint32
		get FFFFFFFF uint32
		get Unknown_4 uint32
		get Duration float
		get ResourceInfoSize uint32
		get Unknown_5 uint32
		get Unknown_6 uint32
		get PaddSize uint32
		get Unknown_7 uint32
		get Unknown_8 ushort
		get Channels ushort
		get Frequency uint32
		get Interleave uint32
		get ResourceType ushort
		get BitDepth ushort
		get Unknown_9 ushort
		get Unknown_10 ushort
		get Unknown_11 uint32
		get Unknown_12 uint32
		get Unknown_13 uint32
		get Unknown_14 uint32
		get Unknown_15 uint32
		get Unknown_16 uint32
		get Unknown_17 uint32
		get Unknown_18 uint32
		get Unknown_19 uint32
		get Unknown_20 uint32
		string Name p "%s/Lang_%u/0x%08x.stream" BaseFileName i ResourceName

		if ResourceOffset != 4294967295
			log Name ResourceOffset ResourceSize
		endif
	next j
next i

If it's not compressed you can use Audacity. File > Import Raw > and set the specification printed out by 010 editor

1960039707_.png.1655795d34364fbb7dba665c56933e9d.png

  • Engineers
Posted (edited)

You can edit the script to output them in folders by ResourceType.

string Name p "%s/Lang_%u/0x%08x.stream" BaseFileName i ResourceName

to

string Name p "%s/Lang_%u/%04u/0x%08x.stream" BaseFileName i ResourceType ResourceName

Edited by h3x3r
Posted
9 hours ago, h3x3r said:

Here's BMS to unpack Streams_all.dat

get BaseFileName basename

get Sign uint32
get UnkTableIndex uint32
get LangResourceIndex uint32
get LangIndex uint32
get Unknown_0 uint32
get Unknown_1 uint32
get Unknown_2 uint32
get Unknown_3 uint32
get Unknown_4 uint32
get Unknown_5 uint32
get Unknown_6 uint32

for i = 0 < LangIndex
	get Unknown_0 uint32
	get Unknown_1 uint32
	get Unknown_2 uint32
	get Unknown_3 uint32
	get Unknown_4 uint32
next i


for i = 0 < LangIndex
	for j = 0 < LangResourceIndex
		get ResourceName uint32
		get ResourceSize uint32
		get ResourceOffset uint32
		get Unknown_0 uint32
		get Unknown_1 uint32
		get Unknown_2 uint32
		get Unknown_3 uint32
		get FFFFFFFF uint32
		get Unknown_4 uint32
		get Duration float
		get ResourceInfoSize uint32
		get Unknown_5 uint32
		get Unknown_6 uint32
		get PaddSize uint32
		get Unknown_7 uint32
		get Unknown_8 ushort
		get Channels ushort
		get Frequency uint32
		get Interleave uint32
		get ResourceType ushort
		get BitDepth ushort
		get Unknown_9 ushort
		get Unknown_10 ushort
		get Unknown_11 uint32
		get Unknown_12 uint32
		get Unknown_13 uint32
		get Unknown_14 uint32
		get Unknown_15 uint32
		get Unknown_16 uint32
		get Unknown_17 uint32
		get Unknown_18 uint32
		get Unknown_19 uint32
		get Unknown_20 uint32
		string Name p "%s/Lang_%u/0x%08x.stream" BaseFileName i ResourceName

		if ResourceOffset != 4294967295
			log Name ResourceOffset ResourceSize
		endif
	next j
next i

If it's not compressed you can use Audacity. File > Import Raw > and set the specification printed out by 010 editor

I entered everything that was written there, for example, I want to play some sound from [Lang_0], I enter the data into audacity and I just don't have the track displayed.889551048_.png.c255e47cff72b40a14205fa1fefffb60.png.thumb.png.727a34369020bb74d6b65deb24d19878.png

Posted
6 minutes ago, h3x3r said:

You must set Stream Offset.

The uncompressed_PCM have always zero offset.

What if there is noise playing in some of the audio?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...