New user - with some tips on combining multiple .BIN files

Introduce Yourself Here! Tell us who you are, where you're from, what you do etc :)

New user - with some tips on combining multiple .BIN files

Postby SirNickity » Fri Sep 22, 2017 5:10 am

I can't post comments on existing threads yet (new user), but I thought this might help:

In the "PSX - Multiple BIN files - What to do?" tutorial (I can't link either), there are instructions for how to mount a .CUE/.BIN(s) image in a virtual CD program and then re-rip the image to obtain a single .BIN file. You don't really need to go to all that trouble, though. There's a much easier way to accomplish the same thing with just the native command shell on whatever OS you use.

.BIN files are just a dump of the disc sectors, with no header or footer. They should always be a multiple of 2352 bytes -- the size of a CD sector. These can be merged into one file using the command line.

In Windows, that would look like this:
Code: Select all
copy  /b  file1.bin+file2.bin+file3.bin  output.bin

In Linux or Mac OS, do this instead:
Code: Select all
cat  file1.bin file2.bin file3.bin  > output.bin

Now you have a single .BIN file. However, the .CUE file will look something like this:

Code: Select all
FILE "file1.bin" BINARY
  TRACK 01 MODE2/2352
    INDEX 01 00:00:00
FILE "file2.bin" BINARY
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "file3.bin" BINARY
    INDEX 00 00:00:00
    INDEX 01 00:02:00

Usually, the first track is data, and the remaining tracks are all audio. On a CD, all tracks are referenced by a time stamp -- even data. It stems from the fact that CDs were originally designed for audio, and only later co-opted for other use. The time stamps are in the format MIN:SEC:FRAME. There are 75 frames per second.

The original .CUE file starts each track with no offset of the respective source files. But, since our .BIN files were combined, the time stamps for tracks 2 and up will need to be adjusted so they point to the new offset in the combined file. If you leave them at 00:00:00, then all three tracks will point to the first byte of the data track -- which is not valid, and definitely not what you want.

OK, now one quick detour. Let's talk about indices.

By the red book spec, all audio tracks are supposed to have a 2-second gap between them. These days, a lot of commercial audio CDs ignore this, and tracks run together with no discernible gap. Pretty much any CD player ever made can cope with this just fine. However, because of this arbitrary requirement, you will often find a 2-second gap between tracks when the audio isn't meant to be continuous.

In case you're curious: Part of the reason for this is because CD players aren't really very precise about where a track ends and the next begins. (Or rather, the spec is a little bit fuzzy on how to locate the exact start of a track.) It can, and does, vary by a little bit between players, so the gap helps to ensure audio always starts and ends without anything getting cut off early, or bleeding over into the next track.

Index 00 is the beginning of the gap. This is the part between tracks where the CD player counts in negative numbers. During the transition from track 2 to track 3, for instance, the CD player's display might say something like "03 -00:02", count up to "-00:00", and then start at "00:00" and count up from there for the length of the track. Index 01 is the "00:00" point of the track.

And yes, you can have indices higher than 1. They were used in the early early days to locate points within a track, like when a classical piece had multiple movements. Most CD players since the mid 80s have long done away with the index seek feature, though. It was never very popular.

If one should desire to ignore the red book spec and place tracks together with no gap, it is possible to set Index 00 and Index 01 to the same time stamp. The gap can be any value from 0 frames to the space available on the disc.

OK, you now know more about CD audio disc layout than you ever wanted to. Let's move on.

To calculate the offset of what would have been the second .BIN file, just take the exact file size of the first .BIN file and divide by 2352. This will give you the number of complete sectors in the first file. It should end up as a whole number. If you have a remainder, something is wrong.

To convert that to M:S:F format, divide the number of sectors by 75. This will give you the length of the track in seconds. There may be a remainder. If there is, you will need to subtract the whole number * 75 from the original sector count to get the number of frames.

For example, here's Lunar - The Silver Star Story Disc 2:

file1.bin - 693402528 bytes, 294814 sectors
file2.bin - 26570544 bytes, 11297 sectors
file3.bin - 8041488 bytes, 3419 sectors

The first track is 294814 sectors long, divided by 75 = 3930.853 seconds long.
So we'll take 3930*75=294750, and subtract that from 294814 to get a remainder of 64 frames.

Next, we need to calculate minutes -- which is, of course, seconds / 60. In this case, that's 65.5 minutes. The remainder is the value of the seconds field in the time stamp. 0.5 minutes is, of course, exactly 30 seconds. But you can use the same trick to calculate this when it doesn't fall on such an obvious boundary:

Seconds to minutes: 3930/60=65.5
Number of complete minutes (in seconds): 65*60=3900
Number of seconds: 3930-3900=30

So we know the length of track 1 is 65m, 30s, 64f. That is the starting offset (INDEX 00) of track 2.

To find the offset of track 3, just repeat the process with the second file:

26570544 bytes / 2352 bytes = 11297 sectors / 75 = 150.626 seconds
150 * 75 = 11250, subtracted from the total of 11297 sectors = 47 frames
150 / 60 = 2 minutes, with a remainder of 30 seconds

Track 2's total length is 2m 30s 47f.

Now you have to add this to the length of track 1 to get the starting offset of track 3:

65m 30s 64f + 2m 30s 47f = 68m 01s 36f, which is the INDEX 00 point for track 3. (Remember, there are 75 frames per second, so remember to carry the overflow to the next highest unit.)

To set the INDEX 01 times for tracks 2 and up, just add the value already there to the time stamp in INDEX 00. For Lunar, that looks like this:

Code: Select all
TRACK 01 MODE2/2352
  INDEX 01 00:00:00  <-- This stays the same
  INDEX 00 65:30:64
  INDEX 01 00:02:00  <-- This becomes 65:32:64
  INDEX 00 68:01:36
  INDEX 01 00:02:00  <-- This becomes 68:03:36

The 02:00 second difference in INDEX 01 does not affect the track's length, so you don't need to account for that in subsequent time stamps. It just consumes the first 2 seconds of the audio track's data for the gap, which is usually silence. (You can technically put audio in the gap, but most disc authors don't.)

You don't need to do anything with file3.bin, since it's the last track. Whatever is reading the .CUE file will know the end of the track because it has run out of data in the referenced source file. On that topic, notice that we've removed the FILE statements for each track. You only need the first one, at the top of the cue sheet, and it needs to point to the combined file.

That's it. Now, it is a bit of leg work to pull this off, and some (well, probably most) people will find it easier to just go with the mount-and-rerip technique. Particularly if there more than a couple tracks. But, let it be known you don't need any special software to do this, just a calculator and some good notes.
  • 40

Last edited by MasterOfAll on Fri Sep 22, 2017 5:51 am, edited 1 time in total.
Reason: So people don't have to keep scrolling past.
SirNickity Newbie
Posts: 2
Joined: Fri Sep 22, 2017 4:02 am
Reputation: 40

Re: New user - with some tips on combining multiple .BIN fil

Postby oldxbox75 » Fri Sep 22, 2017 5:20 am

Nice and informative info for everyone !
  • 10

User avatar
oldxbox75 5
Posts: 647
Joined: Tue Sep 02, 2014 2:00 pm
Reputation: 1838

Re: New user - with some tips on combining multiple .BIN fil

Postby MasterOfAll » Fri Sep 22, 2017 5:55 am

I realise you say "trouble", but for most people, by the time, they've typed everything out, and then figured out the new cue file, they can just mount and rip. Which is pretty much what you've said by the end of it anyways. As for special software though, it's all free, and only takes a couple of minutes to install.

For those that have some brains, and want to nerd out, your tutorial is a good one! :D

Welcome to the site btw, and don't forget to read the site rules.
  • 20

User avatar
MasterOfAll Moderator
Posts: 2207
Joined: Sun Nov 29, 2015 4:54 pm
Reputation: 11102

Re: New user - with some tips on combining multiple .BIN fil

Postby eugenerobinhood1 » Fri Sep 22, 2017 6:57 am

Image Image Image Image Image Image Image Image Image Image Image Image Image Image

Image Image Image Image Image Image Image Image Image Image
  • 10

User avatar
eugenerobinhood1 Moderator
Posts: 2387
Joined: Sat Nov 15, 2014 11:19 am
Custom Title: TIZ Rocks!
Reputation: 31291

Re: New user - with some tips on combining multiple .BIN fil

Postby EarthwormJames » Fri Sep 22, 2017 8:13 am


And BTW, is there just a program that will combine the bins for me? I'm pretty lazy.
  • 10

User avatar
EarthwormJames 5
Posts: 545
Joined: Thu Jun 09, 2016 9:20 am
Custom Title: Lumbricus Extraterrestris
Reputation: 2020

Re: New user - with some tips on combining multiple .BIN fil

Postby ZX81v2 » Fri Sep 22, 2017 10:28 am

You DON'T Combine BINS...
The FIRST BIN is the game
The OTHER bins are the soundtrack/CD Audio tracks.
Without the CUE you'd end up with just the game data and no soundtrack.
The CUE Handles the other BIN files and writes em correctly.
The "BINS" are re-encoded as CD audio when written to disk

All tools here >> http://www.theisozone.com/downloads/mis ... and-guide/


Welcome to TiZ Forums

Please make sure you READ the RULES as getting trolled ain't fun ! You can get to them by clicking the FORUM tab at top of this page

GO TO http://www.7-zip.org and download and install 7-Zip v16.xx.
This program is one of the best file compressor/extractor you can get... It's also FREE !
Install - Run - Goto Options > File Associations click " + " all open with 7-zip
Untick ISO. Click Ok and close 7-zip

*.001 files - Double click on one and Windows will ask you which program to use with the file type.
Select 7zFM.EXE (C:\Program Files\7-zip\7zFM.exe)
From this point onwards, 7zip will open all 001 files for extraction

- Absolutely NO linking to outside cloud storage sites such as RAPID/MEGA etc... Esp in downloads !
Doing so will get you kicked for a minimum of 7days.
This Includes, Posting "outside links" to cloudsites in comments or posts - Will get your Post deleted, warned and kicked if you continue.

- Video Uploads - Don't cover your vids with AD's. They WILL be removed without warning.

- Don't SPAM in the game comment box's. Got a problem, ask in the relevant forum for the system type.

- Don't SPAM the forums with complete rubbish as these WILL be Deleted and user will get a ban depending on how bad it was.

- THIS INCLUDES : THE "5 POSTS REQUIRED" RULE! - Say Hi, say hi to new users, you get through 5 posts easy.
This is to stop spammers uploading crap all over the board as it FORCES interaction - Getting pissed about it don't help !

- Play nice, however remember this forum is run by ADULTS and it aimed at ADULTS.
Taking offense is not worth it, and if this is too much then you really need to step away... There be Trolls in these parts !

- Posts in wrong areas WILL be removed without warning

- If in doubt, contact a MOD or a Editor (The GREEN Names]
before you upload or post something your not sure on.
Also it's worth checking this out if your itching to start uploading stuff OR Requesting Stuff >
The LEGAL Info you Need to know !

IF you find a file that has a PASSWORD on it that don't seem to work (Usually a new upload) don't Comment in the BOX, Click PM The
Original Uploader as they are the only ones who can REMOVE or CORRECT the password.

DEFAULT ACCESS PASSWORD ON OUR CLOUD SITE Should be set to : theisozone.com OR theisozone and stated on the Description of the download page
Stops the leachers claiming as their own work by direct linking....


PLEASE check your uploads for PASSWORDS Defaultly placed on your shared files by THE CLOUD
Change password to
theisozone or theisozone.com or don't bother with one - Your choice
This gets ALOT of new uploaders !

How to Fix Password -
Open YOUR FD page and click on the file you want to remove password from

Click the "Edit" button

Untick Password Box

click ok

All done

Main thing though,
Enjoy Yourself :)

ZX81v2 - R Tape Loading Err0r
  • 30

PS2 (Phat) + Network Adapter + SATA Bridge + 2TB HDD = Insanity+1 !
Wanna Know More > theisozone.com/forum/viewtopic.php?f=75&t=49420&hilit=+sata

FreeMCBoot Installer - OPL 0.8/9 + HDL0.8c
Game Compatibility Checker. WinHIIP User
ZX81v2's MAME/ARCADE Thread Here
FreeMCBoot Install Service "UK" Thread HERE
MY PS2 OPL 0.8 HDD Game Compatibility List Click Here 100% Safe

Latest MESS/MAME Roms : Retroroms.info < NEW SITE !


If you are/WERE a PS2 Developer please check PS2Home out !
Designed & (C)2013-2017 by ZX81v2
User avatar
ZX81v2 Moderator
Posts: 7434
Joined: Sat Feb 04, 2012 6:02 pm
Location: EARTH - SOL System - Mostly Harmless
Custom Title: R Tape Loading Err0r
Reputation: 40862

Re: New user - with some tips on combining multiple .BIN fil

Postby maxpc » Fri Sep 22, 2017 12:50 pm

Hi SirNickity.

  • 10

User avatar
maxpc 6
Posts: 782
Joined: Mon Oct 31, 2016 7:52 pm
Location: Lethbridge, Alberta Canada
Reputation: 14742

Re: New user - with some tips on combining multiple .BIN fil

Postby catch_2030 » Fri Sep 22, 2017 1:22 pm

You may have to combine bin files for PSX2PSP conversions. As long as the new CUE file comes out correctly, it typically will work.
  • 20

"Spoon feeding in the long run teaches us nothing but the shape of the spoon."
~E.M. Forster~

TIZ Legal Notice

Please report requests that have been filled!
User avatar
catch_2030 Moderator
Posts: 7870
Joined: Sun Jun 10, 2012 3:24 am
Location: USA
Custom Title: Can't stump the Trump!
Reputation: 24920

Re: New user - with some tips on combining multiple .BIN fil

Postby Biggsy666 » Fri Sep 22, 2017 2:47 pm

Welcome to TIZ
  • 0

My Systems
Acorn Electron
ZX Spectrum +2
Atari 2600
NES & Famicom w/ FDS
SNES & Super Famicom
N64 1 x PAL, 1 x NTSC-J
Gamecube x2 Xeno
Wii x2 softmod
Master System
Mega Drive MKI RGB w/switches & MKII
PS1 Audiophile, 3 chipped & 1 slim w/screen
PS2 1 fat silver with FMCB/120gb HDD & 1 slim w/screen
PS3 1 fat, 1 slim
Xbox (soft mod 200gb & 1 Crystal hard mod 120gb)
Xbox 360
N-Gage & N-Gage QD
Gameboy, GBP, GBC, GBA, GBA SP, 2x GB Macro
Nintendo DS, DSL, DSi & 3DS

My custom Console Projects
User avatar
Biggsy666 9
Posts: 2585
Joined: Mon Apr 28, 2014 12:57 pm
Location: Yorkshire, Up North (England)
Reputation: 25572

Re: New user - with some tips on combining multiple .BIN fil

Postby SirNickity » Fri Sep 22, 2017 5:21 pm

I'm not sure where I might have suggested you don't need the .CUE file. You certainly do. But you can, and in some cases have to, combine the per-track .BIN files from a single disc rip. As catch_2030 said, some conversion tools won't accept a cue sheet with multiple source files.

That is precisely my motivation for figuring this out, by the way. I have a stack of PS1 games, and one of them (guess which) is no longer readable. Perfect condition, never even played actually, but it failed to rip in the last 100MB of the disc. I'm sure it won't be the last to fail, so I've started investigating alternative ways to play them. PS2 HDD mods, PSP Go, PS TV, etc.

I used ImgBurn to create my own images, which keeps everything in a single .BIN file. The replacement image for the disc I couldn't rip was split. Ergo...

I didn't mention in the original post that there is one caveat to merging the source files: It only works when all the tracks are raw binary. It won't work with .WAV or other audio formats. Those file types have additional headers that would be incorrectly interpreted as audio data, and would throw off the time by a small amount. Certain formats (even less common variations of .WAV) may also be compressed or pack the audio samples differently. There aren't quite as many cue sheet tools that know how to deal with .BIN files for audio, and handling raw PCM data manually can be a little tricky. Speaking of which, just for good measure, it looks to me like plain interleaved L,R samples (16b/44k) in LSB byte order.
  • 0

SirNickity Newbie
Posts: 2
Joined: Fri Sep 22, 2017 4:02 am
Reputation: 40

Return to Introduce Yourself

Who is online

Users browsing this forum: No registered users and 6 guests

Home | Legal Notice | DMCA Policy | DMCA File Removal Center | Contact