gpt4 book ai didi

c++ - 媒体基础 SinkWriter (MP4 FastStart)

转载 作者:行者123 更新时间:2023-11-28 02:35:19 24 4
gpt4 key购买 nike

我正在使用 Media Foundation 在一系列过滤器之后从输入 MP4 创建 MP4 (H264 + AAC) 输出文件。视频的创建工作完美,视频在本地复制没有问题。问题在于,当远程执行时(通过网络播放器甚至 VLC),视频在完全下载之前不会开始播放。

我检查并确认托管该文件的 http 网站支持 Accepts-Ranges header 字段,一段时间后我发现问题的发生是因为该文件尚未使用允许的“快速启动”标志创建视频的渐进式下载。

我尝试在线搜索解决方案,但一直找不到通过 Media Foundation 的 Sinkwriter 应用该标志的方法。任何想法? (我不能使用任何外部应用程序来执行此操作,因为此代码将在 Windows 应用商店环境中运行)

最佳答案

渐进式下载要求 moov 框在 MPEG-4 文件中位于 mdat 框之前,这通常在生成文件时需要额外的努力,而不是媒体基础的默认行为。

媒体基金会介绍 MF_MPEG4SINK_MOOV_BEFORE_MDAT attribute处理这个:

The default behavior of the mpeg4 media sink is to write 'moov' after 'mdat' box. Setting this attribute causes the generated file to write 'moov' before 'mdat' box.

In order for the mpeg4 sink to use this attribute, the byte stream passed in must not be slow seek or remote for .

This feature involves an additional file copying/remuxing.

注意最低要求。或者,您需要对文件进行后处理以将 moov 框移动到开头。

另见:

关于c++ - 媒体基础 SinkWriter (MP4 FastStart),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27668755/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com