Broadway icon indicating copy to clipboard operation
Broadway copied to clipboard

Regulating FPS/non-smooth playback

Open yarontorbaty opened this issue 9 years ago • 7 comments

At times the video moves either too fast or too slow, In order to provide a smooth user experience displaying frames should be done in a constant interval (1000/FPS)

yarontorbaty avatar Apr 14 '15 09:04 yarontorbaty

good idea i am thinking about creating a "real" player supporting not only broadway.js but different video decoders. at the time i see broadway.js only as a decoder.

soliton4 avatar Apr 16 '15 09:04 soliton4

Yes - I was looking for a way to do this myself, but the onPictureDecoded only returns buffer, width and height. If it also returned the timestamp of the frame that would be ideal - and would also (I think?) allow you to pre-render some frames and increase FPS. That might negatively impact memory usage, though.

alastaircoote avatar Apr 18 '15 20:04 alastaircoote

@alastaircoote do you know if the timestamp information is even provided in the h264 stream data?

soliton4 avatar Apr 18 '15 21:04 soliton4

@soliton4 I don't know. If FPS is available in the header you could calculate it that way, but I don't know much about decoding that data/if it's even possible.

alastaircoote avatar Apr 18 '15 21:04 alastaircoote

Timestamp information is available in the container format, not in the raw stream. Broadway includes an mp4 parser, you should be able to figure out the timestamp using that. Read the mp4 spec, (or the qucktime spec from which it is derived, the Apple docs are better).

mbebenita avatar Apr 18 '15 22:04 mbebenita

i created the foundation for a frame buffer here: https://github.com/mbebenita/Broadway/commit/0324cb3a319441bc04d3e132a05e77fdec978deb

soliton4 avatar May 13 '15 23:05 soliton4

How would you set the fps with your code?

Zaithe avatar Aug 09 '16 22:08 Zaithe