Author Topic: BinExtractor  (Read 6831 times)

BoringName

  • Sr. Member
  • ****
  • Posts: 916
BinExtractor.zip

This is a small utility to extract images from a foobar bin file. I threw it together pretty quickly and I don't intend on doing anything else with it.

The open file button will open to the folder the EXE is placed in so probably best to place it in the same folder with the bin files you want to extract.

There are toggle buttons for Show Background, Show LED, Show Needle, Show left and Show right. These determine what will be displayed on the screen and what will be extracted. You can change the current frame with the mouse wheel or by using the slider at the bottom.

Export frame will extract the current frame. Depending on which toggles are enabled it will extract Needle<Frame No.>.png, LED<Frame No>.png and background.png to a "Frames" subfolder. If this folder doesn't exist it will be created in the same directory the EXE is in. Files for the right meter will have an "R" appended to the start of the filename.

Export All will export all frames based on the toggle buttons except it will ignore the Show Left and Show Right toggles. It will export both left and right frames.

Warning: This can result in a lot of files being created, over 4000 in some cases. Number of frames x 4. Left needle, left LED, right needle, right LED. There are no confirmations,  warnings or cancel buttons so be careful what you click on.

If you have a skin with LED and no needles make sure you untoggle the Show needle button before clicking export all.

You may find some needle images have part of the background image around them, that's just how they are stored in the bin file, it's not an error with the program.

ilovefb2k

  • Newbie
  • *
  • Posts: 5
BinExtractor.zip

This is a small utility to extract images from a foobar bin file. I threw it together pretty quickly and I don't intend on doing anything else with it.

The open file button will open to the folder the EXE is placed in so probably best to place it in the same folder with the bin files you want to extract.

There are toggle buttons for Show Background, Show LED, Show Needle, Show left and Show right. These determine what will be displayed on the screen and what will be extracted. You can change the current frame with the mouse wheel or by using the slider at the bottom.

Export frame will extract the current frame. Depending on which toggles are enabled it will extract Needle<Frame No.>.png, LED<Frame No>.png and background.png to a "Frames" subfolder. If this folder doesn't exist it will be created in the same directory the EXE is in. Files for the right meter will have an "R" appended to the start of the filename.

Export All will export all frames based on the toggle buttons except it will ignore the Show Left and Show Right toggles. It will export both left and right frames.

Warning: This can result in a lot of files being created, over 4000 in some cases. Number of frames x 4. Left needle, left LED, right needle, right LED. There are no confirmations,  warnings or cancel buttons so be careful what you click on.

If you have a skin with LED and no needles make sure you untoggle the Show needle button before clicking export all.

You may find some needle images have part of the background image around them, that's just how they are stored in the bin file, it's not an error with the program.
hi @BoringName,
thank you for creating BinExtractor utility, that enables us to have a look inside fb2k's VU Meter BIN.
just a wishlist : could you please compile it as a command-line utility ?
in detail, example: c:\BinExtractor.exe  c:\fb2k VU Meter\fb2k1000.bin
=> all frames , including background, needles and LEDS (if any) will be extracted into c:\fb2k VU Meter\fb2k1000\left and c:\fb2k VU Meter\fb2k1000\right
reason:  we are developing a script to play around with VU meter, but get stuck with fb2k Vu meter BIN.

regards
@ilovefb2k

BoringName

  • Sr. Member
  • ****
  • Posts: 916
just a wishlist : could you please compile it as a command-line utility ?

I threw it together pretty quickly and I don't intend on doing anything else with it.

Sorry.

If you're trying to automate reverse engineering a bin file I don't think it's going to work as I've found a lot of the needle images do not extract the same as the original. VUEditor seems to do some kind of anti-aliasing when creating the bin file and the needle images tend to have an outline added to them that matches the background image at the position of the current frame.

ilovefb2k

  • Newbie
  • *
  • Posts: 5
just a wishlist : could you please compile it as a command-line utility ?

I threw it together pretty quickly and I don't intend on doing anything else with it.

Sorry.

If you're trying to automate reverse engineering a bin file I don't think it's going to work as I've found a lot of the needle images do not extract the same as the original. VUEditor seems to do some kind of anti-aliasing when creating the bin file and the needle images tend to have an outline added to them that matches the background image at the position of the current frame.
hi @BoringName,
thank you very much for your very quick reply.
we have scoured the Internet and found your tool as the ultimate solution. as such, we surely will not take it seriously as just want to play around with beautiful fb2k Vu Meter skins.
we hope that you will give it a try later on. for now on, your BinExtractor.exe tool is still the best way to extract that skins.
can we share that tool with others at https://hydrogenaud.io and https://vnav.vn/ 4rums ?
wish you all the best
@ilovefb2k

BoringName

  • Sr. Member
  • ****
  • Posts: 916
can we share that tool with others at https://hydrogenaud.io and https://vnav.vn/ 4rums ?

No problems with you sharing it. Just make sure to warn people that extract all can create upwards of 4000 files.

I've just found the Jscript thread on Hydrogenaud.io so I'll have a read through and reply there if I think of anything that can help. There is probably a better option than extracting all those images from the BIN file.

ilovefb2k

  • Newbie
  • *
  • Posts: 5
can we share that tool with others at https://hydrogenaud.io and https://vnav.vn/ 4rums ?

No problems with you sharing it. Just make sure to warn people that extract all can create upwards of 4000 files.

I've just found the Jscript thread on Hydrogenaud.io so I'll have a read through and reply there if I think of anything that can help. There is probably a better option than extracting all those images from the BIN file.
hi @BoringName
wow, it is more than fantastic with your positive feedback.
thank you very much.
regards
@ilovefb2k

BoringName

  • Sr. Member
  • ****
  • Posts: 916
I didn't plan on doing anything with the extractor but now I've gone and updated it....
BinExtractor1.1.zip

BinExtractor will now take 2 command line arguments. The first is the path to the bin file and the second is a frame number.

eg)
BinExtractor.exe "C:\FoobarSkins\McIntosh.bin" 400

This will extract the background image, needle and LED frame for frame number 400 into the following folders
C:\FoobarSkins\McIntosh\left
C:\FoobarSkins\McIntosh\right

If there is no right meter the folder will be empty.
The frame number argument starts at zero so if a skin has 1024 frames and you want the last one you need to use 1023.

If the frame number argument is omitted it will extract all the frames. As previously mentioned this has the potential to create A LOT of files, over 4000.

If you specify a frame number argument that is larger than the number of frames in the specified bin file, it will extract all frames.

If you extract a bin file that only has LEDs and no Needles, it will still create a needle file for each frame, they will just be blank.

This is provided as is, use at your own risk. It doesn't really check for errors and if the arguments are wrong it will just exit without letting you know why. Make sure you enclose the bin path in quotes if it has any spaces in it.

boroda

  • Hero Member
  • *****
  • Posts: 5171
BoringName, wouldn't work approach to extract say every 10th frame? to don't extract frame by frame manually and don't extract all.

BoringName

  • Sr. Member
  • ****
  • Posts: 916
BoringName, wouldn't work approach to extract say every 10th frame? to don't extract frame by frame manually and don't extract all.

Really depends on the intended use. If you just want the images to create your own skin or convert it to a different format, you just need 1 frame that has the best image of the needle.

The user I made the change for on the Hydrogenaudio forums wants to extract all the images and reproduce the meter that way. I did warn them it's not the best way to do it but that's what they are going with.

Neither of the 2 options above would benefit from just getting every 10th frame as far as I can tell.

The only useful piece of information stored in the bin file is the Zero frame number. In terms of how the meter moves anyway. It uses the number of frames to create the scale for the meter. if you take 2 meters that are the same except one starts at minus 20 and the other minus 40. The peak value for -20 is 0.10 so the first 10% of frames will show the needle pointing at minus 20. -40 is 0.01 so the first 1% of frames will show the needle pointing at minus 40.

I don't know if I have explained that properly but the point is, if you want to reproduce the skins movement just from images, you need to export all the frames. Otherwise you need to make assumptions and do a bunch of angle calculations to try and replicate the movement.

boroda

  • Hero Member
  • *****
  • Posts: 5171
i.e. if i use 400 of 4000 frames, then needle movement will be jaggy, and it's useless?

hiccup

  • Hero Member
  • *****
  • Posts: 9109
I didn't plan on doing anything with the extractor but now I've gone and updated it....
BinExtractor1.1.zip
This is a nice and interesting piece of work.
But personally I am wondering if it will really make it easier to build a VU meter skin using an existing .bin file.

By which I mean, if I understand correctly what it can and can not do:
It won't be able to extract perfect images for needle and glass?
It will provide something that can be used as a starting point, but it will require some image editing capabilities to create something useful from them.

What I would be doing (and partly have been doing with my remakes of the Hartmann & Braun and Accuphase skins) :
When loading VU meter in foobar2000, you can adjust the size of the VU meter panel so it's pixel-perfect.
(the right-click menu has a field that shows that information)
Then (by e.g. using some test tone) you can position the needle in an (or a couple of) optimal position(s) to make a screenshot of it.
After that, using something like Photoshop, it shouldn't be hard to create an isolated image of the needle.
Pretty much the same for background and glass.

And about the needle action:
I'm not sure the original needle action is always great and should be tried to replicate.
Why not just use the VUEditor tool to create a nice curve for it?

So I am honestly wondering, will this tool actually be making things easier, or allow for getting better results compared to using screenshots, Photoshop and VUeditor?

PS
Would it be an idea to split posts about this BinExtractor into a new and separate topic?
It would help in keeping this topic more on-topic, and making it easier to navigate through when trying to find relevant posts on the VUMeter plugin.
Last Edit: November 22, 2024, 09:54:41 AM by hiccup

hiccup

  • Hero Member
  • *****
  • Posts: 9109
Would it be an idea to split posts about this BinExtractor into a new and separate topic?
Maybe. I really don't want to spend any more time on it because of the reasons above.
Fair enough.
Still I am sure people will be curious about it now or in the future.
So people will be looking for it, and probably will have new questions.
If it had its own topic, people could more easily find it without the need of going through (currently) 400+ posts in this VUMeter topic.

You could then also clearly state there that development and support has officially ended. (if that is indeed the case)
 
Last Edit: November 22, 2024, 12:58:58 PM by hiccup

ilovefb2k

  • Newbie
  • *
  • Posts: 5
I didn't plan on doing anything with the extractor but now I've gone and updated it....
BinExtractor1.1.zip

BinExtractor will now take 2 command line arguments. The first is the path to the bin file and the second is a frame number.

eg)
BinExtractor.exe "C:\FoobarSkins\McIntosh.bin" 400

This will extract the background image, needle and LED frame for frame number 400 into the following folders
C:\FoobarSkins\McIntosh\left
C:\FoobarSkins\McIntosh\right

If there is no right meter the folder will be empty.
The frame number argument starts at zero so if a skin has 1024 frames and you want the last one you need to use 1023.

If the frame number argument is omitted it will extract all the frames. As previously mentioned this has the potential to create A LOT of files, over 4000.

If you specify a frame number argument that is larger than the number of frames in the specified bin file, it will extract all frames.

If you extract a bin file that only has LEDs and no Needles, it will still create a needle file for each frame, they will just be blank.

This is provided as is, use at your own risk. It doesn't really check for errors and if the arguments are wrong it will just exit without letting you know why. Make sure you enclose the bin path in quotes if it has any spaces in it.

hi @BoringName,
Thank you very very much for your help. without your tool, we can not do anything with fb2k Vu Meter.
But your have just made it more fantastic, we can now extract the BIN file on-the-fly,  it works flawlessly.
again, thank you a lot for your time.

wish your all the best and a very happy, enjoyable weekend.
regards
@ilovefb2k

BoringName

  • Sr. Member
  • ****
  • Posts: 916
f it had its own topic, people could more easily find it without the need of going through (currently) 400+ posts in this VUMeter topic.

Probably the best option at this point. Can a mod move all the binextractor posts into a designated thread or should I create one first for them to move it to?

In other news, I figured out how to write a header into the LZMA file that works. I think I'll post that on the sharpCompress authors github so they can add it into the library.

The benefit of this is I can repackage a bin that used BZIP2 into one that uses LZMA without needing the source files or using VUEditor. I don't really know how useful that is in the scheme of things as most existing skins are small and load fast regardless of the compression used. Anyway I thought it was pretty cool getting that worked out.

 

hiccup

  • Hero Member
  • *****
  • Posts: 9109
Thank you very very much for your help. without your tool, we can not do anything with fb2k Vu Meter.
But your have just made it more fantastic, we can now extract the BIN file on-the-fly,  it works flawlessly.
I'm curious, what is your end-goal for using this BinExtractor tool?
foobar2000's VU meter plugins are (obviously) working fine using .bin VU meters.
So what is it that you do with the extracted images exactly?