Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Encoding for a specific file size (Read 4509 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Encoding for a specific file size

Hi, I was wondering if there's any way to encode something in MP2 and have it come out to be a specific file size without a whole lot of trial and error. I'm trying to mod League of Legends to replace some voice files with new ones and I have it mostly figured out, but it's not working quite right. For instance, it will start playing some lines in the middle and then run into other lines at the end. The voice files are stored in a .fsb and I suspect it has something to do with the fact that the new files I'm inserting aren't the same size/length as the originals and therefore the offset isn't correct.  To fix it I would need to have the new clips be exactly or nearly exactly the same length as the originals, which takes me back to my original question. I know practically nothing about .fsb files so this is pretty much purely speculation.  Does anyone have a good way to do this or more information on how .fsbs work?

Thanks in advance.

(Note: I'm encoding it in MP2 simply because this guide said to. Other common file types may work as well)

Encoding for a specific file size

Reply #1
Quote
Hi, I was wondering if there's any way to encode something in MP2 and have it come out to be a specific file size without a whole lot of trial and error.


It's simple math:

Let's say you have track length of 1h 02m, which in seconds is equal to:

T = 1x60x60 + 2x60 = 3720 seconds

Than lets assume we have limited storage of 150 MB, which we calculate in bytes:

S = 150x1024x1024 = 157286400 bytes

and we need this number in bits, which is bytes multiplied by 8, so we have:

S = 157286400x8 = 1258291200 bits

Now we can calculate target bitrate and set encoder to it:

B = S/T = 338250 b/s

or

B = 338250/1024 ~ 330 Kb/s

So we can set encoder with anything lower than 330 Kb/s in that limited space

Encoding for a specific file size

Reply #2
Is there a specific encoder or program you could suggest for this? The one I was using just has a "quality" option that ranges from 0-100, which doesn't seem very useful.

Encoding for a specific file size

Reply #3
Is there a specific encoder or program you could suggest for this? The one I was using just has a "quality" option that ranges from 0-100, which doesn't seem very useful.


twolame is considered a pretty good mp2 encoder. 

That said, I suspect that whatever software you're using isn't meant for mp2 if its giving you choices between 0-100.

 

Encoding for a specific file size

Reply #4
Hm, it turns out the issue is actually that the fsb repacker I was using doesn't work right. Thanks to the people who replied, though.