This page is a wiki. Please login or create an account to begin editing.


47 posts / 0 new
Last post
Protocol 7's picture
Offline
Joined: 2010 Aug 7
Extracting data tracks from bin/toc images (Classic and OS X)

If you have a disc image with audio tracks in bin/toc format, here's a guide to extract the data track to a plain iso file that you can mount with Toast etc. This process was tested in 9.2.2 but should work from 8.6 up (BinChunker requires CarbonLib). First, download the required files (Datafork Trimmer, BinChunker and a generic .cue file) from here.

Open the .toc file in a text editor and make a note of the size of the first (data) track (Fig.1). We need to trim the .bin file down to this size. For this we will use mathieudel's very own classic solution "Datafork Trimmer".

Run Datafork Trimmer and open the .bin file using the select button beside the Input field. Now click on the select button beside the Output field and click Save. It should now look like this (Fig.2). Go to the length box and replace the contents with the required filesize from the toc file. Once you have it looking like this (Fig.3) you can hit the Trim button and wait for it to finish processing.

Now we need to convert this from a raw image file to a plain iso. This is where BinChunker comes in. When you run it, it will ask you for a .cue and corresponding .bin file. Select the .cue file from the archive (Fig.4) and then the trimmed bin file. It will now begin converting the file to a .iso. Once this is completed we have a plain .iso file that can be mounted on the desktop or in emulators (Fig.5).

If you want to do this in OS X you can trim down the .bin file using dd from the terminal. Here's a sample command:

dd if=N4_11_93.bin bs=628165104 count=1 of=track1.bin

Once you've trimmed it, you can use this copy of binchunker (which should be compatible down to 10.2.x) from the terminal to convert to iso:

binchunker track1.bin track1.cue N4_11_93.iso

Comments

24bit's picture
Offline
Joined: 2010 Nov 19

Wow, this a very elaborate and detailed work. Certainly it will be much appreciated.
If we would disregard the "original" aspect of the Nautilus disks for a moment, I could also provide some images of the data tracks only, I think. Depends upon somebody asking for those, of course.

Protocol 7's picture
Offline
Joined: 2010 Aug 7

Thanks 24bit! It's really shouldn't be this big of a job (it's really just trim and binchunk) but I'm having trouble finding a "classic" tool to trim the file. Hence the "elaborate" HexEdit section for now. Hopefully I can find one and make a much simpler guide.

mathieudel's picture
Offline
Joined: 2009 Dec 15

Creating a trimming programm for classic should not be that hard... Anyone here with the required skills ?

Gary's picture
Offline
Joined: 2011 Jul 21

> Anyone here with the required skills ?

Yes.

TataMisia's picture
Offline
Joined: 2009 Aug 7

...or use UltraISO by PC to view/extract/write this disc images...

xy's picture
xy
Offline
Joined: 2009 Aug 7

I tried to do the hack with the Mozart String Quartet on MacGarden (http://www.macintoshgarden.org/games/mozart-string-quartet-in-c-major) on Mac OS 9.2.2 native, but after hitting "Go" (to address) in HexEdit the cursor came to thousands of zero strings (00 00 00 00 ...). What do I have to trim here?

Protocol 7's picture
Offline
Joined: 2010 Aug 7

You have to trim from where the cursor stops to the end of the file. What you're doing here is trimming away the audio tracks. If there are zeroes either side of the cursor, make a note of the address where the cursor is. In Fig.5 you can see that we're removing everything from 257109F0 onwards. So the final trimmed image should have 257109E0 as it's last line.

Yeah, it's messy, I know. I'm still looking for a better tool. If you have any version of OS X it's much easier to do this step from the terminal using the dd command I mentioned at the end.

xy's picture
xy
Offline
Joined: 2009 Aug 7

Thanks Protocol 7! I'll check it out. No, I don't have Mac OS X. I'll hack myself through my Old School system. It's okay if it's more messy. I do this for recreation.

Protocol 7's picture
Offline
Joined: 2010 Aug 7

If you want to do this in Windows, you can convert the .toc file to .cue using toc2cue. It's part of cdrdao and is installed (along with the rest of the package) with burnatonce (it's in the "external" folder).

From the command prompt run:

toc2cue inputfile.toc outputfile.cue

This will create a .cue file. You can now use IsoBuster to extract the data track by opening this cue file. Under "Session 1" right-click on "Track 01" and choose "Extract Track 01", then "Extract User Data". This will extract the data track to a iso file ready for use.

TataMisia mentioned UltraISO so you can probably extract the tracks using that too.

xy's picture
xy
Offline
Joined: 2009 Aug 7

Thanks again Protocol 7! I tried the Mac OS 9.2.2 hack. The problem with the Mozart String Quartet is that you have to delete most of the 600 to 700 MB file!! That means highlighting most of the HexEdit file by holding the mouse or trackbad which would probably take hours!

Does anyone know a way to fix the mouse or trackpad so that srcolling down = highligting goes without holding the mouse or the trackpad? Or is there a keystroke for highlighting certain areas of the HexEdit file? (The Hexedit menu offers the option "select all" only.)

mathieudel's picture
Offline
Joined: 2009 Dec 15

Well, no one proposed him(her)self to create the needed programm, so perhaps I should do.
First I need to know exactly what is needed.
From my understanding, a simple window should propose to select a file, to fill-in two integers being an offset and a length (in bytes) and a button 'trim' that allow to create a new file with only the selected range of the data fork from the input file.
Is that right ?
Any other need ?
Maybe something to automate the whole process of extracting data from the image files ?

xy's picture
xy
Offline
Joined: 2009 Aug 7

That sounds great! Keep as simple as possible so that it is reliable and stable.

Protocol 7's picture
Offline
Joined: 2010 Aug 7

That would be great mathieudel!. All that's needed is an app to open a file (optionally display it's current size in bytes) and specify the size you want to trim it down to (in bytes). There's no need to specify an offset. And as it's aimed for trimming images there's no need to consider resource forks either.

Something like this perhaps.

To automate the extracting to iso, you could look into the binchunker code. It's already been ported to OS 9 so it may be possible to add it into the app.

mathieudel's picture
Offline
Joined: 2009 Dec 15

Ok, I will look at it in days to come. I don't have much spare time right now, but I think it should be feasible in a couple of hour, once I learned available APIs (raw toolbox or maybe Metrowerks PowerPlant ...).
So all in all, I should have something by the end of the week Tongue

mathieudel's picture
Offline
Joined: 2009 Dec 15

Ok, I'm nearly finished, bnut I'm lacking some nice icons. I would need two 8bits 32x32 color icons:
- An icon for the application itself (named Datafork Trimmer)
- An icon to be displayed when the trim successfuly finished

It'll be cool if someone could provide me those, I don't really know where to start the search from.
Appart from that, there is still two bugs and an unimplemented feature, but the later is not needed for the original purpose, so who cares Tongue !

Protocol 7's picture
Offline
Joined: 2010 Aug 7

Sounds great. I'm looking forward to seeing the final product. I can't help with the icons though but maybe someone else here can.

mathieudel's picture
Offline
Joined: 2009 Dec 15

Well, nobody seems to be ready to give cool icons Sad... I will make them myself but they won't exactly be "cool" Tongue !

mathieudel's picture
Offline
Joined: 2009 Dec 15

Ok, now that I'm one week late from what I've announced, here it is, complete with source code (you will at least need 'Metrowerks CodeWarrior discover edition 4' to compile a custom version) .

I have to say that, from a developer point of view, Mac OS is really a crappy piece of software ! Anyway the application finnaly works and should help anybody wants to trim files in MacOS < 10.0 ...

I've only tested it in MacOS 9.2.2, but it should work on anything > 7.0 (at least if Metrowerks documentation is right Tongue).

I've left the application as a debug version on purpose, since it does not consume that much CPU and debug alert messages may prove usefull Smile !

As expected, icons are ugly, but I don't have the time to do much better. They are basically icons found on google and reworked to be displayable with System's palette ... did I say ugly ?

The are two features missing from what I initially planned :
- The ability to choose size units. For now they are always expressed as bytes. Tell me if KBytes and MBytes can be usefull
- The ability to send apple events to the application, so that apple script can control it. This could be usefull to create a script to automate the whole thing. The feature is actually 50% complete, but I don't know when I will be able to work on the program again, so I disabled it.

Feel free to give me some feedback !

NB : Ho and ... look at the about box Tongue

NB² : Be aware that any file trimmed with this application will not keep original file's resource fork (hence the name 'Datafork Trimmer' Laughing out loud)

Edit: Removed MU d/l link - IIGS User Wink

xy's picture
xy
Offline
Joined: 2009 Aug 7

Great stuff! But how does it work? I tested it with the Mozart String Quartet: http://www.macintoshgarden.org/games/mozart-string-quartet-in-c-major
I ran the bin file through your hack and then tried to process it with BinChuncker. BinChuncker, however, asked for a .cue-file, or the like. Also, I opened the trimmed file with HexEdit, searched for the value of the toc file as prescribed by Protocoll 7: What came out is that the cursor stopped at exactly the same position as with the untrimmed file as if nothing had been trimmed.
What did I do wrong? I have no clue of programming, so I guess I am somewhat clumsy in using this.

mathieudel's picture
Offline
Joined: 2009 Dec 15

Sorry, I thought it was self explanatory and didn't took the time to explain how to use it (that's always the same when you create some software, you don't realize that you may well be the only one to understand it Tongue).

Well, if you had no difference between before and after trimming that's because it seems to works great Tongue !!! Let me explain :
- First you have to select the file to be trimmed (the .bin one, not the .toc one). Doing this, the trim length is auto-magically set to file's length, and that's why you saw no difference between input and output file (I thought it was a great idea ... maybe not Tongue).
- Then you select a destination file name. One is created for you just by prefixing source one's by 'trimmed_' and cutting after old MacOS' 31 characters limit, but you can put here anything you want.
- In the offset field, just let 0, it's here just for feature completeness but serves not purpose in your case.
- In the length field, replace the value set by the software by the one found in the .toc file.
- Press the trim button and wait for the process to complete
- Once done, if you want, you can check that it worked by opening the file with HexEdit and put the cursor at .toc's value. It should be the end of the file (thus, if your confident enough, you don't have to bother win HexEdit again Smile).

So, this application (this is not a hack Laughing out loud) is just here to replace (and hopefully simplify) the whole HexEdit process.

All this is why AppleScript capabilities could prove useful : a simple script could retrieve the value in .toc file and launch my trimmer, setting it appropriately, then use the output file do no any further needed processes... But honestly, I don't think it's worth spending a lot of time for this. Tell me I'm wrong by being enough people to request the feature Tongue !

xy's picture
xy
Offline
Joined: 2009 Aug 7

I have done with the Mozart String Quartet as you said. The result was the following:

The Mozart String Quartet has a bin file called Dissonant.bin which is about 784 MB big. I processed it exactly as you said. The result was a 7.1 MB file. I checked this file with HexEdit and went to the toc value 7519344, and the curser remained at the beginning of the file instead moving to the end!

Anyway, I tried to process the Dissonant.bin and the trimmed_dissonant.bin file with BinChuncker as Protocol 7 advised. The result was a message from BinChuncker saying "Could not read first line of cue!" Then BinChuncer simply stopped the process.

I am computer illiterate that's why I like Macs. Please tell me what I have done wrong. Or is the Mozart String Quartet not usable for the devices?

mathieudel's picture
Offline
Joined: 2009 Dec 15

Given the value you report as being found in the toc file (7519344) the 7.1MB output file is normal.
It may be correct, but did you double checked this value ?

As for the BinChunker part, since the .cue to be processed is the one found in the archive given at the top of this thread, it's strange that it wasn't able to read it... Please double check that you :
1. Selected (and validated) the .cue found in the archive at the top of this thread
2. Selected (and validated) the .bin file output by DataforkTrimmer

Anyway, I'll download Mozart String Quartet and try the process by myself, just to see if I can complete the data track extraction.

Protocol 7's picture
Offline
Joined: 2010 Aug 7

I'll also give this a try soon. I've just been a bit busy lately and haven't had a chance to put the tool to the test and rewrite the guide accordingly. But I will.

Protocol 7's picture
Offline
Joined: 2010 Aug 7

Binchunker will first ask for a cue file. If you give it a bin file instead it will give this "could not read first line" error. So first you load the cue file from the files archive at the start of the tutorial. Then the trimmed bin file.

I've ran one of 24bit's Nautilus CDs though the trimmer and it works a treat! Now I can trim down the guide Smile

mathieudel's picture
Offline
Joined: 2009 Dec 15

Glad to know it works !

xy's picture
xy
Offline
Joined: 2009 Aug 7

It really works; it's like magic! Thanks guys. I only wonder how it comes that the result of a 784 MB bin file is a 6-7 MB ISO file. This is incredible. Was the rest of the bin file just empty disc space? Or does the bin format need so much disk space?

Protocol 7's picture
Offline
Joined: 2010 Aug 7

The rest of the disc was the audio track.

xy's picture
xy
Offline
Joined: 2009 Aug 7

To preserve the audio track I burned the bin image with Toast 5.2.3 on Mac OS 9.2.2 on CD. Toast did the burning fine. From this I assume it should also be possible to create a Toast image that preserves the audio track via the "Save as Disk Image" option of Toast's menu. I haven't tried this, though. For some reaseon, however, does does not mount the bin image directly.

Protocol 7's picture
Offline
Joined: 2010 Aug 7

A bin file isn't enough to recreate the CD. The toc file contains the necessary track information. So Toast won't work.

There's no solution for burning these images in OS9. You need OS X, Windows or some form of Linux.

xy's picture
xy
Offline
Joined: 2009 Aug 7

I already noticed: Although Toast 5.2.3 did burn the bin file on Mac OS 9.2.2 and on the CD created I can view the same things as with the ISO, I cannot, however, listen to the music. So, it seems, you are right: also on the CD the audio tracks seem to be lost, too, only the visuals are there.

The interesting thing, though, is that according to this
http://www.eai.org/resourceguide/preservation/computer/pdf-docs/voyager_...
information the audio files of Voyager CDs often cannot be listened to with Mac OS 8.5.1 upwards.

24bit's picture
Offline
Joined: 2010 Nov 19

So Voyager CDs seem to be picky? My iMac G3 OS9.2.2 plays the original disk with soundtracks.
Two volumes are mounted, the first is a data disk, the second is a generic Audio1 volume.

I would really like to see the "Who built America" disk and the others.

xy's picture
xy
Offline
Joined: 2009 Aug 7

24bit said:

"My iMac G3 OS9.2.2 plays the original disk with soundtracks. Two volumes are mounted..."

Do you mean the Mozart String Quartet? If yes, how did you burn the CD?

24bit's picture
Offline
Joined: 2010 Nov 19

Above I was talking about the original disk "Mozart Dissonant Quartet" that i got with my 7100, in the first place.
For reference, I downloaded the files, restored creator IDs, inflated them and burned with Gnome CD Master, a graphical front end for CDR-DAO with GNU-Linux. The disks plays just like the original on my iMac.
I think ImgBurn for Windows can toast bin/toc files as well.
Funny thing, there is no sound with "Mozart Dissonant Quartet" and my 7100 OS 7.5 and 8.6. Only one Mozart volume is mounted and the hypercard looks like it would play. I'll check that with earphones and my Apple CD 300 tomorrow.
@xy: If you would like to tell me your address, I will send the (for me obsolete) copy.

24bit's picture
Offline
Joined: 2010 Nov 19

It is like I suspected it to be. It depends on the type of CD-ROM you have and how (if) CD device's sound output is connected to your main board. My Apple CD300 from 1993 outputs the audios to the earphone/cinch jacks.
Both 7.5 and 8.6 work fine. The audios can also been played with Apple CD Audio, to be listened at earphone or cinch jacks. Track5 seems to be for the Mozart game and track6 is an audio tutorial.

xy's picture
xy
Offline
Joined: 2009 Aug 7

24bit, Thanks man. You should have my coordinates now.

24bit's picture
Offline
Joined: 2010 Nov 19

Yeah, no problem.

xy's picture
xy
Offline
Joined: 2009 Aug 7

24bit, CD has arrived. Thank you very much. Audio part works perfectly on Mac OS 9.2.2 on Powerbook G3 Lombard 333 Mhz without earphones.

I also know now what happens if one tries to burn the bin image with Toast 5.2.3 on Mac OS 9.2.2: Protocol 7 was right, the audio part of the CD will simply not be burned. However, the visual part will be burned, and can probably be saved as a Toast image.

mathieudel's picture
Offline
Joined: 2009 Dec 15

I just realized I uploaded this application to MegaUpload at the time.
Is it still of any interest to some of you ? If so, I should dig into my sheepshaver archives to find it again and upload it here...

24bit's picture
Offline
Joined: 2010 Nov 19

I vote for preserving/uploading your app, if you should find the time.
Maybe there is no great demand right now, but sooner or later the issue will come up again.
As you already were kind enough to do the work, it would be a shame to bury it in your backups.

mathieudel's picture
Offline
Joined: 2009 Dec 15

Ok, so I'll try to find it ! Not an easy task since the Mac I developed it under is mostly dead now (only starting once in a while and running only for a few minutes before shutting down unexpectedly). I now I have a backup of the project on one of my sheepshaver image on my PC, but since then I switched back to a real mac and I do not use my PC anymore, which here again show some difficulties when trying to boot (yeap, I only have quite old computers that start showing their age...)

24bit's picture
Offline
Joined: 2010 Nov 19

No hurry! Your Mac should be able to read NDIF images from the Finder, even if they are on NTFS or FAT32 volumes. I got myself a nice USB adapter for all kinds of disks and flash media just for that task.

mathieudel's picture
Offline
Joined: 2009 Dec 15

Ok, I found the backup I was talking about... but it really is just a very preliminary, not working, version of the application :'( !

I'll have to boot the old Mac to recover the file, or extract its hard disk and find a way to read it. Not an easy task considering its a mobile hard drive, and the last time I did it, it easily took a couple of hours to completely dismantle the computer to have access to it !

mathieudel's picture
Offline
Joined: 2009 Dec 15

I should have said 'Anyone else than me here with the required skills ?', because I have very little spare time, and learning an old and unused SDK just to write an application of this kind is a bit overkill. If anyone would have known about PowerPlant or plain Toolbox it would have saved me this study Wink

Anyway this done... and lost ! Now I'll have to dig on old buggy computer to retrieve that work. I don't really feel happy about starting from scratch. Not to mention this can be done very easily using languages not supported by MacOS 7/8/9.

Gary's picture
Offline
Joined: 2011 Jul 21

I should have been more precise. >I< have the skills, tools, knowledge and time to write this app. What I lack is a sample bin/toc file to use as input. The links in this thread (and the other one) to such a file are dead.

Gary

xy's picture
xy
Offline
Joined: 2009 Aug 7

mathieudel, I have uploaded your app so that you do not have to waste time to make your old computer working again:
http://macintoshgarden.org/apps/datafork-trimmer
I hope this is okay with you. If not please erase the upload. Thanks again for programming this.

mathieudel's picture
Offline
Joined: 2009 Dec 15

@xy: Thanks ! Of course there's no problem with that Tongue

@Gary : Ok, I did not understood you at first. You could anyway modify at will the program I made last year and that xy re-uploaded. Just an idea : include parts from bchunker so that the whole process could be automatized.