实现音频播放的最佳方式

发布于 2024-09-07 05:03:05 字数 596 浏览 12 评论 0原文

我正在开发一个可以读取文件路径并播放音频文件的应用程序。我试图通过使用现有的编解码器和免费/开放的实用程序来使其尽可能简单。我想要一些关于执行此操作的最佳方法的建议。我有两个想法,都涉及 FFmpeg:

  1. 创建一个简单的 GUI,允许用户读取要播放的文件中的传递,然后在后台运行 ffplay.exe 进程来播放文件。
  2. 通过使用 libavcodec 并根据其可用的功能来更深入地了解我的项目。

我对此只有几个主要目标。

  • 能够读入并播放多个文件,文件之间没有间断 在
  • 曲目内的任意位置开始播放(基于总持续时间的百分比)
  • 在任意时间后停止播放,并移至下一个曲目

我的两个曲目中的哪一个对于这个项目来说,方法似乎最实用?您是否建议有更好的(或者可能功能较少的)FFmpeg 替代方案?

这是针对用 C# 编写的 Windows 应用程序。

编辑:我开始使用 FFmpeg 的原因之一是它可以处理多种文件类型,特别是 MP3、AAC、Flac。

Edit2:如果使用 libavcode.dll 是最佳选择,那么获取有关在 C# 中实现该方法的一些信息也会很有帮助。

I'm working on an application that will read in file paths and play audio files. I'm trying to keep this as simple as possible--by using existing codecs and free/open utilities. I'd like some suggestions on the best way to do this. I've had two ideas, both involving FFmpeg:

  1. Create a simple GUI that allows the user to read pass in file(s) to be played, and then a ffplay.exe process is run in the background to play the file(s).
  2. Go more in-depth by just using libavcodec and basing my project off the functionality available with that.

There are only a few main goals I have for this.

  • Be able to read in and play multiple files without breaks between them
  • Start playback at an arbitrary spot (based on a percent of total duration) within the track
  • Stop playback after an arbitrary amount of time, and move to the next track

Which of my two methods seem the most practical for this project? Is there a better--or perhaps less feature-intensive--alternative to FFmpeg that you would suggest.

This is for a Windows application written in C#.

Edit: One of the reasons that I started with FFmpeg is that it can handle many file types, notably MP3, AAC, Flac.

Edit2: If the use of libavcode.dll is the best option, it would also be helpful to get some info on implementing that in C#.

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

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

发布评论

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

评论(1

舂唻埖巳落 2024-09-14 05:03:05

BASS 音频库 具有 C# 绑定,并且可以通过插件与常见音频格式(例如 MP3)很好地配合对于其他格式(例如 AAC)。

但是,对于商业开发,您需要许可证才能使用 BASS。

The BASS audio library has C# bindings and works very well with common audio formats (e.g. MP3) with plug-ins for other formats (e.g. AAC).

However, for commercial development, you require a license to use BASS.

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