michaelortmann / bin2iso

bin2iso converts RAW format (.bin) files to ISO/WAV format.
MIT License
9 stars 1 forks source link

`output_dir` parameter ignored #1

Open dbedrenko opened 5 months ago

dbedrenko commented 5 months ago

I pass the output_dir parameter and yet the .iso is not written to there; the .iso is written to the current directory, which is the default.

FILE "Usagi - Yasei no Touhai - Dramatic Mahjong (Japan).bin" BINARY
  TRACK 01 MODE2/2352
    INDEX 01 00:00:00
$ bin2iso Usagi\ -\ Yasei\ no\ Touhai\ -\ Dramatic\ Mahjong\ \(Japan\).cue /run/media/danb/ps2_mx4iso/CD/

Aug 26 2021, 08:56:50
bin2iso V1.9b - Converts RAW format (.bin) files to ISO/WAV format
               Bob Doiron, ICQ#280251

Check for updates at http://users.andara.com/~doiron

Note: Appending pregap data to end of audio tracks

Usagi - Yasei no Touhai - Dramatic Mahjong (Japan)-01.iso (425 Mb) - sectors 000000:189743 (offset 000000000:446277887)

Mode2/2352 single track bin file indicated by cue file
Usagi - Yasei no Touhai - Dramatic Mahjong (Japan).bin renamed to Usagi - Yasei no Touhai - Dramatic Mahjong (Japan)-01.iso
michaelortmann commented 5 months ago

You are not using the bin2iso version from this github repo.

Your output says:

bin2iso V1.9b - Converts RAW format (.bin) files to ISO/WAV format
               Bob Doiron, ICQ#280251

If you were using this github repo, your output would say:

bin2iso V1.9bm3 - Converts RAW format (.bin) files to ISO/WAV format
MIT License
(c) 1999 Bob Doiron
(c) 2020 - 2023 Michael Ortmann

I tried your command line with the version from this github repo, and it produced the iso in the correct output directory, so i guess your bug only exists in the version of bin2iso you are using and not in the version from this repo.

The same may apply to the other issues you opened.

Can you please try again with the version from this repo?

dbedrenko commented 5 months ago

Hello, sorry for taking time to respond.

Thanks for clarifying about the program version. For these issues I used the one from the AUR: https://aur.archlinux.org/packages/bin2iso

But I'm afraid it also happens with the version from this repo, which I compiled. Please see my output below where the .iso should go into the new directory, but you can see the conversion succeeded yet the directory is empty. Also it overwrites the .bin file even though the -i option was not passed.

$ ~/Programs/bin2iso/bin2iso Usagi\ -\ Yasei\ no\ Touhai\ -\ Dramatic\ Mahjong\ \(Japan\).cue new

Apr 28 2024, 21:51:16
bin2iso V1.9bm3 - Converts RAW format (.bin) files to ISO/WAV format
MIT License
(c) 1999 Bob Doiron
(c) 2020 - 2023 Michael Ortmann

Note: Appending pregap data to end of audio tracks

Usagi - Yasei no Touhai - Dramatic Mahjong (Japan)-01.iso (425 Mb) - sectors 000000:189743 (offset 000000000:446277887)

Mode2/2352 single track bin file indicated by cue file
Usagi - Yasei no Touhai - Dramatic Mahjong (Japan).bin renamed to Usagi - Yasei no Touhai - Dramatic Mahjong (Japan)-01.iso
[I][~/Programs/games/ps2/mahjong/cd]$ ls -al new
total 8.0K
drwxr-xr-x 2 danb danb 4.0K 28-Apr-24 21:52 .
drwxr-xr-x 3 danb danb 4.0K 28-Apr-24 21:53 ..
michaelortmann commented 5 months ago

interesting. for "single track bin file indicated by cue file" bin2iso does a rename of .bin to .iso instead of outputting to output_dir, whcih it does for other cue-modes:

$ ls -la
total 340172
drwxr-xr-x 2 michael michael      4096 Apr 29 02:31 .
drwxr-xr-x 4 michael michael      4096 Apr 29 02:29 ..
-rw-r--r-- 1 michael michael 348317088 Apr 29 02:31 image.bin
-rw-r--r-- 1 michael michael        68 Apr 20 22:42 image.cue
$ cat image.cue 
FILE "image.bin" BINARY
  TRACK 01 MODE1/2352
    INDEX 01 00:00:00
$ mkdir new
$ /home/michael/usr/src/bin2iso/bin2iso image.cue new

Apr 21 2024, 20:38:47
bin2iso V1.9bm3 - Converts RAW format (.bin) files to ISO/WAV format
MIT License
(c) 1999 Bob Doiron
(c) 2020 - 2023 Michael Ortmann

Note: Appending pregap data to end of audio tracks

image-01.iso (289 Mb) - sectors 000000:148093 (offset 000000000:348317087)

Note: PreGap = 150 frames
Creating new/image-01.iso (000000,148093) Mode1/2048 : Complete
$ ls -la new/
total 296200
drwxr-xr-x 2 michael michael      4096 Apr 29 02:32 .
drwxr-xr-x 3 michael michael      4096 Apr 29 02:31 ..
-rw-r--r-- 1 michael michael 303296512 Apr 29 02:32 image-01.iso

hard to tell, why this was intended. why that rename() ended up in the code. but it also explains why the .bin file is destroyed in the process as mentioned in #2.

its just a renaming, so, no data loss. i guess the rename() ended up there for efficiency reasons.

on could argue its not "nice" to change any original data/filename and this behavior could be changed, bin im not convinced we must do this, because other programs like gzip work the same. default is remove the original file. option -k is provided to keep the original.

still the output dir should be respected, also for a rename.

michaelortmann commented 5 months ago

Also a good question, why using bin2iso for this case, when you could just change the file ending, because in this case iso is identical to bin.

dbedrenko commented 5 months ago

Thanks for the reply. Renaming a file from .bin to .iso is not a successful conversion. If you try to open such an ISO with an archive manager (e.g. file-roller) it cannot open it. When I try to play the .iso games I converted using bin2iso they do not work.

When I use bchunk to convert, it results in an .iso that is ~15% in smaller size, indicating that it's doing something else, not just renaming. Opening this .iso with file-roller shows the files and directories inside. All the games converted with bchunk work fine.

HVR88 commented 5 months ago

Also a good question, why using bin2iso for this case, when you could just change the file ending,

Because it's impossible to know if the bin is a single track unless you first open and look at the cue file.

And no one is going to look at the cue files ONE AT A TIME when you're operating on 100, 200 or 5000 files at one time, where some of them might be 1 track, a few hundred might be 2 tracks, a few hundred more might be 50 tracks, etc.

I think the bottom line is that bin2iso is not suitable for PS1 or PS2 bin files. Not sure what's then it's useful for, maybe CD music files only? Or standard PC-based ISO that were saved as BIN by some ancient CD ripping app.

Renaming a file from .bin to .iso is not a successful conversion.

bchunk takes a long time by comparison (especially on spinning disks and VM), but as far as I know, it's the only command-line tool that works and that can be used in batch. Some people use Windows to do conversions, but I don't know of any program for Windows that can do more than 1 file at a time. It would take a few years to do a whole PS2 collection that way. Or longer.

dbedrenko commented 5 months ago

bchunk is very fast for me: on my linux machine it converts a single track 666MB .iso to .bin in 2 seconds on an SSD.

HVR88 commented 5 months ago

I didn't say it was slow, just that it took "a long time" - bin2iso is so fast I can't even measure the speed, and it does an entire folder of bins in a few seconds (of course it's useless because it doesn't work properly). So let's just say comparatively slower when looking at thousands of files.

I've edited the previous post to make it clearer. 👌

As I'm working on a lot of files, I don't have them on any of my SSDs - right now they're on an UNRAID array and being processed by bchunk running inside an Ubuntu VM.

On my M1 Mac, running with only SSD it takes about 5-8 seconds for 6 bin files totalling 2.6GB :) I think my Mac might be able to do more than 1000 files in the time it takes the VM to do 1.

HVR88 commented 5 months ago

Unrelated: thank you for bringing up the slowness subject. It made me remember that I just added a USB3.1 PCIe card to my server which I can use to connect a portable SSD and then work on a batch of files using my Mac. Going to give that a try as the copying + conversion should still be much faster.