C#中有没有办法仅获取MP4文件的标头来读取它的元数据,而无需下载整个文件?
我在服务器上托管了一个我不知道的元数据的MP4文件 - 我只知道容器格式(MP4)。我需要知道音频/视频比特率信息,二手编解码器(即H.264)和音频比特率。该视频也可能缺少音频流,在这种情况下,其中一些信息将无法使用。
有没有一种方法可以使httpclient
同时读取并解析文件,以及当它完全读取标题时,请脱离连接?该文件可能很大(〜300MB),如果我唯一需要的信息是一开始,我就不想全部阅读它。
我已经想过要阅读getStreamAsync
返回的流,并在收集足够的信息时调用Distose
,但是有一个,但是是否有一个这个的库?我看了MP4的标题规范,这似乎相对复杂。如果有能力这样做的库,我不想重新发明轮子。
I have an MP4 file hosted on a server that I don't know the metadata of - I only know the container format (MP4). I need to know the audio/video bitrate information, the used codec (i.e. H.264), and the audio bitrate. The video can also lack an audio stream, and in that case, some of that information would be unavailable.
Is there a way to make a, say, HttpClient
read and parse the file from the server at the same time, and when it fully reads the header, disconnect? The file may be large (~300mb), and I don't want to read it in its entirety if the only information I need is a couple bytes from the beginning.
I've thought of reading the stream returned by GetStreamAsync
and building header information as we go, and then calling Dispose
when enough information is gathered, but is there a library for this? I've looked at MP4's header specification, and it seems relatively complex. I don't want to reinvent the wheel, if a library that is capable of doing this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论