MP3比特率存储在帧头的第3个字节中,因此一个选项是搜索值为255的第一个字节(理论上应该没有其他字节,之前所有比特都设置为1)并且比特率应该存储为2之后的字节.以下代码执行此操作:
program Project1;
{$APPTYPE CONSOLE}
uses
Classes, SysUtils;
const
BIT_RATE_TABLE: array [0..15] of Integer =
(0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0);
var
B: Byte;
begin
with TFileStream.Create(ParamStr(1), fmOpenRead) do begin
try
Position := 0;
repeat
Read(B, 1);
until B = 255;
Position := Position + 1;
Read(B, 1);
Writeln(BIT_RATE_TABLE[B shr 4]);
finally
Free;
end;
end;
end.
Run Code Online (Sandbox Code Playgroud)
请注意,这只能找到第一帧的比特率.
您可以在此处找到更多详细信息
| 归档时间: |
|
| 查看次数: |
3477 次 |
| 最近记录: |