0

次のパラメータに基づいて、ファイルの将来のサイズを見積もる方法が必要です。

  • ビット/サンプル
  • チャンネル数
  • サンプルレート
  • サンプル数
  • mp3 品質 (LAMEPreset)

NAudio.Lame パッケージを使用します。C#、.Net

int GetBytesAmountMp3(int framesAmount, WaveFormat format, LAMEPreset quality)
{
     var compressionFactor = 0.3;???
     return framesAmount * format.BlockAlign * ?;
}

圧縮係数を大まかに見積もる方法が必要です。

4

1 に答える 1

1

Output size prediction is at best approximate. Of the various modes (ABR, CBR, VBR) only CBR (Constant Bit Rate) has predictive output size. ABR (Adaptive Bit Rate) comes close most of the time, but can be quite different from the prediction in some cases. VBR is quality-based and can't really be predicted. There's a bit more information on all this here.

For the LAMEPreset settings (which are translated directly from the LAME headers) the ABR_* settings are simple. Each is a label for a number that relates to the average kilobits per second (Kbps) in the output. The output ratio for these is then:

double ratio = ((double)quality * 128) / format.averageBytesPerSecond;

(where quality * 128 is average bytes per second)

The rest of the settings produce VBR at various levels. The table here shows you the relationship between the numbers (V0 to V9) and the approximate output bit rate. LAMEPreset.V2 for instance produces roughly 190 Kbps output. The table also shows some of the named presets - STANDARD is the same as V2, etc. As noted in the source comments (see the source) the named presets are deprecated in LAME, I just didn't get around to marking them as such.

For a full list of what settings each preset uses, have a look at the LAME Source, specifically the apply_preset method (line 320).

于 2016-01-22T02:56:47.443 に答える