自动压缩多个 MP3 的最佳流程

发布于 2024-07-08 20:17:57 字数 771 浏览 5 评论 0原文

我有一个项目需要一个相当复杂的过程,我想确保我知道做到这一点的最佳方法。 我将 ASP.net C# 与 Adob​​e Flex 3 结合使用。应用程序服务器是 Mosso(云服务器),文件存储服务器是 Amazon S3。 现有网站可以在 NoiseTrade.com 查看

我需要这样做:

  • 允许用户将 MP3 文件上传到 “小部件”
  • 用户上传专辑后的 相册/小部件,我需要 自动压缩mp3(对于其他 用户下载)并上传 连同 mp3 曲目一起压缩到 Amazon S3

我实际上已经可以使用此功能(使用 Flex 中的客户端处理),但由于 Adob​​e 的 flash 10“安全”更新,该功能不再有效。 所以现在我需要实现这个服务器端。

我想这样做的方法是:

  • 将 mp3 存储在临时文件夹中 在应用程序服务器上当
  • 艺术家“发布”创建一个 该文件夹中文件的 zip 使用 ac# 库
  • 启动亚马逊 S3 上传过程(zip 和 mp3) 并在出现时向用户发送电子邮件 完成(以及删除 我发现这种方法的

主要问题是,如果用户稍后删除或添加曲目,我将必须更新 zip 文件,但临时文件将不再存在。

我不知道执行此操作的最佳方法,并且非常感谢您提供的任何建议。

谢谢!

I've got a project which requires a fairly complicated process and I want to make sure I know the best way to do this. I'm using ASP.net C# with Adobe Flex 3. The app server is Mosso (cloud server) and the file storage server is Amazon S3. The existing site can be viewed at NoiseTrade.com

I need to do this:

  • Allow users to upload MP3 files to
    an album "widget"
  • After the user has uploaded their
    album/widget, I need to
    automatically zip the mp3 (for other
    users to download) and upload the
    zip along with the mp3 tracks to
    Amazon S3

I actually have this working already (using client side processing in Flex) but this no longer works because of Adobe's flash 10 "security" update. So now I need to implement this server-side.

The way I am thinking of doing this is:

  • Store the mp3 in a temporary folder
    on the app server
  • When the artist "publishes" create a
    zip of the files in that folder
    using a c# library
  • Start the amazon S3 upload process (zip and mp3s)
    and email the user when it is
    finished (as well as deleting the
    temporary folder)

The major problem I see with this approach is that if a user deletes or adds a track later on I'll have to update the zip file but the temporary files will not longer exist.

I'm at a loss at the best way to do this and would appreciate any advice you might have.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

傲鸠 2024-07-15 20:17:57

如果用户添加或删除曲目,则更新 zip 但没有临时文件,这让我怀疑您想要构建包含多个曲目(可能是完整专辑)的 zip。 如果这是不正确的,并且您只是将一个 mp3 放入每个 zip 中,那么 StingyJack 是对的,您最终可能会通过压缩来使文件(稍微)变大,而不是变小。

如果我的解释是正确的,那么你很幸运。 命令行 zip 工具经常具有可用于向现有 zip 存档添加文件或从现有 zip 存档中删除文件的标志。 您尚未说明您使用哪个库或其他方法来进行压缩,但我希望它也可能具有此功能。

The bit about updating the zip but not having the temporary files if the user adds or removes a track leads me to suspect that you want to build zips containing multiple tracks, possibly complete albums. If this is incorrect and you're just putting a single mp3 into each zip, then StingyJack is right and you'll probably end up making the file (slightly) larger rather than smaller by zipping it.

If my interpretation is correct, then you're in luck. Command-line zip tools frequently have flags which can be used to add files to or delete files from an existing zip archive. You have not stated which library or other method you're using to do the zipping, but I expect that it probably has this capability as well.

赴月观长安 2024-07-15 20:17:57

MP3 是经过压缩的。 为什么要费力地拉拉链呢?

MP3's are compressed. Why bother zipping them?

孤独难免 2024-07-15 20:17:57

我想说的是,没有必要压缩压缩文件格式,您只需让文件大小减少百分之五,或多或少。 Mp3 本质上并没有真正压缩,而是已经压缩了大部分可能的数据。

I would say it is not necessary to zip a compressed file format, you are only gong to get a five percent reduction in filesize, give or take a little. Mp3's dont really zip up by their nature the have compressed most of the possible data already.

明天过后 2024-07-15 20:17:57

DotNetZip 可以压缩来自 C#/ASP.NET 的文件。 我同意之前关于 MP3 压缩性的海报。 出于这个原因,DotNetZip 将自动跳过 MP3 压缩,而仅存储文件。 除了压缩之外,使用 zip 作为打包/存档容器仍然可能很有趣。

如果您稍后更改 zip 文件(用户添加曲目),您可以从 S3 获取 .zip 文件,然后更新它。 DotNetZip 也可以更新 zip 文件。 但在这种情况下,您需要支付进出 S3 的传输费用。

DotNetZip 可以通过内存中的 zip 处理来完成所有这些工作 - 尽管这对于包含大量 MP3 和大量并发用户的大型档案来说可能不可行。

DotNetZip can zip up files from C#/ASP.NET. I concur with the prior posters regarding compressibility of MP3s. DotNetZip will automatically skip compression on MP3, and just store the file, just for this reason. It still may be interesting to use a zip as a packaging/archive container, aside from the compression.

If you change the zip file later (user adds a track), you could grab the .zip file from S3, and just update it. DotNetZip can update zip files, too. But in this case you would have to pay for the transfer cost into and out of S3.

DotNetZip can do all of this with in-memory handling of the zips - though that may not be feasible for large archives with lots of MP3s and lots of concurrent users.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文