This invention relates to a desktop
image acquisition and encoding method and apparatus, belonging to the field of cloud desktop technology. The specific technical solution is as follows: An independent acquisition and encoding thread is created; within the acquisition and encoding thread, the pre-configuration of the
graphics card for acquisition and encoding is completed; within the acquisition and encoding thread, a cyclic acquisition and encoding process is started, sequentially executing acquisition parameter configuration, calling the
graphics card acquisition interface to complete desktop
image acquisition, acquisition result
processing, image resource registration to the
graphics card
encoder, calling the graphics card encoding interface to complete image encoding, encoding result
processing, and
bitstream extraction and transmission operations; after the acquisition and encoding task is completed, the cyclic acquisition and encoding process is terminated, the acquisition session and
encoder session are destroyed, the corresponding resources are released, and the acquisition and encoding thread is reclaimed. This disclosure can improve the desktop rendering
frame rate and
image acquisition frame rate.