以编程方式修剪MP3 [英] Trim an MP3 Programmatically

查看:102
本文介绍了以编程方式修剪MP3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以编程方式修剪mp3文件的最佳方法是什么.例如,说我想摆脱前2分钟或最后2分钟,或两者都摆脱.是否可以通过.NET做到这一点?还是.NET调用命令行工具?

What is the best way to trim a mp3 file programmatically. For example, say I want to get rid of the first 2 minutes or last 2 minutes or both. Is there a good way to do this from .NET? Or .NET calling out to a command line tool?

推荐答案

修剪MP3文件有两种方法:

There are two approaches to trimming MP3 files:

首先,将其转换为WAV,修剪掉不需要的样本,然后再转换回MP3.缺点是在过程中质量将有非常轻微的损失.好处是您会发现很多命令行工具可以为您进行转换,而您只需要自己修剪WAV文件即可(

First, convert to WAV, trim off the samples you don't want, and then convert back to MP3. The disadvantage is that there will be a very slight loss of quality in the process. The advantage is that you will find plenty of command line tools to do the conversions for you, leaving you simply to trim the WAV file yourself (NAudio would let you do that).

第二,自己解析MP3帧,然后丢弃整个帧.它不会给您太多粒度,但是在过程中不会损失质量.您还需要能够理解CBR和VBR MP3帧以及ID3帧的格式.周围有各种各样的.NET库可以读取这些内容,但是您仍然需要自己编写大量代码.

Second, parse the MP3 frames themselves, and throw away whole frames. It doesn't give you so much granularity but there is no loss of quality in the process. You also need to be able to understand the format of the CBR and VBR MP3 frames as well as ID3 frames. There are various .NET libraries around that can read these, but you will still need to write a fair amount of code yourself.

这篇关于以编程方式修剪MP3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆