jscodec / jsvpx

Full Javascript implementation of libvpx vp8 decoder.
MIT License
25 stars 6 forks source link

question for embedding your decoder #12

Open publicocean0 opened 7 years ago

publicocean0 commented 7 years ago

hi , i d like embed your decoder in my player.

but i have some questions ipothesis: -i have a webm stream ... using chunks. -the demuxer is seekeable .... it permits to seek in a specific position and send out the right frames.

the decoder is stateless? when i seek there no state to reset in the decoder? nothing related to keyframe for example?

brianxautumn commented 7 years ago

The decoder does keep the state. You can only seek to a keyframe, but this is how all decoders work.

publicocean0 commented 7 years ago

ok pratically after a seek i have to call decode api with compressed frames starting from a keyframe. It seams simple

brianxautumn commented 7 years ago

Yes, this is the case with VP8, you have to seek to the nearest keyframe.

publicocean0 commented 7 years ago

then for the player part ... i think i might refresh canvas it is simple but i have 2 doubt:

brianxautumn commented 7 years ago

When you multiplex it, it should put timestamps on each frame. I don't think a solid fps will work perfectly. Do you have audio too?

brianxautumn commented 7 years ago

I'm not an expert on A/V sync but perhaps @brion knows

bvibber commented 7 years ago

Indeed there's no single fps value provided in WebM structure; each frame's packet lists a presentation timestamp relative to the start time.

Very roughly a playback loop (such as is implemented in my ogv.js player needs to do:

publicocean0 commented 7 years ago

Thanks a lot @brion. I got the idea . I m thinking now in the webm blocks there is a blockduration : blockduration/framecount=time per frame. Answering to @brianxautumn. No i have still to see exactly how to do . I have just saw you realized a audiostream feeder for doing it.

The better solution would be realize a MSE object for browser not supporting it. There is also another little problem to think. Usually there is a parser/demuxer also in dash component. MSE might have also a simplifed version of a demuxer+ decoder. There is a rendundancy demuxing twice . I m asking if is better to think a trick for evoiding it(for example creating a virtual codec 'video/webm codecs="js" ' essentially passing directly frames after initialization segment ) , but anyway realizing a portable solution.