How can i smoothly playback a FLV at different speeds?

徘徊边缘 提交于 2019-12-12 11:15:16

问题


I will need to display the frames of an FLV at different rates.

Here are some examples:

  • the user will 'scrub' through the flv frames(front/back)
  • the flv will need to play at half the speed on a user interaction.

Currently I'm using LoaderMax and it's VideoLoader object to load and play FLV files. I've tried using the playProgress property, but only the keyframes of the FLV are displayed. I got the same result with the basic setup(using the NetStream class)

As a workaround, I playback the FLV once, and cache BitmapData instances in which I draw/cache each frame of the video. After this is done, I use the BitmapData Vector to update a Bitmap on stage. Scrubbing/changing speed works fine with this method, but still the user needs to see(wait for) the sequence once, while it gets cached, which I don't like.

Any better ideas on how to do this ?

Any tips are useful, Thanks!


回答1:


I've seen this done before but the video was imported into the flash ide and we manipulated the time line for the scrubbing. I believe we had a second version of the video for the slow motion play back version and switched between the two movieclips. Fairly low-tech method and wasn't without it's issues but we got round them. I have a feeling you're going to struggle to do this with a plain old flv using progressive download.




回答2:


Thx for the question: it made me read flv format spec (from page 74) and start writing a ByteArray based parser. as far as i understood there're two ways:

Body VideoTagBody The VideoTagBody contains the video frame payload.


so it seems possible to access each frame as pixel data

another one is to set framerate in metadata to a value you like, write an flv back to ByteArray and save to local filesystem or use NetStream.appendBytes() for playback



来源:https://stackoverflow.com/questions/4496066/how-can-i-smoothly-playback-a-flv-at-different-speeds

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!