How ios can quickly read and compress data from the video card into a video in cocos2dx extended development

Source: Internet
Author: User

How to quickly read and compress the data in the video card into a video in ios extended development


Mobile Phone platform performance is a key issue.

The compressed video is divided into three steps:

Read video card data, compress with encoder, and save files.

When libav compression is used, the efficiency of the software encoder is not enough. It can only achieve 5-6 fps on itouch5.

The function provided by the corevideo library can be 12-13 FPS on itouch5.

The next bottleneck is to read data from the video card, that is, glReadPixel.

Ios provides a texturecache that can map cpu memory and video card storage together, but it cannot modify the data in this area as easily as it does in cpu storage. The specific hardware mechanism is not very familiar, however, this can greatly reduce the time consumption, and achieve the efficiency of 60fps by only obtaining data compression video tasks. Refer to the MovieWrite class.

 


Therefore, to expand the game video recording function on cocos2dx, you need to change

CCDirector adds the recording game status to draw the current game scenario to texture.

Next, draw the texture content to the screen for display.

Then draw the texutre to the framebuffer of the video cache to generate the video.

For this code, refer to the Code in the CCRenderTexture section.


 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.