如何使用C#代码压缩音频文件? [英] How Can I Compress Audio File Using C# Code ?

查看:231
本文介绍了如何使用C#代码压缩音频文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

我想在压缩音频文件后使用C#代码压缩音频文件(缩小音频文件的大小),该音频文件在android部分解压缩。





您能否使用c#代码建议压缩音频文件的参考链接或代码,并使用安卓代码解压缩。





提前致谢。

Laxman Prajapati。

Hello guys.
I want to compress audio file (reduce size of audio file) using C# code after compress audio file , that audio file are decompress in android part.


Can you please suggest reference link or code for compress audio file using c# Code and decompress using android code .


Thanks in advance.
Laxman Prajapati .

推荐答案

很多,你可以't。

大多数音乐文件格式已经过压缩,现有文件大幅减少的唯一方法是降低质量 - 这是不可逆的。



您可以尝试将它们重新编码为不同的格式(MP3 - > WMA或FLAC或许)但即使这样,您也不能保证得到一个较小的文件 - 这取决于实际的音乐包含在文件中。
Pretty much, you can't.
Most music file formats are compressed already, and the only way to make significant size reductions on existing files is to reduce the quality - which is not reversible.

You can try recoding them into different formats (MP3 -> WMA or FLAC perhaps) but even then you aren't guaranteed to get a smaller file as a result - it will depend on the actual music contained in the file.


对于大多数用途,原始音频(WAV)nee ds要压缩。有许多媒体压缩标准,容器和算法。我只是不想概述它们并讨论兼容性;这个话题太大了。不幸的是,在大多数纯粹的音频设备上,主导的格式是严重过时的MP3,其次是专有的微软WMA。在其他媒体中,特别是在视频中,这些算法已经变得罕见,现在更好的MPEG4音频占主导地位。如果您的设备使用的是众所周知的操作系统,例如Windows或Android,则您拥有更多自由。无论如何,你有正确压缩的媒体文件,它的进一步压缩是没有意义的。



最好的库和各种媒体转换的实用程序是FFMpeg或libavcodec:

http://en.wikipedia.org/wiki/FFmpeg [ ^ ],

http://ffmpeg.org/ [ ^ ] ,

http://en.wikipedia.org/wiki/Libavcodec [ ^ ],

http://libav.org/ [ ^ ]。



它可以在许多平台上使用,包括微软和Android:

http://sourceforge.net/projects/ffmpeg4android [ ^ ]。



您可以使用.NET包装器,而不是通过启动进程(也是一种解决方案)来使用该实用程序。请参阅我以前的回答:如何在C#中将图像转换为视频 [ ^ ]。



-SA
For most purposes, "raw" audio ("WAV") needs to be compressed. There is a good number of media compression standards, containers and algorithms. I just don't want to overview them all and discuss compatibility; this topic is too big. On most purely audio devices, unfortunately, the dominated format is badly obsolete MP3, followed by proprietary Microsoft WMA. In other media, notably in video, these algorithms have become rare, now better MPEG4 audio is dominating. If your devices use are well-known OS, such as Windows or Android, you have much more freedom. Anyway, of you have properly compressed media file, its further compression is pointless.

Best library and the utility for all kinds of media conversion is FFMpeg or libavcodec:
http://en.wikipedia.org/wiki/FFmpeg[^],
http://ffmpeg.org/[^],
http://en.wikipedia.org/wiki/Libavcodec[^],
http://libav.org/[^].

It is available on many platforms, including Microsoft's, and on Android:
http://sourceforge.net/projects/ffmpeg4android[^].

Instead of using the utility by starting a process (which is also a solution), you can use a .NET wrapper. Please see my past answer: how to convert image to video in C#[^].

—SA


这篇关于如何使用C#代码压缩音频文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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