Method and related device for processing multimedia data
By providing an interface for terminal devices to select data processing options and generate executable files, it solves the problem of low development efficiency of FFmpeg audio and video processing and achieves rapid development and efficient multimedia data processing.
Patent Information
- Application Number
- CN202210112722.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-29
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2042-01-29
AI Technical Summary
When using FFmpeg for audio and video data processing, developers need to spend a lot of time and energy exploring video image processing methods, resulting in low development efficiency.
Provide a method and system that, by receiving data processing requests from terminal devices, provide an interface to the device for users to select data processing options, and generate executable files based on the options, thereby reducing the development cycle.
It greatly reduces the development cycle of audio and video services, improves development efficiency, reduces dependence on FFmpeg's underlying technology, and simplifies the multimedia data processing process.
Smart Images

Figure CN114501079B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method for processing multimedia data and related equipment. Background Art
[0002] FFmpeg is a set of open source computer programs that can be used to record, convert digital audio and video, and convert them into streams.
[0003] Generally, FFmpeg can be used to process audio and video data. However, R&D personnel need to spend a lot of energy and time to explore video image processing methods during the development process based on audio and video data, which reduces development efficiency. Summary of the invention
[0004] In view of this, the present disclosure proposes a method for processing multimedia data and a related device.
[0005] In a first aspect of the present disclosure, a method for processing multimedia data is provided, which is applied to a server and includes:
[0006] Receiving a data processing request from a terminal device;
[0007] Based on the data processing request, providing a corresponding interface to the terminal device, wherein the interface provides data processing options;
[0008] receiving data processing option information sent by the terminal device, wherein the data processing option information is obtained by selecting a data processing option in the interface;
[0009] generating an executable file corresponding to the data processing option information; and
[0010] The executable file is sent to the terminal device.
[0011] In a second aspect of the present disclosure, a server is provided, including:
[0012] one or more processors, memory; and
[0013] one or more programs;
[0014] The one or more programs are stored in the memory and executed by the one or more processors, and the programs include instructions for executing the method according to the first aspect.
[0015] In a third aspect of the present disclosure, a system for processing multimedia data is provided, comprising:
[0016] The server according to the second aspect; and
[0017] The terminal device is configured as:
[0018] Sending a data processing request to the server;
[0019] Receive and display the interface provided by the server;
[0020] sending data processing option information generated based on the interface to the server; and
[0021] An executable file corresponding to the data processing option information is received and sent by the server.
[0022] According to a fourth aspect of the present disclosure, a non-volatile computer-readable storage medium containing a computer program is provided. When the computer program is executed by one or more processors, the processors execute the method described in the first aspect.
[0023] In a fifth aspect of the present disclosure, a computer program product is provided, comprising computer program instructions, which, when executed on a computer, cause the computer to execute the method described in the first aspect.
[0024] The method and related equipment for processing multimedia data provided by the present disclosure generate executable files according to data processing requests and data processing options, thereby greatly shortening the development cycle of audio and video services. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the present disclosure or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0026] Figure 1 A schematic diagram showing an exemplary system provided by an embodiment of the present disclosure is shown.
[0027] Figure 2A A schematic diagram of an exemplary first interface according to an embodiment of the present disclosure is shown.
[0028] Figure 2B A schematic diagram of an exemplary second interface according to an embodiment of the present disclosure is shown.
[0029] Figure 3A A schematic diagram of a flow chart of an exemplary video stitching process according to an embodiment of the present disclosure is shown.
[0030] Figure 3B A schematic diagram of an exemplary target video according to an embodiment of the present disclosure is shown.
[0031] Figure 3C A schematic flowchart of another exemplary video stitching process according to an embodiment of the present disclosure is shown.
[0032] Figure 3D A flowchart of an exemplary video processing process according to an embodiment of the present disclosure is shown.
[0033] Figure 3E A schematic diagram of an exemplary target video according to an embodiment of the present disclosure is shown.
[0034] Figure 3F A flowchart of an exemplary video mirroring process according to an embodiment of the present disclosure is shown.
[0035] Figure 3G A schematic diagram of adding a text watermark to a target video according to an embodiment of the present disclosure is shown.
[0036] Figure 3H A schematic diagram of a target video to which a picture watermark is added according to an embodiment of the present disclosure is shown.
[0037] Figure 4 A flowchart of an exemplary method provided by an embodiment of the present disclosure is shown.
[0038] Figure 5 A schematic diagram of the hardware structure of an exemplary electronic device provided in this embodiment is shown. DETAILED DESCRIPTION
[0039] In order to make the objectives, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0040] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the embodiments of the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0041] FFmpeg is a cross-platform open source library that can be used to record, convert digital audio and video, and convert them into streams. It includes leading audio / video encoding libraries and is compatible with Windows, Linux, and MacOS operating systems. In terms of protocols, FFmpeg supports multiple protocols such as HTTP, RTP, RTSP, RTMP, RTSP, etc.; in terms of audio and video formats, it supports multiple formats such as AVI, FLV, MOV, MP4, etc. FFmpeg provides encapsulation and decapsulation of multiple media formats, including multiple audio and video encodings, streaming media of multiple protocols, multiple color format conversions, multiple sampling rate conversions, multiple bit rate conversions, etc. In addition, FFmpeg provides a variety of rich plug-in modules, including plug-ins for encapsulation and decapsulation, plug-ins for encoding and decoding, etc. FFmpeg provides two usage methods: command line and SDK, which is convenient for developers with different needs.
[0042] However, when using FFmpeg for development, researchers usually need to spend a lot of energy and time to explore video image processing methods, which reduces development efficiency.
[0043] In view of this, the embodiments of the present disclosure provide a method and related devices for processing multimedia data, which greatly shorten the development cycle by directly generating executable files for users according to the user's data processing requests and data processing options.
[0044] Figure 1 A schematic diagram of an exemplary system 100 provided by an embodiment of the present disclosure is shown.
[0045] like Figure 1 As shown, the system 100 can be used to process multimedia data (eg, video, audio, image), and can further include a server 200 and a terminal device 300 .
[0046] The server 200 may be a server deployed within the enterprise or a commercial server purchased or rented by the enterprise. The number of servers 200 may be one or more. In the case of multiple servers 200, a distributed architecture may be used to form a server cluster. Figure 1 As shown, the system 100 may further include a database server 202, which may be used to store data, and the server 200 may call corresponding data from the database server 202 as needed.
[0047] The terminal device 300 may be a fixed terminal or a mobile terminal of various types. For example, the terminal device 300 may be a computer device such as a personal computer or a notebook computer. The terminal device 300 and the server 200 may communicate via a wired network or a wireless network to achieve data interaction.
[0048] In some embodiments, the server 200 may be a server that provides FFmpeg development services, the terminal device 300 may be an operating device corresponding to an ordinary audio and video user or an audio and video software developer, and related functions of FFmpeg may be used through the server 200.
[0049] Back to Figure 1 , a user or a developer can send a data processing request 302 to the server 200 through the terminal device 300, and the data processing request 302 can be used to request the server 200 to provide services related to producing audio and video.
[0050] The terminal device 300 may send the data processing request 302 to the server 200 through a browser or software installed in the terminal device 300. For example, the data processing request 302 may be sent to the server 200 by inputting the corresponding website / IP address of the server 200 in the address bar of the browser. For another example, the data processing request 302 may be sent to the server 200 providing the software service by opening the corresponding audio and video production software.
[0051] After receiving the data processing request 302, the server 200 may provide a corresponding interface to the terminal device 300, in which data processing options may be provided so that the user can make selections based on the data processing options.
[0052] In some embodiments, the data processing request 302 corresponds to the data processing mode of the terminal device 300, and the server 200 can determine the data processing mode of the terminal device 300 according to the received data processing request 302. Depending on the different data processing modes of the terminal device 300, the interface provided by the server 200 to the terminal device 300 may be different.
[0053] In some embodiments, when the data processing mode of the terminal device 300 is the first processing mode, the server 200 provides the first interface to the terminal device 300. The first processing mode, for example, can be a lightweight data processing mode, and can generate some simple source code (low-code mode) according to the data processing options selected by the user.
[0054] Figure 2A A schematic diagram of an exemplary first interface 204 according to an embodiment of the present disclosure is shown.
[0055] like Figure 2A As shown, data processing options are provided in the first interface 204, wherein the data processing options may further include video processing operation options and picture processing operation options.
[0056] The video processing operation options may include, for example, merging videos, cutting videos, adding watermarks to videos, removing watermarks from videos, adding audio to videos, taking screenshots of videos, modifying video bitrates, modifying video color space, converting videos to GIFs, video keyframes, zooming in / out of videos, etc. In addition, in the first interface 204, a "more" button is provided at the bottom of the video processing operation option window. After the user clicks the button, more video processing operation options may be expanded in the first interface 204 for the user to select.
[0057] The picture processing operation options may include, for example, merging pictures, converting pictures to videos, adding watermarks to pictures, compressing pictures, converting multiple pictures to GIF, etc. In addition, in the first interface 204, a "more" button may also be provided at the bottom of the picture processing operation option window. After the user clicks the button, more picture processing operation options may be expanded in the first interface 204 for the user to select.
[0058] In some embodiments, the first interface 204 may also include a programming language option for the user to select a programming language, and then the corresponding source code may be generated based on the programming language selected by the user. In this way, the user can let the system 100 generate source code written in the desired programming language for the user according to actual needs, which is more in line with the user's customized needs. Figure 2A As shown, the programming language option in the first interface 204 provides several basic options, which can be commonly used options in general scenarios, such as Java, Golang, C language, and Python. In some embodiments, these basic options can be replaced, reordered, etc. according to the user's frequency of use (for example, the number of times the programming language option has been used to generate source code more than 10 times in the past 7 days), so as to be more in line with the user's usage habits. In addition, in the first interface 204, a "more" button can also be set on one side of the programming language selection window. After the user clicks the button, more programming language options can be expanded in the first interface 204 for the user to choose. In some embodiments, considering the versatility of the Java language, the programming language option can check the "Java" option by default, and the user can adjust it by himself if he needs to change the programming language.
[0059] like Figure 2A As shown, in some embodiments, the first interface 204 may further include a source code display window 2042, and the source code display window 2042 is used to display source code written in a programming language corresponding to the programming language option selected by the user.
[0060] In some embodiments, when the data processing mode of the terminal device 300 is the second processing mode, the server 200 provides the second interface to the terminal device 300. The second processing mode, for example, may be a heavyweight data processing mode, and a software development kit (SDK) for calling a corresponding microservice API interface may be generated according to the data processing option selected by the user.
[0061] Figure 2B A schematic diagram of an exemplary second interface 206 according to an embodiment of the present disclosure is shown.
[0062] like Figure 2B As shown, the second interface 206 provides data processing options, wherein the data processing options may further include video processing interface options and picture processing interface options.
[0063] The video processing interface options may include, for example, obtaining all video materials, obtaining basic video information, splicing videos in spatial dimensions, splicing videos in temporal dimensions, making video picture-in-picture, cropping videos at a specified resolution, cropping videos of a specified length, modifying video bitrate, modifying video color space, making video mirrors, zooming in / out of videos at the same ratio, obtaining the first frame of a video, obtaining the last frame of a video, splicing videos in a nine-grid grid, etc. It is understandable that Figure 2B Some video processing interface options are only exemplified. These video processing interface options can be increased, decreased, or modified according to actual needs.
[0064] The picture processing interface options may include, for example, obtaining basic picture information, picture stitching, converting a single picture to a video, converting a picture sequence to a GIF, obtaining picture thumbnails, picture compression, converting a picture sequence to a video, adding a watermark to a picture, etc. It is understandable that Figure 2B Some image processing interface options are only exemplified. These image processing interface options can be increased, decreased, or modified according to actual needs.
[0065] Next, the terminal device 300 provides the user with selectable data processing options by displaying the interface 204 or 206. The user selects the data processing options in the interface 204 or 206, and the terminal device 300 can generate a message carrying the corresponding data processing option information 304 and send it to the server 200. For example, after the user selects the required data processing options, by clicking the "Submit" button in the interface 204 or 206, the terminal device 300 generates a message carrying the corresponding data processing option information 304 based on the selected data processing options and sends it to the server 200. In some embodiments, as Figure 2A and 2BAs shown, a "reset" button may also be provided in interfaces 204 and 206. After the user clicks the button, the selected options may be reset to start over.
[0066] After receiving the data processing option information sent by the terminal device 300 , the server 200 may generate an executable file 208 corresponding to the data processing option information based on the data processing option information, and then send the executable file 208 to the terminal device 300 .
[0067] According to different data processing modes of the terminal device 300, the executable file 208 generated by the server 200 may be different.
[0068] In some embodiments, when the data processing mode of the terminal device 300 is the first processing mode, the server 200 may generate a source code file corresponding to the data processing option information 304. In some embodiments, when the data processing option information 304 includes programming language option information, the server 200 may generate a source code file corresponding to the data processing option information 304 based on the programming language corresponding to the programming language option. For example, if the user selects the Java option, the generated source code file is written in the Java language.
[0069] After receiving the source code file, the terminal device 300 can display the source code corresponding to the source code file in the source code display window 2042. In some embodiments, the user can also click the "one-click copy" button in the interface 204 to make the terminal device 300 copy the source code, and then the user can paste the source code into the program file corresponding to the project developed by the user. In other embodiments, the user can also click the "export file" button in the interface 204 to make the terminal device 300 generate a corresponding executable file based on the source code, such as a .java file, and then the user can directly put the file into the project to call the corresponding method.
[0070] It is understood that in some embodiments, the server 200 may store source codes corresponding to data processing options written in various programming languages in advance in the database server 202, and may match the source codes stored in the database server 202 based on the data processing option information 304, and then return the matched source codes to the terminal device 300. It is understood that one section of source code may correspond to one data processing option, and when the user selects multiple data processing options, the generated source code may be multiple sections, and may be sequentially formed in the source code file.
[0071] In other embodiments, when the data processing mode of the terminal device 300 is the second processing mode, the server 200 may generate a software development kit corresponding to the data processing option information 304. Specifically, the server 200 may determine the API interface required to be called for the corresponding data processing option according to the data processing option information 304, and then generate a corresponding software development kit (SDK) based on the API interface required to be called for the data processing option.
[0072] In some embodiments, the API interface can be a callable interface provided by the microservice architecture, and different API interfaces can implement different data processing functions accordingly. Therefore, selecting different API interfaces can correspond to calling the multimedia data processing functions provided by the corresponding microservices. The microservice architecture can be integrated with the server 200 to form a server cluster that provides microservices. When generating an SDK, the server 200 can generate a corresponding SDK according to the API interface of the microservice to be called. It can be understood that the SDK can correspond to the data processing options one by one, or one SDK can correspond to multiple data processing options.
[0073] After receiving the SDK, the user of the terminal device 300 only needs to import the SDK into the project, and can call the corresponding method according to the interface calling mode when needed.
[0074] It can be seen that the executable file (e.g., source code or SDK) generated by the embodiment of the present disclosure can be directly added by the user to the product (or software) being developed, so that the product (or software) has the multimedia data processing function that can be realized by the corresponding executable file, and the user does not need to write the executable file by himself. In particular, when the user uses FFmpeg to realize the multimedia data processing function, there is no need to spend too much energy to learn the underlying technology of FFmpeg, thereby greatly reducing the difficulty of development and improving development efficiency.
[0075] In some embodiments, the data processing options may include a first video merging option for splicing multiple videos in a spatial dimension, for example, splicing multiple videos in a multi-grid manner in a spatial dimension. When the terminal device 300 runs the SDK corresponding to the first video merging option, the corresponding first parameter may be sent to the server 200. It is understandable that the SDK corresponding to the first video merging option may be integrated in a certain audio and video production software, and running the SDK corresponding to the first video merging option may be to select the function corresponding to the first video merging option in the audio and video production software to run the SDK. After the SDK is running, the corresponding API interface in the microservice architecture of the server 200 is called accordingly, thereby passing in the corresponding first parameter, so that the microservice in the microservice architecture processes the data based on the first parameter. Therefore, accordingly, the corresponding API interface of the server 200 can receive the first parameter, and then perform video merging processing based on the first parameter. The first parameter may include parameters such as the size of the canvas, the number of rows and columns of the spliced video, the resolution of each video file / video stream, and the specifically selected video file / video stream.
[0076] When performing video merging processing, the corresponding microservice in the microservice architecture of the server 200 may first create a blank overlay canvas; for example, by using nullsrc of FFmpeg, a blank overlay canvas of a specified size is created according to the canvas size in the first parameter.
[0077] Then, the corresponding positions of the images of multiple video files on the overlay canvas can be determined according to the number of rows and columns of the spliced video in the first parameter. For example, when the number of rows and columns is 2, a four-grid is used to splice the video, and the corresponding positions of each video file can be the upper left, lower left, upper right, and lower right. The user can also specify the position of the corresponding video file / video stream in the four-grid in the first parameter, and the parameter and the corresponding video file / video stream parameter can be in the first parameter and known to the server 200.
[0078] Then, according to the resolution of each video stream in the first parameter and the specifically selected video file / video stream, the images of multiple video files can be superimposed on the corresponding positions on the overlay canvas to obtain the target video. For example, the overlay canvas is used as the reference channel and named [base]. Then, each input video file or video stream is taken out using four general channels [0:v], [1:v], [2:v], and [3:v], and repositioned to the video channels [upperleft], [upperright], [lowerleft], and [lowerright] at the specified positions. The positions or resolutions of these four channels are configured according to the specified parameters in the first parameter. The video files / video streams in the channel can be adapted according to the configuration of the channel. Finally, the four input video files / video streams will be tiled in sequence on the blank overlay canvas generated by nullsrc.
[0079] Combination Figure 3A , the channel accumulation process example is as follows:
[0080] ①[base][upperleft]——>[tmp1]
[0081] ②[tmp1][upperright]——>[tmp2]
[0082] ③[tmp2][lowerleft]——>[tmp3]
[0083] ④[tmp3][lowerright]——>Result
[0084] Based on the above principle, when the API interface receives the first parameter including the size of the canvas, the number of rows and columns of the stitched video, the resolution of each video file / video stream and the specifically selected video file / video stream, the server 200 can complete the video stitching according to the stitching principle to obtain the target video, such as Figure 3B shown.
[0085] Then, the server 200 can send the target video to the terminal device 300, and the terminal device 300 can display the target video. The display effect is as follows: Figure 3B shown.
[0086] In traditional video surveillance systems, supervisors need to watch multiple split-shot images. It is difficult to match scattered split-shot videos with their actual geographical locations. It is impossible to conduct global real-time monitoring of large scenes and quickly trace back historical events. The massive amount of scattered surveillance video resources is neither "too much to watch" nor "hard to understand". Therefore, in some embodiments, an optional application scenario for video splicing processing can be the monitoring scenario of the city command center system, so that the spliced video can be used to merge the multi-angle images collected by multiple surveillance cameras into one picture, thereby facilitating the global monitoring of the monitoring personnel.
[0087] In some embodiments, the data processing options may include a second video merging option for splicing multiple videos in a time dimension, for example, splicing multiple videos in a time dimension in a time sequence. When the terminal device 300 runs the SDK corresponding to the second video merging option, the corresponding second parameter may be sent to the server 200. The second parameter is transmitted to the server 200 in a similar manner as the first parameter, which will not be described in detail here. The second parameter may include parameters such as the specifically selected video file / video stream and its splicing order.
[0088] In order to be compatible with various video formats, before splicing the video, the corresponding microservices in the microservice architecture of the server 200 can process these video files / video streams into files of predetermined formats according to the video files / video streams specifically selected by the user in the second parameter. For example, the video file / video stream can be packaged into a container in TS format. TS is the full name of MPEG2-TS. The characteristic of MPEG2-TS format is that it can be independently decoded starting from any segment of the video stream.
[0089] Then, according to the splicing order in the second parameter, the plurality of files of the predetermined format are sequentially merged to obtain the target video. For example, the concat filter provided by FFmpeg can be used to merge the files in the splicing order, and then output to the specified file to obtain the target video, such as Figure 3C shown.
[0090] Next, the server 200 may send the target video to the terminal device 300, and the terminal device 300 may display the target video.
[0091] Through video stitching in the time dimension, multiple videos are stitched together in order into one video, which is convenient for users to use and save. For example, in some activities, users use cameras, mobile phones and other devices to shoot multiple videos, but these videos are all shot in the event and have the same theme. Through video stitching in the time dimension, these videos are combined into one video, which is convenient for users to share and save.
[0092] In some embodiments, the data processing options may include a picture-in-picture option for processing multiple videos into a picture-in-picture video. When the terminal device 300 runs the SDK corresponding to the picture-in-picture option, the corresponding third parameter may be sent to the server 200. The way in which the third parameter is transmitted to the server 200 is similar to the first parameter, which will not be described in detail here. The third parameter may include parameters such as the specific selected video file / video stream and whether it is a foreground video or a background video, the position and size of the foreground video, etc.
[0093] The corresponding microservice in the microservice architecture of server 200 can create a background layer (overlay1) and a foreground layer (overlay_1~n) for the background video file and the foreground video file respectively according to the video file / video stream specifically selected by the user in the third parameter and whether it belongs to the foreground video or the background video.
[0094] Then, the background video file and the foreground video file are bound to the background layer (overlay1) and the foreground layer (overlay_1~n) respectively to obtain the target video. Each layer receives a corresponding video file, and the overlay of the background video file is also used to receive the layer of the foreground video file. For example, the video can be bound with the help of the video overlay technology characteristics of the overlay filter provided by FFmpeg, and the position and size of the foreground video can be set according to the parameters such as the position and size of the foreground video in the third parameter. The picture-in-picture processing process is as follows Figure 3D As shown, the processed target video is as follows Figure 3E shown.
[0095] It is understandable that the media types received by the overlay layer can be video files, picture files and video streams, and can be compatible with all video image formats, such as .mp4, .flv or .avi, and picture formats such as .gif, .png or .bmp. Therefore, the background and foreground of the obtained picture-in-picture target video can be videos or pictures, and the synthesized target videos can be diverse.
[0096] Next, the server 200 can send the target video to the terminal device 300, and the terminal device 300 can display the target video. The display effect is as follows: Figure 3E shown.
[0097] In some embodiments, an optional application scenario of picture-in-picture processing may be a monitoring scenario of a city command center system, so that picture-in-picture video can be used to provide multi-angle observation images. For example, in the background video, there may be a monitoring image of a main landmark location in a city (for example, a crossroads of a busy street) from one angle, while in foreground video 1 and foreground video 2, there may be monitoring images of the main landmark location collected from two other angles. As an optional embodiment, foreground video 1 and foreground video 2 may be enlarged monitoring images of a target object (for example, an object, a pedestrian) in the background video, so that an enlarged image of the target object observed from two angles can be provided in the foreground video, thereby providing a multi-angle observation image of the target object, enriching the monitoring function and improving the monitoring efficiency.
[0098] In some embodiments, an optional application scenario of the picture-in-picture processing can also be a live game scene, so that the picture-in-picture video can be used to provide a multi-angle viewing of the game. Taking a football game as an example, the background video can be a panoramic picture of the entire stadium, while the foreground video 1 and the foreground video 2 can be pictures of the stadium captured from two other angles. As an optional embodiment, the foreground video 1 and the foreground video 2 can be enlarged pictures of a player in the background video observed from two angles, so that a multi-angle observation picture of the player can be provided in the picture-in-picture video, improving the game viewing effect and user experience.
[0099] In some embodiments, the data processing options may include a video mirroring option for processing a video into a mirrored video. When the terminal device 300 runs the SDK corresponding to the video mirroring option, the corresponding fourth parameter may be sent to the server 200. The fourth parameter is transmitted to the server 200 in a manner similar to the first parameter, which will not be described in detail here. The fourth parameter may include parameters such as the specifically selected video file / video stream, the resolution and starting point of the cropping, the direction of the mirroring (e.g., horizontal mirroring or vertical mirroring, rotation angle, etc.).
[0100] Figure 3F FIG. 2 is a schematic diagram showing an exemplary video mirroring process according to an embodiment of the present disclosure. Figure 3F As shown, the corresponding microservice in the microservice architecture of the server 200 can divide the selected video file / video stream into the same first video stream and the second video stream according to the video file / video stream specifically selected by the user in the fourth parameter. The first video stream remains intact, and the second video stream is mirrored accordingly. For example, with the help of the AVFilter filter module of FFmpeg, the selected video file / video stream is divided into the same first video stream and the second video stream.
[0101] Then, the second video stream is cropped according to the cropping resolution and starting point in the fourth parameter. For example, the crop filter provided by FFmpeg is used to crop the second video stream to obtain the cropped second video stream. The cropping operation corresponds to four parameters w:h:x:y, where w and h represent the resolution of the cropped video, and x and y represent the starting point of the cropping relative to the origin of the original video.
[0102] Then, according to the direction of the mirror image in the fourth parameter, the cropped second video stream is mirrored to obtain a mirrored second video stream. According to the different directions of the mirror image, different filters provided by FFmpeg may be used. For example, the vflip filter can perform a vertical flip operation on the video, the hflip filter can perform a horizontal flip operation on the video, and the rotate filter can rotate the video at a specified angle.
[0103] Finally, the second video stream after the mirroring process is merged with the first video stream to obtain the target video, wherein the layer corresponding to the second video stream after the mirroring process is located at the top layer of the target video. For example, the second video stream is merged into the original overlay layer and displayed on the top layer, thereby outputting the target video.
[0104] Next, the server 200 may send the target video to the terminal device 300, and the terminal device 300 may display the target video.
[0105] By mirroring a video, especially by selecting a portion of the video for mirroring, the display effect of the video can be enriched. For example, by selecting the center area of the video to form a mirror image, while the edge area of the video remains the same, the center area and the edge area of the entire video form a mirror contrast, so that the mirrored video has a special effect, which improves the interest and viewing of the video.
[0106] In some embodiments, the data processing options may include a watermarking option for adding a watermark to a video. The watermark may be text or a picture, which is used to mark the video or add special effects. When the terminal device 300 runs the SDK corresponding to the watermarking option, the corresponding fifth parameter may be sent to the server 200. The way in which the fifth parameter is transmitted to the server 200 is similar to the first parameter, which will not be repeated here. The fifth parameter may be different for different watermark types. For example, for a text watermark, the fifth parameter may include parameters such as a specifically selected video file / video stream, watermark text, font format, font color, font size, text background, text background color, and the position of the text watermark relative to the video origin. For another example, for a picture watermark, the fifth parameter may include parameters such as a specifically selected video file / video stream, the width and height of the watermark picture and the watermark, and the position of the picture watermark relative to the video origin.
[0107] The corresponding microservice in the microservice architecture of the server 200 can add a watermark at a corresponding position of the selected video file / video stream according to the video file / video stream specifically selected by the user in the fifth parameter to obtain the target video. Figure 3G and Figure 3H Schematic diagrams of adding text watermarks and adding image watermarks to target videos according to embodiments of the present disclosure are shown respectively. The text watermark can be added with the help of the drawtext filter provided by FFmpeg; the image watermark can be added with the help of a filter chain consisting of the movie and overlay filters provided by FFmpeg, wherein the movie filter specifies the watermark image and the width and height of the watermark according to the fifth parameter, and the overlay filter is used to set the relative position of the watermark and the origin of the video according to the fifth parameter.
[0108] By adding text or image watermarks to videos, you can mark the source of the video and protect intellectual property rights.
[0109] It should be noted that in some of the aforementioned embodiments, video files are used as an example for description. It is understandable that the embodiments of the present disclosure can also be applied to other multimedia files, such as picture files. Therefore, based on the same idea, these embodiments can also process picture files, or perform mixed processing on video files and picture files.
[0110] It should also be noted that the aforementioned embodiment of running the SDK and performing data processing is for explanation of the embodiment of adding the corresponding SDK to the terminal product. In fact, with respect to the first processing mode proposed in the embodiment of the present disclosure, when the corresponding source code is directly added to the terminal product, the terminal device 300 itself can perform the corresponding data processing without having to implement data processing by calling the API interface of the microservice provided by the server. These embodiments in which the terminal device performs data processing operations also fall within the scope of protection of the present disclosure.
[0111] It can be seen that the embodiment of the present disclosure provides two data processing modes, and the user can select the corresponding implementation mode according to the amount of data processing requirements.
[0112] If the user's business does not have a strong demand for video and image processing, the processing operation will only appear under some specific needs, and there is not much complex processing logic. At this time, the user can use the first processing mode (lightweight) to obtain the required executable source code.
[0113] If the user's business requires frequent video and image processing and involves more details of video and image processing, the user can choose to use the second processing mode (heavyweight) to implement the corresponding functions by calling the API interface. In some embodiments, by using the more comprehensive video and image processing operation-related interfaces provided by the microservice architecture, the interfaces of corresponding functions can be freely combined and used in the project's business.
[0114] The system 100 for processing multimedia data provided by the embodiment of the present disclosure analyzes the audio and video processing technology of the FFmpeg open source library, vectorizes the single functional points of FFmpeg in combination with actual business, is compatible with different programming languages and system environments, and provides a reasonably laid out interactive interface.
[0115] The system 100 for processing multimedia data provided by the embodiment of the present disclosure provides an executable program supporting multiple programming languages for R&D personnel by providing a simple and easy-to-use interactive method, and provides video image processing microservices for R&D personnel. The solution provided by the embodiment of the present disclosure avoids the need to spend a lot of energy on searching for information due to lack of professional knowledge of video image processing, and can greatly improve development efficiency and reduce development costs.
[0116] The embodiment of the present disclosure also provides a method for processing multimedia data. Figure 4 The flowchart of the exemplary method 400 provided by the embodiment of the present disclosure is shown. The method 400 can be applied to Figure 1 Server 200. Figure 4As shown, the method 400 may further include the following steps.
[0117] In step 402, the server 200 may receive a terminal device (eg, Figure 1 The terminal device 300) has a data processing request (for example, Figure 1 Request 302).
[0118] In step 404, the server 200 may provide a corresponding interface to the terminal device based on the data processing request, wherein the interface provides data processing options.
[0119] In some embodiments, the data processing request corresponds to the data processing mode of the terminal device; based on the data processing request, providing the corresponding interface to the terminal device includes: determining the data processing mode of the terminal device based on the data processing request; in response to determining that the data processing mode of the terminal device is the first processing mode, providing the first interface (for example, Figure 2A or in response to determining that the data processing mode of the terminal device is the second processing mode, providing a second interface (eg, Figure 2B interface 206).
[0120] In some embodiments, the first interface also includes a source code display window (for example, Figure 2A The source code display window 2042 is used to display source code written in the programming language corresponding to the programming language option.
[0121] In step 406, the server 200 may receive the data processing option information (eg, Figure 1 Option information 304), wherein the data processing option information is obtained by selecting a data processing option in the interface.
[0122] In step 408, the server 200 may generate an executable file (eg, Figure 1 of the document 208).
[0123] In some embodiments, the data processing options provided in the first interface include programming language options, and generating a source code file corresponding to the data processing option information includes: generating a source code file corresponding to the data processing option information based on the programming language corresponding to the programming language option.
[0124] In some embodiments, generating a software development kit corresponding to the data processing option information includes: determining an interface required to be called by the data processing options in the data processing option information; and generating the software development kit based on the interface required to be called by the data processing options.
[0125] In step 410, the server 200 may send the executable file to the terminal device.
[0126] In some embodiments, generating an executable file corresponding to the data processing option information includes: in response to the data processing mode of the terminal device being a first processing mode, generating a source code file corresponding to the data processing option information; or in response to the data processing mode of the terminal device being a second processing mode, generating a software development kit corresponding to the data processing option information.
[0127] In some embodiments, the data processing options include a first video merging option; the method further includes: receiving a first parameter sent by the terminal device by running a software development kit corresponding to the first video merging option; creating a blank overlay canvas according to the first parameter; determining corresponding positions of images of multiple video files on the overlay canvas according to the first parameter; superimposing the images of multiple video files at corresponding positions on the overlay canvas according to the first parameter to obtain a target video; and sending the target video to the terminal device.
[0128] In some embodiments, the data processing options include a second video merging option; the method further includes: receiving a second parameter sent by the terminal device by running a software development kit corresponding to the second video merging option; according to the second parameter, processing multiple video files into files of predetermined formats respectively; according to the second parameter, merging multiple files of the predetermined format in sequence to obtain a target video; and sending the target video to the terminal device.
[0129] In some embodiments, the data processing option includes a picture-in-picture option; the method also includes: receiving a third parameter sent by the terminal device by running a software development kit corresponding to the picture-in-picture option; creating a background layer and a foreground layer for a background video file and a foreground video file respectively according to the third parameter; binding the background video file and the foreground video file to the background layer and the foreground layer respectively to obtain a target video; and sending the target video to the terminal device.
[0130] In some embodiments, the data processing option includes a video mirroring option; the method also includes: receiving a fourth parameter sent by the terminal device by running a software development kit corresponding to the video mirroring option; according to the fourth parameter, dividing the video file into the same first video stream and second video stream; according to the fourth parameter, cropping the second video stream; according to the fourth parameter, mirroring the cropped second video stream; merging the mirrored second video stream with the first video stream to obtain a target video, wherein the layer corresponding to the mirrored second video stream is located at the top layer of the target video; and sending the target video to the terminal device.
[0131] In some embodiments, the data processing option includes a watermark adding option; the method further includes: receiving a fifth parameter sent by the terminal device by running a software development kit corresponding to the watermark adding option; adding a watermark at a corresponding position of the video file according to the fifth parameter to obtain a target video; and sending the target video to the terminal device.
[0132] It should be noted that the method of the embodiment of the present disclosure can be performed by a single device, such as a computer or a server. The method of the present embodiment can also be applied in a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present disclosure, and the multiple devices will interact with each other to complete the described method.
[0133] It should be noted that the above describes some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0134] Based on the same inventive concept, corresponding to the method 400 of any of the above embodiments, the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method 400 of any of the above embodiments when executing the program.
[0135] Figure 5 FIG. 5 shows a hardware structure diagram of a more specific electronic device 500 provided in this embodiment. The device 500 can be used to implement Figure 1In some embodiments, the terminal device 300 may also have the structure of the device 500. Figure 5 As shown, the device 500 may include: a processor 502, a memory 504, an input / output interface 506, a communication interface 508 and a bus 510. The processor 502, the memory 504, the input / output interface 506 and the communication interface 508 are connected to each other through the bus 510 in the device.
[0136] The processor 502 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0137] The memory 504 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 504 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 504 and called and executed by the processor 502.
[0138] The input / output interface 506 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0139] The communication interface 508 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0140] The bus 510 comprises a pathway for transmitting information between the various components of the device, such as the processor 502 , the memory 504 , the input / output interface 506 , and the communication interface 508 .
[0141] It should be noted that, although the above device only shows the processor 502, the memory 504, the input / output interface 506, the communication interface 508 and the bus 510, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.
[0142] The electronic device of the above embodiment is used to implement the corresponding method 400 in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.
[0143] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present disclosure also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute method 400 described in any of the above embodiments.
[0144] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0145] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the method 400 described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0146] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments, the present disclosure further provides a computer program product, which includes a computer program. In some embodiments, the computer program is executable by one or more processors so that the processors execute the described method 400. Corresponding to the execution subject corresponding to each step in each embodiment of the method 400, the processor that executes the corresponding step may belong to the corresponding execution subject.
[0147] The computer program product of the above embodiment is used to enable the processor to execute the method 400 described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.
[0148] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples. Based on the concept of the present disclosure, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present disclosure as described above, which are not provided in detail for the sake of simplicity.
[0149] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present disclosure difficult to understand, the known power / ground connections to the integrated circuit (IC) chips and other components may or may not be shown in the provided figures. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present disclosure difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present disclosure will be implemented (that is, these details should be fully within the scope of understanding of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present disclosure, it is apparent to those skilled in the art that the embodiments of the present disclosure can be implemented without these specific details or with changes in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0150] Although the present disclosure has been described in conjunction with specific embodiments of the present disclosure, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0151] The embodiments of the present disclosure are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present disclosure should be included in the scope of protection of the present disclosure.
Claims
1. A method for processing multimedia data, applied to a server, comprising: Receiving a data processing request from a terminal device; Based on the data processing request, providing a corresponding interface to the terminal device, wherein the interface provides data processing options; receiving data processing option information sent by the terminal device, wherein the data processing option information is obtained by selecting a data processing option in the interface; generating an executable file corresponding to the data processing option information; as well as Sending the executable file to the terminal device; The step of generating an executable file corresponding to the data processing option information includes: in response to the data processing mode corresponding to the data processing request being the second processing mode, generating a software development kit corresponding to the data processing option information.
2. The method of claim 1, wherein: The data processing request corresponds to a data processing mode of the terminal device; Based on the data processing request, providing a corresponding interface to the terminal device includes: Based on the data processing request, determining the data processing mode of the terminal device; In response to determining that the data processing mode of the terminal device is the first processing mode, providing a first interface to the terminal device; In response to determining that the data processing mode of the terminal device is a second processing mode, providing a second interface to the terminal device.
3. The method of claim 2, wherein: Generate an executable file corresponding to the data processing option information, including: In response to the data processing mode of the terminal device being the first processing mode, a source code file corresponding to the data processing option information is generated.
4. The method of claim 3, wherein: The data processing options provided in the first interface include programming language options, and generating a source code file corresponding to the data processing option information includes: Based on the programming language corresponding to the programming language option, a source code file corresponding to the data processing option information is generated.
5. The method of claim 4, wherein: The first interface also includes a source code display window, and the source code display window is used to display source code written in the programming language corresponding to the programming language option.
6. The method of claim 3, wherein: Generating a software development kit corresponding to the data processing option information, comprising: Determining an interface required to be called for the data processing option in the data processing option information; and The software development kit is generated based on the interface required to be called by the data processing option.
7. The method of claim 3, wherein: The data processing option includes a first video merging option; the method further includes: Receiving a first parameter sent by the terminal device by running a software development kit corresponding to the first video merging option; According to the first parameter, create a blank overlay canvas; Determine corresponding positions of the images of the plurality of video files on the overlay canvas according to the first parameter; According to the first parameter, the frames of the multiple video files are superimposed on corresponding positions on the overlay canvas to obtain a target video; and The target video is sent to the terminal device.
8. The method of claim 3, wherein: The data processing options include a second video merging option; the method further includes: Receiving a second parameter sent by the terminal device by running a software development kit corresponding to the second video merging option; According to the second parameter, the plurality of video files are processed into files of a predetermined format respectively; According to the second parameter, merging a plurality of files in the predetermined format in sequence to obtain a target video; and The target video is sent to the terminal device.
9. The method of claim 3, wherein: The data processing option includes a picture-in-picture option; the method further includes: receiving a third parameter sent by the terminal device by running a software development kit corresponding to the picture-in-picture option; According to the third parameter, creating a background layer and a foreground layer for the background video file and the foreground video file respectively; Binding the background video file and the foreground video file to the background layer and the foreground layer respectively to obtain a target video; and The target video is sent to the terminal device.
10. The method of claim 3, wherein: The data processing options include a video mirroring option; the method further includes: Receiving a fourth parameter sent by the terminal device by running a software development kit corresponding to the video mirroring option; According to the fourth parameter, the video file is divided into the same first video stream and the second video stream; According to the fourth parameter, the second video stream is cropped; According to the fourth parameter, mirroring the cropped second video stream; Merging the mirrored second video stream with the first video stream to obtain a target video, wherein a layer corresponding to the mirrored second video stream is located at a top layer of the target video; and The target video is sent to the terminal device.
11. The method of claim 3, wherein: The data processing option includes a watermarking option; the method further includes: Receiving a fifth parameter sent by the terminal device by running a software development kit corresponding to the watermark adding option; According to the fifth parameter, adding a watermark at a corresponding position of the video file to obtain a target video; and The target video is sent to the terminal device.
12. A server, comprising: One or more processors, memory; as well as one or more programs; The one or more programs are stored in the memory and executed by the one or more processors, and the programs include instructions for executing the method according to any one of claims 1 to 11.
13. A system for processing multimedia data, comprising: The server according to claim 12; as well as The terminal device is configured as: Sending a data processing request to the server; Receive and display the interface provided by the server; sending data processing option information generated based on the interface to the server; as well as An executable file corresponding to the data processing option information is received and sent by the server.
14. The system of claim 13, wherein: The executable file is a source code file corresponding to the data processing option information; or, the executable file is a software development kit corresponding to the data processing option information.
15. A non-volatile computer-readable storage medium containing a computer program, which, when executed by one or more processors, causes the processors to perform the method of any one of claims 1 to 11.
16. A computer program product comprising computer program instructions, which, when executed on a computer, cause the computer to execute the method according to any one of claims 1 to 11.
