I've been digging through the Media Source Extension examples on the internet and haven't quite figured out a way to adapt them to my needs.
我一直在互联网上挖掘媒体源扩展的例子,但还没有找到一种方法来适应我的需要。
I'm looking to take a locally cached MP4/WebM video (w/ 100% keyframes and 1:1 ratio of clusters/atoms to keyframes) and decode/display them non-sequentially (ie. frame 10, 400, 2, 100, etc.) and to be able to render these non-sequential frames on demand at rates from 0-60fps. The simple non-MSE approach using the currentTime property fails due to the latency in setting this property and getting a frame displayed.
我正在寻找一个本地缓存的MP4/WebM视频(w/ 100%关键帧和集群/原子对关键帧的1:1比例),并解码/显示它们。帧10、400、2、100等等)并且能够根据需要以0-60fps的速度呈现这些非连续帧。使用currentTime属性的简单非mse方法由于设置此属性和显示一个框架的延迟而失败。
I realize this is totally outside normal expectations for video playback, but my application requires this type of non-sequential high speed playback. Ideally I can do this with h264 for GPU acceleration but I realize there could be some platform specific GPU buffers to contend with, though it seems that a zero frame buffer should be possible (see here). I am hoping that MSE can accomplish this non-sequential high framerate low latency playback, but I know I'm asking for a lot.
我意识到这完全超出了视频回放的正常预期,但是我的应用程序需要这种非连续的高速回放。理想情况下,我可以用h264来实现GPU加速,但我意识到可能会有一些特定于平台的GPU缓冲区来应付,尽管看起来应该有一个零帧缓冲区(见这里)。我希望MSE能够实现这种非顺序的高帧速率低延迟回放,但我知道我需要很多。
Questions:
问题:
Will appendBuffer accept a single WebM cluster / MP4 Atom made up of a single keyframe, and also be able to decode at a high frequency (60fps)?
appendBuffer会接受由单个关键帧组成的单个WebM集群/ MP4原子,并且能够在高频(60fps)下进行解码吗?
Do you think what I'm trying to do is possible in the browser?
你认为我想在浏览器中做的事情是可能的吗?
Any help, insight, or code suggestions/examples would be much appreciated.
任何帮助、见解或代码建议/示例都将非常感谢。
Thanks!
谢谢!
I was able to get MSE mostly working with single frame MP4 fragments in Firefox, Edge, and Chrome. However, Chrome seems to be running into the frame buffer issue linked above and I haven't found a way to pre-process a MP4 to invoke this "low delay" mode. Anyone have any clues if it's possible to create such a file with an existing tool like MP4Box?
我可以让MSE在Firefox、Edge和Chrome中使用单个的MP4片段。不过,Chrome似乎遇到了上面链接的框架缓冲区问题,我还没有找到一种方法来对MP4进行预处理,以调用这种“低延迟”模式。如果有可能用MP4Box这样的工具创建这样的文件,有人知道吗?
Firefox and Edge decode/display the individual frames immediately with very little latency, but of course something breaks once I load this video into a Three.js WebGL project (no video output, no errors). I'm ignoring this for now as I'd much rather have things working on Chrome as I'll be targeting Android as well.
Firefox和Edge立即解码/显示各个帧,延迟非常小,但当然,当我将这个视频加载到3时,会出现一些问题。js WebGL项目(没有视频输出,没有错误)。我暂时忽略了这一点,因为我更希望Chrome能运行,因为我的目标也是Android。
4
I was able to get this working pretty well. The key was getting Chrome to enter its "low delay" mode by muxing a specially crafted MP4 file using modified mp4box sources. I added one line in movie_fragments.c so it read:
我能让它运行得很好。关键是要让Chrome进入“低延迟”模式,通过使用修改后的mp4box源对一个特制的MP4文件进行muxing。我在movie_fragment中添加了一行。c它读:
if (movie->moov->mvex->mehd && movie->moov->mvex->mehd->fragment_duration) {
trex->track->Header->duration = 0;
Media_SetDuration(trex->track);
movie->moov->mvex->mehd->fragment_duration = 0;
}
Now every MP4 created will have the MEHD fragment duration set to 0 which causes Chrome to process it as a live stream.
现在每创建一个MP4将会有MEHD片段持续时间设置为0,这使得Chrome将其作为一个实时流来处理。
I still have one remaining issue related to the timestampOffset property which in combination with the FPS set in the media fragments control the playback speed. Since I'm looking to control the FPS directly I don't want any added delay from the MSE playback engine. I'll post a separate question here to address that.
我还有一个问题与timestampOffset属性有关,它与媒体片段中的FPS集一起控制回放速度。由于我希望直接控制FPS,所以我不希望MSE回放引擎增加任何延迟。我将在这里提出一个单独的问题来解决这个问题。
Thanks, Dustin
谢谢你,达斯汀
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2016/04/01/33d26641a371ce717943eb56da1c7590.html。