比如我想查找第1000帧在mp3文件中的位置(字节数),我应该怎么做呢,怎么样找到第1000帧的帧头?
请各位帮忙,谢谢!

解决方案 »

  1.   

    要获得第1000帧必须知道之前所有帧的字节数,注意CBR和VBR两种文件区别
      

  2.   

    还是不太明白,那我怎样才能知道一个MP3文件是CBR还是VBR呢?
    请赐教
      

  3.   

    VBR是码率可变,一般在帧头有“xing”的标识,因为是XING公司的算法
    CBR是码率恒定,不变基本可以用帧长= 144×位率∕频率+帧长调节求得
    另还有ABR:每帧可变,但是平均变化恒定
      

  4.   

    VBR每帧长度156字节对吗?
    那也就是说我打开一个MP3文件后首先搜索有没有“xing”的字符,如果有按每帧156字节计算,
    如果没有就按CBR计算每帧长= 144×位率∕频率+帧长调节,
    那我怎样读位率,频率,帧长调节?
      

  5.   

    VBR是可变的you have to either go frame by frame and counts or use another mechanism for approximate count.这种费时,好在大部分mp3是CBR的
    typedef FrameHeader{
    unsigned int sync:11;//同步信息
    unsigned int version:2;//版本
    unsigned int layer:2;//层
    unsigned int protection:1;// CRC校验
    unsigned int bitrate:4;//位率
    unsigned int frequency:2;//频率
    unsigned int padding:1;//帧长调节
    unsigned int private:1;//保留字
    unsigned int mode:2;//声道模式
    unsigned int mode extension:2;//扩充模式
    unsigned int copyright:1;// 版权
    unsigned int original:1;//原版标志
    unsigned int emphasis:2;//强调模式
    }HEADER, *LPHEADER;
      

  6.   

    其实我就想做一个MP3切割器,但我在VC方面还是个菜鸟,CBR帧头是4个字节,频率只占2位,而我只会一个字节一个字节的读,按位应该怎么读呢?
    有相关的代码吗?
    THANK YOU
      

  7.   

    用左、右移位实现
    例:
    CFile file;
    file.seek(2,CFile::begin);
    byte buffer;
    memset(buffer,0,sizeof(buffer));
    file.Read(buffer,1);//读取位率所在字节
    buffer &= 0xF0;
    buffer>>=4;//右移4位即得位率
      

  8.   

    那我应该怎样在程序中区分VBR,CBR呢?
    是先在文件头部搜索有没有"xing"吗?
    我觉得这种方法很土啊,呵呵