开发者

NetStream.seek in milliseconds

I have a H.264 encoded video which has keyframes which are about 100 milliseconds apart. I observed that i cannot seek to certain keyframes. After I do a开发者_开发技巧 seek, the playhead jumps to the desired time(Keyframe time) and some how it jumps a few milliseconds ahead or backwards. My trace ouput for NetStream.time looks like

ns.t: 2.86

ns.t: 2.86

ns.t: 2.86

[10:12:01 GMT+0100] VideoPlayerNetStream: NetStatusEvent - NetStream.Seek.Notify time: ns.time= 2.86

[10:12:02 GMT+0100] VideoPlayerNetStream: Seek.Notify info.seekPoint: undefined

ns.t: 2.76

ns.t: 2.76

ns.t: 2.76

ns.t: 2.76

ns.t: 2.8

ns.t: 2.8

I am seeking to 2.76(thats 2 seconds and 76 milliseconds). As you can see that it does seek to the desired keyframe(there's a keyframe at 2.76) but then it jumps to 2.8 . This causes a lot of problem for jumping frame backwards functionality. The strange things is that it works for some keyframes and simply doesn't work for some. Could there be a problem with the video? Is there any way in which I can test if the video is encoded properly? Searching on Google , showed that people are having problem seeking to non keyframes. But here I am trying to seek to keyframes. the application works for videos which have keyframes which are seconds apart. The problem came up when the video were encoded differently to get the milliseconds feature.

I am struggling with this problem for a long time now and would be grateful if I receive any tips/pointers in right direction to solve it.

Regards

Vrushali


as mentioned in the help:

The playheadTime property might not have the expected value immediately after you call one of the seek methods or set playheadTime to cause seeking. For a progressive download, you can seek only to a keyframe; therefore, a seek takes you to the time of the first keyframe after the specified time.

[...]

Seeking is asynchronous, so if you call a seek method or set the playheadTime property, playheadTime does not update immediately. To obtain the time after the seek is complete, listen for the seek event, which does not start until the playheadTime property is updated.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/video/VideoPlayer.html#seek()

so the http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/video/VideoEvent.html#SEEKED is (supposed to be) dispatched when the playhead actually reaches the keyframe.

in other words, having few keyframes makes the seeking methods inacurate. NB: this is not true for streaming video where the playhead is always immediately set to the proper time/keyframe.

if you have cuepoints enabled, a solution is to "pin" important frames of the video and use the seekToNavCuePoint(), seekToNextNavCuePoint() and seekToPrevNavCuePoint() as far as I can remember those were more acurate.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜