![](/img/trans.png)
[英]How to get a list of existing directories in Azure Blob Storage container using c#?
[英]Get the duration of audio blob stored in azure container using C#
问题陈述:
在搜索了很多关于如何使用 C# 程序获取存储在 Azure 容器中的音频 blob 的持续时间之后,我正在与社区中的人们联系。
研究工作:
我在 C# 中看到了很多库(例如 NAudio、MediaInfo、WindowsAPICodePack-Shell 等),它们有助于获取媒体文件的持续时间,但仅支持存储在本地系统路径中的媒体文件,而不支持放置的音频在云端。
从 blob 的角度来看,它确实给出了 blob 的 length 属性,它以字节为单位返回大小,这不能满足我的要求。
请建议是否有任何方法可以获取音频 blob 的持续时间。 提前致谢!
ffprobe工具(来自 FFmpeg 系列)可以解决问题。 此工具旨在检查媒体文件并从中返回您需要的所有信息。
它可以将输入作为 URL 输入,因此您可以将 blob 文件提供给它(假设 URL 已打开并且不需要身份验证)。
这个网站 ( https://trac.ffmpeg.org/wiki/FFprobeTips ) 有一些关于如何使用 ffprobe 的重要提示。
从 C# 开始,您可以使用Process.Start([pathToFFProbe], [Arguments])
简单地调用 .exe。 如果您使用的是 Mac,请使用 Homebrew brew install FFmpeg
获取工具。 在其他平台上应该同样容易。
Arguments such as -o JSON
will output the data in a JSON format that you can parse in your own application to perform any further calculations.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.