簡體   English   中英

我可以在HTML5視頻中獲取當前幀的編號嗎?

[英]Can I get the number of the current frame in an HTML5 video?

我目前正在嘗試自定義HTML5視頻播放器,以便我可以添加一個返回當前幀編號的按鈕。

假設我有一個持續90秒的30fps視頻。 當我點擊那個按鈕時,我想讓它打印出當前幀的編號。 那可能嗎?

我認為您可以使用以下API用於基於Webkit / Mozilla的瀏覽器:

Mozilla已經在Firefox中實現了以下統計數據:

mozParsedFrames - number of frames that have been demuxed and extracted out of the media.
mozDecodedFrames - number of frames that have been decoded - converted into YCbCr.
mozPresentedFrames - number of frames that have been presented to the rendering pipeline for rendering - were "set as the current image".
mozPaintedFrames - number of frames which were presented to the rendering pipeline and ended up being painted on the screen. Note that if the video is not on screen (e.g. in another tab or scrolled off screen), this counter will not increase.
mozFrameDelay - the time delay between presenting the last frame and it being painted on screen (approximately). 

Mozilla也正在研究這里列出的一些統計數據。

Webkit實現了這些:

webkitAudioBytesDecoded - number of audio bytes that have been decoded.
webkitVideoBytesDecoded - number of video bytes that have been decoded.
webkitDecodedFrames - number of frames that have been demuxed and extracted out of the media.
webkitDroppedFrames - number of frames that were decoded but not displayed due to performance issues. 

我還在調查關於IE9的決議......

參考文獻:http://wiki.whatwg.org/wiki/Video_Metrics

我不認為跨瀏覽器設置標准幀率,或者用html5視頻開箱即用訪問當前幀的任何方式。 你可以做的是使用每秒29.97幀的電視標准幀速率,然后將其乘以視頻的當前時間,如: (vid.currentTime * 29.97).toPrecision(6)

這是我設置的小提琴演示如何將其綁定到按鈕以獲取當前幀: http//jsfiddle.net/893aM/1/

有一個像樣的Video Frame JS lib可以使用框架https://github.com/X3TechnologyGroup/VideoFrame

這是一個非常古老的問題,但這可能對新讀者有用。

參考: 在HTML5視頻中獲取幀編號

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM