如何在 ASP.NET 中裁剪 mp3 + C#?
我正在使用 C# 的 ASP.NET 项目中。用户可以上传他们的 MP3(我无法控制编码)并指定样本大小和样本起点。保存时,系统需要根据提供的信息创建此 MP3 的样本。
所以问题是:如何在 ASP.NET + C# 中 Icrop mp3?
I am in an ASP.NET project using C#. The users can upload their MP3 (I have no control over the encoding) and specify a sample size and a sample starting point. On save, the system needs to create a sample of this MP3 based on the information provided.
So the question is: How can Icrop a mp3 in ASP.NET + C#??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
虽然您可以使用 .NET 音频库来执行此操作,但我认为最简单的方法是运行 < code>FFMpeg 或
MPlayer
为您进行裁剪,然后将文件发送回线路。例如,使用 FFMpeg,您可以执行类似的操作(来自 此处 出现到第 90 秒):
要启动 FFMpeg,请使用如下内容:
唯一的问题是需要相当长的时间,并且很难向用户报告进度。
While you could possibly use a .NET audio library to do this, I think the easiest way to do this would be to run a command like
FFMpeg
orMPlayer
to do the cropping for you, then send the file back down the line.For example, with FFMpeg, you can do something like this (from here crops up to the 90th second):
To start FFMpeg, use something like this:
The only problem is that it takes quite a while and it's hard to report progress back to the user.
您可以使用 MP3 帧标题分割文件。
使用简单的强力搜索,您可以将文件分割成单独的帧,并创建一个新的 MP3,长度如您所愿。
MP3 格式
You can split the file using the MP3 frame headers.
Using a simple brute force search you can split the file into separate frames and create a new MP3 that is as long as you wish.
MP3 Format