代码之家  ›  专栏  ›  技术社区  ›  James

如何用C#合并/加入MP3文件?

  •  3
  • James  · 技术社区  · 17 年前

    4 回复  |  直到 15 年前
        1
  •  6
  •   Mark Heath    15 年前

    NAudio :

    public static void Combine(string[] inputFiles, Stream output)
    {
        foreach (string file in inputFiles)
        {
            Mp3FileReader reader = new Mp3FileReader(file);
            if ((output.Position == 0) && (reader.Id3v2Tag != null))
            {
                output.Write(reader.Id3v2Tag.RawData, 0, reader.Id3v2Tag.RawData.Length);
            }
            Mp3Frame frame;
            while ((frame = reader.ReadNextFrame()) != null)
            {
                output.Write(frame.RawData, 0, frame.RawData.Length);
            }
        }
    }
    

    here

        2
  •  0
  •   Peter Mortensen Pieter Jan Bonestroo    15 年前

    MP3文件由“帧”组成,每个帧代表一小段(我认为大约25毫秒)的音频。

        3
  •  0
  •   Jeff Yates    17 年前

        4
  •  -1
  •   Community Mohan Dere    9 年前

    copy /b *.mp3 c:\new.mp3
    

    最好将流连接起来。这里已经回答了这个问题: What would be the fastest way to concatenate three files in C#?

    推荐文章