A method, device, electronic device and medium for generating irregularly shaped video

By converting the frame data of the regular video into a texture image, and judging the visibility of pixel points based on the target image to generate irregular shape video, the problem of high complexity and low efficiency when generating irregular edge shape video in the prior art is solved. Achieve efficient video generation of irregular shapes.

CN115866336BActive Publication Date: 2024-12-17BEIJING TRICOLOR TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211474256.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-23
Publication Date
2024-12-17
Estimated Expiration
2042-11-23

AI Technical Summary

Technical Problem

In the prior art, when generating videos with irregular edge shapes or relatively complex edge shapes, the generation process is complicated and the generation efficiency is low.

Method used

By obtaining the current frame video data of the regular video, converting it into a texture image, and judging the visibility of pixel points based on the colors of different regions in the target image, generating irregular shape videos, avoiding setting edge parameters to adjust the shape of the output video.

Benefits of technology

Improves the efficiency of generating irregular edge shape videos, reduces the generation complexity, and does not need to adjust the shape of the output video by setting edge parameters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115866336B_ABST
    Figure CN115866336B_ABST
Patent Text Reader

Abstract

The present application provides a method, device, electronic device and medium for generating irregularly shaped videos, the method comprising: obtaining the current frame video data of the regular video being played, converting the current frame video data into a first texture image; for each pixel point in the second texture image corresponding to the target image, determining whether the color value of the pixel point is equal to the color value of the first color; if the color value is equal to the color value of the first color, using the color at the corresponding position of the first texture image as the output color of the position; based on the determined output colors of different positions on the first texture image, generating and displaying the irregularly shaped image corresponding to the current frame video data; using the next frame video data as the current frame video data and returning to execute the above steps to generate the irregularly shaped video. By adopting the above-mentioned method, device, electronic device and medium for generating irregularly shaped videos, the problems of complex generation process and low generation efficiency of irregularly shaped videos are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of audio and video processing, and in particular to a method, device, electronic device and medium for generating irregularly shaped videos. Background Art

[0002] In recent years, with the continuous development of the Internet and cultural undertakings, the demand for video services and application scenarios have increased, and the demand for processing audio and video files has also grown rapidly. Among them, in application scenarios such as live audio and video filters and video editing, the demand for irregular videos is particularly prominent. When processing audio and video, the existing technology usually generates irregular videos according to a set fixed ratio and size.

[0003] However, when the above method is used to generate irregular videos, the shape parameters of the irregular videos need to be set. When generating videos with irregular or complex edge shapes, the generation process will be complicated and the generation efficiency will be low. Summary of the invention

[0004] In view of this, the purpose of the present application is to provide a method, device, electronic device and medium for generating irregularly shaped videos, so as to solve the problem of complex generation process and low generation efficiency when generating videos with irregular or complex edge shapes.

[0005] In a first aspect, an embodiment of the present application provides a method for generating an irregularly shaped video, which is applied to a video player installed on a terminal device, comprising:

[0006] Obtaining current frame video data of the regular video being played, and converting the current frame video data into a first texture image;

[0007] For each pixel point in the second texture image corresponding to the target image, determine whether the color value of the pixel point is equal to the color value of the first color, the target image includes a first area and a second area, the first area and the second area are areas of different colors, and the first color is the color of the first area;

[0008] If the color value is equal to the first color, the color at the corresponding position of the first texture image is used as the output color of the position;

[0009] Based on the determined output colors at different positions on the first texture image, generating and displaying an irregularly shaped image corresponding to the current frame video data;

[0010] The next frame of video data is obtained, and the next frame of video data is used as the current frame of video data and returns to execute the step of converting the current frame of video data into a first texture image, so as to generate an irregularly shaped video according to multiple irregularly shaped images corresponding to different frame video data.

[0011] Optionally, after determining whether the color value of the pixel is equal to the color value of the first color, the method further includes: if it is not equal to the color value of the first color, setting the corresponding position on the first texture image to be invisible.

[0012] Optionally, the resolution of the target image is the same as the resolution of the regular video being played.

[0013] Optionally, both the first texture image and the second texture image are two-dimensional images.

[0014] Optionally, before acquiring the next frame of video data, the method further includes: determining whether the current frame of video data is the last frame of video data of the regular video being played; if it is not the last frame of video data, acquiring the next frame of video data.

[0015] Optionally, before obtaining the current frame video data of the regular video being played, it also includes: determining the rendering class corresponding to the initialized audio and video according to the audio and video streams in the regular video being played; applying to the terminal device for the virtual cache space required for decoding the audio and video to decode the audio and video.

[0016] Optionally, after determining whether the current frame of video data is the last frame of video data of the regular video being played, the method further includes: if it is the last frame of video data, releasing the applied virtual buffer space.

[0017] In a second aspect, an embodiment of the present application further provides a device for generating an irregularly shaped video, which is applied to a video player installed on a terminal device, and the device includes:

[0018] A conversion module, used for acquiring current frame video data of the regular video being played, and converting the current frame video data into a first texture image;

[0019] A judgment module, for determining, for each pixel point in a second texture image corresponding to a target image, whether a color value of the pixel point is equal to a color value of a first color, wherein the target image includes a first region and a second region, the first region and the second region are regions of different colors, and the first color is the color of the first region;

[0020] A color determination module, configured to use the color at a corresponding position of the first texture image as the output color of the position if the color value is equal to the first color;

[0021] An image generation module, used for generating and displaying an irregularly shaped image corresponding to the current frame video data based on the determined output colors at different positions on the first texture image;

[0022] The loop module is used to obtain the next frame of video data, use the next frame of video data as the current frame of video data and return to execute the step of converting the current frame of video data into a first texture image, so as to generate an irregularly shaped video according to multiple irregularly shaped images corresponding to different frame video data.

[0023] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the steps of the method for generating irregularly shaped videos as described above are performed.

[0024] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method for generating an irregularly shaped video as described above are executed.

[0025] The embodiments of the present application bring the following beneficial effects:

[0026] The embodiments of the present application provide a method, device, electronic device and medium for generating an irregularly shaped video, which can realize the generation of an irregularly shaped video through a target image. The target image includes a first area and a second area. If a pixel point in the second texture image is equal to the color of the first area, it indicates that the pixel point is within the displayable range, so the pixel point of the first texture image at the position corresponding to the pixel point is displayed according to its own color value, that is, the shape of the first area is used as the shape of the output irregular video. The present application only needs to input the target image corresponding to the irregular shape of the output video into a video player, and there is no need to adjust the shape of the output video by setting edge parameters. Compared with the method for generating irregularly shaped videos in the prior art, the problem of complex generation process and low generation efficiency when generating videos with irregular or complex edge shapes is solved.

[0027] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0029] Figure 1A flow chart of a method for generating an irregularly shaped video provided in an embodiment of the present application is shown;

[0030] Figure 2 A schematic diagram of a target image provided by an embodiment of the present application is shown;

[0031] Figure 3 A schematic diagram showing the structure of an irregularly shaped video generating device provided in an embodiment of the present application is shown;

[0032] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0033] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application usually described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, each other embodiment obtained by those skilled in the art without making creative work belongs to the scope of protection of the present application.

[0034] It is worth noting that before the present application was filed, in recent years, with the continuous development of the Internet and cultural undertakings, the demand for video services and application scenarios have increased, and the demand for the processing of audio and video files has also grown rapidly. Among them, in application scenarios such as live filters and video editing of audio and video, the demand for irregular videos is particularly prominent. When processing audio and video, the prior art usually generates irregular videos according to a set fixed ratio and size. However, when using the above method to generate irregular videos, it is necessary to set the shape parameters of the irregular video. When generating videos with irregular or complex edge shapes, it will lead to problems such as complicated generation process and low generation efficiency.

[0035] Based on this, an embodiment of the present application provides a method for generating irregularly shaped videos, so as to improve generation efficiency and reduce generation complexity when generating videos with irregular or complex edge shapes.

[0036] See also Figure 1 , Figure 1 The flowchart of a method for generating an irregularly shaped video provided in an embodiment of the present application is as follows. Figure 1As shown, the method for generating an irregularly shaped video provided in an embodiment of the present application is applied to a video player installed on a terminal device, comprising:

[0037] Step S101, obtaining the current frame video data of the regular video being played, and converting the current frame video data into a first texture image.

[0038] In this step, the regular video being played may refer to a video with a regular edge shape to be played, and the regular video being played may be understood as an input video, so as to obtain an output video with an irregular shape according to the input video.

[0039] A video with a regular shape may refer to a video with a regular shape. For example, the regular shape includes but is not limited to: a rectangle and a square.

[0040] An irregularly shaped video may refer to a video of an unconventional shape. For example, the unconventional shape includes but is not limited to: a circle, an ellipse, a triangle, a trapezoid, a rhombus, and the unconventional shape may also be a special shape, for example: a rectangle or a circle with jagged edges.

[0041] The first texture image may refer to a 2D texture corresponding to the current frame video data.

[0042] In an embodiment of the present application, the video player can support video playback such as local video (mp4 format, mkv format), network video (mp4 format) and live broadcast (rtmp format).

[0043] In addition, this method is developed based on Opengles, which is an application programming interface. It is a 3D graphics application programming interface used in mobile phones and embedded systems. It is a cross-platform API, mainly used to draw 2D or 3D graphics, render pictures and videos, etc. The current frame video data can be converted into a 2D texture through the glTexImage2D method in the OpenGLES Api.

[0044] In an optional embodiment, before obtaining the current frame video data of the regular video being played, it also includes: determining the rendering class corresponding to the initialized audio and video based on the audio and video streams in the regular video being played; applying to the terminal device for the virtual cache space required for decoding the audio and video to decode the audio and video.

[0045] Specifically, the rendering class corresponding to the initialized audio and video is determined according to the audio and video streams in the regular video being played, for example: audio needs to initialize OpenCl, video needs to initialize OpenGl, and apply to the Android operating system for virtual cache space for decoding audio and video data to facilitate decoding of audio and video.

[0046] The initialization process of the video rendering class and the audio rendering class are explained below.

[0047] The initialization process of the video rendering class is as follows: the surface of the surfaceView that carries the video rendering in the Android system (the surface corresponds to a screen buffer) is passed to the C++ layer through jni, a rendering thread is created, and the abstraction of the actual rendering display device, namely EGLDisplay, is created. The width and height of the drawing area are initialized according to the Surface passed in by Android, an ANativeWindow is created, and the pixel format and the number of pixels of the ANativeWindow are set. At this point, the video rendering class is initialized.

[0048] The initialization process of the audio rendering class is as follows: This application uses OpenSL Api as the Api for rendering audio, so the OpenSL audio rendering module is described in detail here. First, create the audio engine required for audio, initialize it through the slCreateEngine method, then create the corresponding mixer according to the audio engine, create the mixer by calling the CreateOutputMix method, then create a player for PCM audio data, and create a PCM audio player through the CreateAudioPlayer method. At this point, the audio rendering module is initialized.

[0049] After the audio and video module is initialized, the audio and video decoder and the audio and video rendering module are bound through the setRender method.

[0050] After applying for the cache space, get the address of the regular video being played, and pass the address to the C++ layer in the form of JNI through the Android operating system. After the C++ layer obtains the video address, initialize the video decoding class, video rendering class, audio decoder class and audio rendering class.

[0051] The decoding process is described in detail below.

[0052] The steps of audio and video decoders are similar, so they are described together. The specific initialization process is as follows: initialize the FFmpeg decoder, register the decoder by calling FFmpeg's avcodec_register_all method, and connect the decoder information and input and output pointers in series by calling Ffmpeg's av_register_all method. Initialize the network format information required for playing network videos and live videos by calling the avformat_network_init() method, register the video format context by calling avformat_alloc_context, open the video file by calling av_format_open_input and give the video information to the video format context, obtain the video stream information by the avformat_find_stream_info method and give the video stream to the video format context. After obtaining the video stream information of the video file, obtain the specific decoder of the audio and video format by calling the avcodec_find_decoder method, and then open the decoder by calling the avcodec_open2 method. At this point, the audio and video decoder of FFmpeg is initialized.

[0053] Next is playback. First, the playback code is called through the Android layer, that is, through the jni method, so that the audio and video start decoding the video data and rendering. The specific process is: get the single-packet audio and video data by calling the av_read_frame method of FFmpeg, get the audio and video data status of the decoded single-packet audio and video data through avcodec_send_packet, if it is AVERROR_EOF, it means that all video frames have been decoded, that is, the playback is completed. If the playback is not completed, call the avcodec_receive_frame method to get the specific audio and video data of each frame, so as to render each frame of audio and video data obtained.

[0054] Step S102 : for each pixel point in the second texture image corresponding to the target image, determining whether the color value of the pixel point is equal to the color value of the first color.

[0055] In this step, the target image is a two-dimensional image, and the target image includes a first area and a second area. The first area and the second area are areas of different colors, and the first color is the color of the first area.

[0056] The first area is used to determine the portion of the regular video being played that can be output and displayed, and the shape of the first area determines the shape of the output irregular video.

[0057] The second area is used to cover the portion of the regular video being played that cannot be output and displayed.

[0058] Refer to the following Figure 2 Let's introduce the target image.

[0059] Figure 2 A schematic diagram of a target image provided by an embodiment of the present application is shown.

[0060] like Figure 2 As shown, the target image 200 includes a first area 210 and a second area 220, wherein the first area 210 is a black circular area, and the second area 220 is the remaining area of ​​the target image 200 except the first area 210, and the second area 220 is a white area. It should be noted that Figure 2 The first area in is a circular area, which is only an example, and the first area can be a closed figure of any shape.

[0061] In an embodiment of the present application, a second texture image corresponding to the target image is first obtained, and then the argb value of the first color of the first area in the second texture image and the argb value of the second color of the second area are stored. When determining whether the argb value of a pixel point a in the second texture image is equal to the color value of the first color, the argb value of the first color is taken out from the storage location and compared with the argb value of the pixel point a to determine whether the two are equal.

[0062] In addition, after obtaining the second texture image, the second texture image is passed into the fragment shader, and the first texture image corresponding to the current frame video data is also passed into the fragment shader. In the fragment shader, it is determined whether the argb value of each pixel point in the second texture image passed in is equal to the color value of the first color, so as to determine the color of the target image at the pixel point.

[0063] In an optional embodiment, the resolution of the target image is the same as the resolution of the regular video being played.

[0064] Specifically, in order to improve the efficiency of generating irregular videos, the resolution of the target image can be set to be the same as the resolution of the regular video being played, so that each pixel in the current frame video data can be directly corresponded to the pixel in the target image at the corresponding position.

[0065] In addition, the resolution of the target image may also be an integer multiple of the resolution of the regular video being played, so it is necessary to determine the correspondence between the pixel points in the target image and each pixel point in the current frame video data.

[0066] In an optional embodiment, the first texture image and the second texture image are both two-dimensional images.

[0067] Specifically, after converting the current frame video data, a first texture image corresponding to the current frame video data is obtained, and the first texture image is a 2D texture image. Similarly, the second texture image corresponding to the target image is also a 2D texture image.

[0068] Step S103: If the color value is equal to the first color, the color at the corresponding position of the first texture image is used as the output color of the position.

[0069] In this step, the first area is used to determine the irregular shape of the output video, so all the pixels in the first texture image corresponding to the pixels in the first area need to be displayed according to their own colors.

[0070] For ease of description, the pixel point in the first texture image is defined as the first pixel point, and the pixel point in the second texture image is defined as the second pixel point. If the color value of the second pixel point a is equal to the color value of the first color, it indicates that the second pixel point a is in the first area. Since the first pixel point in the first texture image corresponding to each second pixel point in the first area needs to be displayed according to its own color, the first pixel point b corresponding to the second pixel point a needs to be displayed according to the first pixel point b's own color, that is, the color of the first pixel point b is used as the output color of the position.

[0071] In an optional embodiment, after determining whether the color value of the pixel is equal to the color value of the first color, the method further includes: if it is not equal to the color value of the first color, setting the corresponding position on the first texture image to be invisible.

[0072] Taking the above example, if the color value of the second pixel point a is not equal to the color value of the first color, it indicates that the second pixel point a is in the second area. Since the first pixel point in the first texture image corresponding to each second pixel point in the second area cannot be displayed, the first pixel point b corresponding to the second pixel point a needs to be set to invisible, for example: the color of the first pixel point b is set to transparent.

[0073] Step S104 , generating and displaying an irregularly shaped image corresponding to the current frame video data based on the determined output colors at different positions on the first texture image.

[0074] In this step, after determining the output colors of all first pixels on the first texture image, a corresponding irregular effect image can be generated according to the output color corresponding to each pixel. The irregular effect image is an irregularly shaped image of the output regular video being played in the current frame.

[0075] Since the pixel points in the first texture image corresponding to each pixel point in the second area are invisible, that is, only the pixel points in the first texture image corresponding to each pixel point in the first area will be displayed, therefore, the shape of the generated irregular shape image is the same as the shape of the first area. If the first area is a circle, the output irregular shape image is also a circle. If the first area is a triangle, the output irregular shape image is also a triangle. Moreover, the color of each pixel point in the irregular shape image is the same as the color of the pixel point at the corresponding position in the first texture image. It can also be understood that the irregular shape image is the part corresponding to the first area in the first texture image.

[0076] Step S105, obtaining the next frame of video data, taking the next frame of video data as the current frame of video data and returning to execute the step of converting the current frame of video data into a first texture image, so as to generate an irregularly shaped video according to multiple irregular video images corresponding to different frame video data.

[0077] In this step, once the irregularly shaped image corresponding to the current frame video data is generated, it means that the current frame video data has been processed, and each subsequent frame video data needs to be processed to generate an irregularly shaped image corresponding to each subsequent frame video data.

[0078] Since an irregularly shaped image is generated and displayed each time a frame of video data is played, that is, an irregularly shaped image is generated while a regular video is played, a plurality of irregularly shaped images that are continuously generated and displayed constitute an irregularly shaped video.

[0079] In an optional embodiment, before obtaining the next frame of video data, it also includes: determining whether the current frame of video data is the last frame of video data of the regular video being played; if it is not the last frame of video data, obtaining the next frame of video data.

[0080] Specifically, if the current frame video data is not the last frame video data, it indicates that the regular video has not been played completely, and the next frame video data needs to be processed further to obtain an irregularly shaped image corresponding to the next frame video data. Therefore, it is necessary to obtain the next frame video data and use the next frame video data as the current frame video data to generate the first texture image corresponding to the next frame video data.

[0081] In an optional embodiment, after determining whether the current frame of video data is the last frame of video data of the regular video being played, the method further includes: if it is the last frame of video data, releasing the requested virtual buffer space.

[0082] Specifically, if the current frame of video data is the last frame of video data, it indicates that the regular video has been played and the video player needs to be released, that is, the audio and video rendering module and the audio and video decoder need to be released. At the same time, the previously applied virtual cache space is closed and released in the OpenGLES structure.

[0083] Compared with the method for generating irregularly shaped videos in the prior art, the present application can realize the generation of irregularly shaped videos through a target image, and the target image includes a first area and a second area. If a pixel point in the second texture image is equal to the color of the first area, it indicates that the pixel point is within the displayable range, so the pixel point of the first texture image at the corresponding position of the pixel point is displayed according to its own color value, that is, the shape of the first area is used as the shape of the output irregular video. The present application only needs to input the target image corresponding to the irregular shape of the output video into the video player, and there is no need to adjust the shape of the output video by setting edge parameters, which solves the problems of complex generation process and low generation efficiency when generating videos with irregular or complex edge shapes.

[0084] Based on the same inventive concept, an irregularly shaped video generating device corresponding to the irregularly shaped video generating method is also provided in an embodiment of the present application. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the irregularly shaped video generating method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0085] See also Figure 3 , Figure 3 This is a schematic diagram of the structure of an irregularly shaped video generation device provided in an embodiment of the present application. Figure 3 As shown in , the irregularly shaped video generating device 300 is applied to a video player installed on a terminal device, and the device includes:

[0086] The conversion module 301 is used to obtain the current frame video data of the regular video being played, and convert the current frame video data into a first texture image;

[0087] A judgment module 302 is used to determine, for each pixel point in a second texture image corresponding to a target image, whether a color value of the pixel point is equal to a color value of a first color, wherein the target image includes a first region and a second region, the first region and the second region are regions of different colors, and the first color is the color of the first region;

[0088] A color determination module 303, configured to use the color at the corresponding position of the first texture image as the output color of the position if the color value is equal to the first color;

[0089] An image generation module 304 is used to generate and display an irregularly shaped image corresponding to the current frame video data based on the determined output colors at different positions on the first texture image;

[0090] The loop module 305 is used to obtain the next frame of video data, use the next frame of video data as the current frame of video data and return to execute the step of converting the current frame of video data into a first texture image, so as to generate an irregularly shaped video according to multiple irregularly shaped images corresponding to different frame video data.

[0091] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 4 As shown in , the electronic device 400 includes a processor 410 , a memory 420 and a bus 430 .

[0092] The memory 420 stores machine-readable instructions executable by the processor 410. When the electronic device 400 is running, the processor 410 communicates with the memory 420 via the bus 430. When the machine-readable instructions are executed by the processor 410, the above-mentioned Figure 1 The steps of the method for generating irregularly shaped videos in the method embodiment shown, and the specific implementation manner can be referred to the method embodiment, which will not be repeated here.

[0093] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the computer program can execute the above-mentioned Figure 1 The steps of the method for generating irregularly shaped videos in the method embodiment shown, and the specific implementation manner can be referred to the method embodiment, which will not be repeated here.

[0094] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0095] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0096] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0097] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0098] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or in other words, the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0099] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A method for generating an irregularly shaped video, characterized in that: Applied to a video player installed on a terminal device, the method comprises: Acquire current frame video data of the regular video being played, and convert the current frame video data into a first texture image, wherein the current frame video data is edge regular video data to be played; For each pixel point in the second texture image corresponding to the target image, determine whether the color value of the pixel point is equal to the color value of the first color, the target image includes a first area for determining the irregular shape of the output video and a second area for shielding the part that cannot be output and displayed, the first area and the second area are areas of different colors, the first color is the color of the first area, and the resolution of the target image is the same as the resolution of the regular video being played; If the color value is equal to the first color, the color at the corresponding position of the first texture image is used as the output color of the position; if the color value is not equal to the first color, the corresponding position on the first texture image is set to be invisible; Based on the determined output colors at different positions on the first texture image, generating and displaying an irregularly shaped image corresponding to the current frame video data; The next frame of video data is obtained, the next frame of video data is used as the current frame of video data and the step of converting the current frame of video data into a first texture image is returned to generate an irregularly shaped video according to a plurality of irregularly shaped images corresponding to different frame video data.

2. The method according to claim 1, characterized in that The resolution of the target image is the same as the resolution of the regular video being played.

3. The method according to claim 1, characterized in that: The first texture image and the second texture image are both two-dimensional images.

4. The method according to claim 1, characterized in that: Before obtaining the next frame of video data, the method further includes: Determine whether the current frame of video data is the last frame of video data of the regular video being played; If it is not the last frame of video data, get the next frame of video data.

5. The method according to claim 1, characterized in that Before obtaining the current frame video data of the regular video being played, the method further includes: Determine the rendering class corresponding to the initialized audio and video according to the audio and video streams in the regular video being played; Apply to the terminal device for the virtual buffer space required for decoding audio and video to decode the audio and video.

6. The method according to claim 4, characterized in that After determining whether the current frame of video data is the last frame of video data of the regular video being played, the method further includes: If it is the last frame of video data, release the requested virtual buffer space.

7. An irregularly shaped video generating device, characterized in that: Applicable to video players installed on terminal devices, including: A conversion module, used for acquiring current frame video data of a regular video being played, and converting the current frame video data into a first texture image, wherein the current frame video data is edge regular video data to be played; a judgment module, for determining, for each pixel point in a second texture image corresponding to a target image, whether a color value of the pixel point is equal to a color value of a first color, wherein the target image includes a first region for determining an irregular shape of an output video and a second region for shielding a portion that cannot be output and displayed, the first region and the second region are regions of different colors, the first color is the color of the first region, and a resolution of the target image is the same as a resolution of a regular video being played; A color determination module, configured to use the color at the corresponding position of the first texture image as the output color of the position if the color value is equal to the color value of the first color, and to set the corresponding position on the first texture image to be invisible if the color value is not equal to the color value of the first color; An image generation module, used for generating and displaying an irregularly shaped image corresponding to the current frame video data based on the determined output colors at different positions on the first texture image; A loop module is used to obtain the next frame of video data, use the next frame of video data as the current frame of video data and return to execute the step of converting the current frame of video data into a first texture image, so as to generate an irregularly shaped video according to multiple irregularly shaped images corresponding to different frame video data.

8. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the storage medium communicate through the bus, and the processor executes the machine-readable instructions to perform the steps of the method for generating an irregularly shaped video as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for generating an irregularly shaped video according to any one of claims 1 to 6 are performed.