Resource processing method and device
By determining the target processor on the server and transcoding the source file, the problem of discontinuous audio and video resource playback is solved, and efficient resource processing and smooth multimedia resource playback are achieved.
Patent Information
- Application Number
- CN202311132274.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-04
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2043-09-04
AI Technical Summary
When the client plays audio and video resources online, the server fails to process and issue resources in a timely manner, resulting in discontinuous playback of audio and video resources.
By receiving the client's multimedia resource list acquisition request, it is determined whether there are source files and slice files associated with candidate resource identification in the local storage. If not, it obtains the connection address and obtains the source files from the storage node. Based on preset allocation rules and encodings The format determines the target processor, and determines the slice file size based on the source file attributes and network bandwidth, and performs transcoding and slice operations to obtain the slice file.
It improves the efficiency of resource processing, ensures smooth playback of multimedia resources, and avoids lag caused by low transcoding efficiency.
Smart Images

Figure CN117241106B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a resource processing method and device. Background Art
[0002] When the client plays audio and video resources online, it needs to send a resource acquisition request to the server, requesting the server to send the audio and video resources to be played. However, if the server does not process and download the audio and video resources in time, the audio and video resources may be played discontinuously. Therefore, an efficient resource processing method is urgently needed to ensure smooth playback of audio and video resources. Summary of the invention
[0003] The present application provides a resource processing method and device.
[0004] According to one aspect of the present application, a resource processing method is provided, comprising:
[0005] In response to receiving a first acquisition request for a multimedia resource list sent by a client, determining whether there are source files and slice files associated with a candidate resource identifier in a local storage, wherein the candidate resource identifier is a resource identifier associated with a request object identifier in the first acquisition request;
[0006] In the case that the source file and the slice file associated with the candidate resource identifier do not exist in the local storage, determine the connection address corresponding to the candidate resource identifier, and obtain the source file corresponding to the candidate resource identifier from the storage node based on the connection address;
[0007] Determining a target processor from different types of available processors based on a preset allocation rule and an encoding format of the source file;
[0008] Determine the file size of the slice file based on the attribute information of the source file, the state data of the target processor, and the network bandwidth;
[0009] Based on the file size, the target processor is called to perform transcoding and slicing operations on the source file to obtain a slice file corresponding to the source file.
[0010] According to another aspect of the present application, there is provided a resource processing device, comprising:
[0011] A first determination module is configured to determine whether there are source files and slice files associated with a candidate resource identifier in a local storage in response to receiving a first acquisition request for a multimedia resource list sent by a client, wherein the candidate resource identifier is a resource identifier associated with a request object identifier in the first acquisition request;
[0012] An acquisition module, used to determine a connection address corresponding to the candidate resource identifier when the source file and slice file associated with the candidate resource identifier do not exist in the local storage, and acquire the source file corresponding to the candidate resource identifier from the storage node based on the connection address;
[0013] A second determination module, configured to determine a target processor from different types of available processors based on a preset allocation rule and an encoding format of the source file;
[0014] A third determination module is used to determine the file size of the slice file based on the attribute information of the source file, the state data of the target processor, and the network bandwidth;
[0015] The transcoding module is used to call the target processor to perform transcoding and slicing operations on the source file based on the file size, and obtain a slice file corresponding to the source file. According to another aspect of the present application, an electronic device is provided, including:
[0016] at least one processor; and
[0017] a memory communicatively connected to at least one processor; wherein,
[0018] The memory stores instructions that can be executed by at least one processor. The instructions are executed by the at least one processor so that the at least one processor can execute the method of the above embodiment.
[0019] According to another aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the method according to the above embodiment.
[0020] The technical solution provided by the embodiment of the present application brings at least the following beneficial effects: In the present application, upon receiving the first acquisition request of the multimedia resource list sent by the client, it is determined whether there are source files and slice files associated with the candidate resource identifier in the local storage, and when there are no source files and slice files associated with the candidate resource identifier in the local storage, the connection address corresponding to the candidate resource identifier is determined, and the source file corresponding to the candidate resource identifier is obtained from the storage node based on the connection address, and then, based on the preset allocation rule and the encoding format of the source file, the target processor is determined from different types of available processors, and the file size of the slice file is determined based on the attribute information of the source file, the status data of the target processor, and the network bandwidth, and then, based on the slice length, the target processor is called to perform transcoding and slicing operations on the source file to obtain the slice file corresponding to the source file. Thus, by determining different target processors for source files of different encoding formats, and determining the file size of the slice file based on the current network bandwidth, the status data of the target processor, and the attribute information of the source file, the efficiency of resource processing is improved, thereby ensuring smooth playback of multimedia resources.
[0021] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.
[0023] Figure 1 A schematic diagram of a process flow of a resource processing method provided in an embodiment of the present application;
[0024] Figure 2 A flowchart of another resource processing method provided in an embodiment of the present application;
[0025] Figure 3 A flowchart of another resource processing method provided in an embodiment of the present application;
[0026] Figure 4 A schematic diagram of the structure of a resource processing device provided in an embodiment of the present application;
[0027] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0029] Before the server sends multimedia resources to the client, it needs to perform multimedia transcoding to adapt to different network bandwidths, different terminal processing capabilities or different user needs. Multimedia transcoding refers to converting a compressed and encoded multimedia stream into another multimedia stream. Transcoding is essentially a process of decoding first and then encoding. For example, for video files, according to the dynamic bitrate adaptive technology (HTTP Live Streaming, HLS), all video tracks are decoded and transcoded into H.264 encoding, and all audio tracks are decoded and transcoded into Advanced Audio Coding (AAC); for audio files, according to the HLS protocol, all audio tracks are decoded and transcoded into AAC encoding.
[0030] Traditional multimedia transcoding does not slice the source file, but directly transcodes it. However, considering the low transcoding efficiency of direct transcoding, especially for files with large data volume such as video source files or audio and video source files, the problem of low transcoding efficiency will be more obvious, resulting in failure. Therefore, for multimedia resources, the source file can be transcoded and sliced at the same time to obtain multiple transcoded slice files, and the slice files are sent to the client in turn, so as to avoid the inability to send multimedia resources to the client in time due to the low efficiency of direct transcoding of the source file, resulting in the phenomenon of jamming when playing multimedia resources online.
[0031] Among them, multimedia resources can be audio resources, video resources, audio and video resources or image resources, etc.
[0032] The resource processing method, device, electronic device and storage medium of the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0033] It should be noted that the resource processing method implemented in the present application is configured in a resource processing device (hereinafter referred to as the processing device) for illustration, and the processing device can be applied to electronic devices such as servers so that the electronic devices can perform resource processing functions.
[0034] Figure 1 A flowchart of a resource processing method provided in an embodiment of the present application.
[0035] like Figure 1 As shown, the method includes:
[0036] Step 101, in response to receiving a first acquisition request for a multimedia resource list sent by a client, determine whether there are source files and slice files associated with a candidate resource identifier in the local storage, wherein the candidate resource identifier is a resource identifier associated with the request object identifier in the first acquisition request.
[0037] Among them, multimedia resources can be audio resources, video resources, audio and video resources, picture resources, etc., and the resource identifier can be the file name of the resource or any other information that can uniquely identify the multimedia resource. This application does not impose any restrictions on this.
[0038] In this application, when a user uploads a multimedia resource to a server through a client, the server can slice and transcode the multimedia resource using a preset slicing method, and save the first preset number of slice files to local storage, so that when the user requests the multimedia resource, the multimedia resource can be quickly returned to the user, improving the response efficiency. The source file of the multimedia resource before transcoding is saved to the corresponding storage node. Among them, the storage node corresponds to a storage server in the distributed storage.
[0039] After that, the user can click the resource preview control on the client to browse the uploaded resource list. When the client detects that the resource preview control is triggered, it can send a request to the server to obtain a multimedia resource list containing the requested object identifier. After that, the server queries to determine the resource identifier associated with the requested object identifier, generates a multimedia resource list based on each resource identifier, and sends the multimedia resource list to the client. After receiving the multimedia resource list, the client can display the candidate resource identifiers in the multimedia resource list on the page for the user to select and browse.
[0040] Furthermore, when the server receives a request to obtain a multimedia resource list, it determines by querying whether the source files and slice files associated with the candidate resource identifier are stored in the local storage. If the source files and some slice files associated with the candidate resource identifier are stored in the local storage, it is not necessary to obtain the source files from the storage node to which the source files belong and perform transcoding and slicing operations. If the source files and some slice files associated with the candidate resource identifier are not stored in the local storage, the source files can be downloaded in advance and sliced, so that when the user requests to browse the multimedia resources, a quick response can be given to ensure smooth playback of audio and video resources.
[0041] Step 102, when there are no source files and slice files associated with the candidate resource identifier in the local storage, determine the connection address corresponding to the candidate resource identifier, and obtain the source file corresponding to the candidate resource identifier from the storage node based on the connection address.
[0042] The connection address is the storage node address of the source file corresponding to the candidate resource identifier.
[0043] In this application, after the source files and slice files of multimedia resources are stored in the local storage for a preset period of time, the source files and slice files can be deleted to release storage resources and avoid occupying storage resources. Therefore, when there are no source files and slice files associated with the candidate resource identifier in the local storage, the connection address associated with the candidate resource identifier can be queried to determine. After that, the source file corresponding to the candidate resource identifier can be obtained from the corresponding storage node based on the connection address.
[0044] Step 103: Determine a target processor from different types of available processors based on a preset allocation rule and the encoding format of the source file.
[0045] In the present application, different types of processors have different transcoding efficiencies for multimedia resources in different coding formats. Therefore, the efficiency of different types of processors in transcoding multimedia resources in different coding formats can be determined in advance through testing. When a certain type of processor has the highest efficiency in transcoding multimedia resources in a certain coding format, the type is associated with the coding format, and allocation rules are generated based on the types associated with each coding format. Afterwards, the type of processor corresponding to the coding format of the source file can be determined based on the allocation rule, and the available processor of the type is determined as the target processor. This improves the efficiency of resource processing.
[0046] Optionally, a first score of the matching degree between the encoding format of the source file and the type of each available processor and a second score of the status data of each processor are determined based on a preset scoring rule. Afterwards, the first score and the second score corresponding to each processor can be weighted and summed based on a preset weight, and the comprehensive score corresponding to each processor can be determined, and any one of the processors corresponding to the preset number of maximum comprehensive scores can be determined as the target processor. This can accurately evaluate the efficiency of each available processor in transcoding the source file from multiple dimensions, which is conducive to improving the accuracy of determining the target processor.
[0047] The status data may include load, number of tasks to be transcoded, configuration, etc. This application does not impose any restrictions on this.
[0048] In addition, the efficiency of different types of processors in transcoding multimedia resources of different encoding formats can be determined in advance through testing, and the first scores of the matching degree between different types of processors and multimedia resources of different encoding formats can be determined based on the efficiency. When a certain type of processor has a higher efficiency in transcoding multimedia resources of a certain encoding format, the first score of the matching degree between the processor of this type and the multimedia resources of this encoding format is higher. Afterwards, a scoring rule for determining the first score can be generated based on the first scores of the matching degree between each type of processor and the multimedia resources of each encoding format, and the scoring rule can be saved in the system.
[0049] Similarly, the average efficiency of the processor transcoding multimedia resources of each encoding format under different state data can be determined in advance through testing, and the second score of the processor under each state data can be determined based on the average efficiency. Afterwards, a scoring rule for determining the second score can be generated based on each state data and its corresponding second score, and the scoring rule can be stored in the system.
[0050] Step 104, based on the attribute information of the source file, the state data of the target processor, and the network bandwidth, the file size of the slice file is determined.
[0051] The attribute information includes resolution, etc., which is not limited in this application.
[0052] In this application, the file size of the slice file that gives the best user experience under different network bandwidths, different resolutions of the source file, and different status data of the processor can be determined in advance through testing. Afterwards, the file size of the slice file with the best user experience is fitted for different network bandwidths, different resolutions of the source file, different status data of the processor, and the corresponding fitting function is determined. Afterwards, the file size of the slice file can be determined based on the fitting function, the attribute information of the source file, the status data of the target processor, and the network bandwidth. Thereby improving the efficiency of resource processing.
[0053] Optionally, the file size of the first slice file can be determined based on the network bandwidth, the preset maximum duration of the first response, and the state data of the target processor, and the file sizes of the remaining slice files can be determined based on the playback duration of the first slice file. This improves resource processing efficiency while ensuring the rationality of the first response time. This ensures that users do not experience any lags when playing multimedia resources.
[0054] Step 105: Based on the slice length, call the target processor to perform transcoding and slicing operations on the source file to obtain a slice file corresponding to the source file.
[0055] In the present application, the target processor can be called to transcode the source file, and at the same time, the transcoded file can be sliced according to the file size of the slice file to obtain each slice file.
[0056] Optionally, while calling the target processor to perform transcoding and slicing operations on the source file based on the slice length, the total playback time corresponding to each generated slice file is calculated in real time. When the total playback time is equal to the playback time of the source file, the transcoding and slicing operations on the source file are terminated, and a preset end identifier is added to the end of the last generated slice file to indicate to the client that the slice file is the last slice file of the source file.
[0057] Optionally, after generating a multimedia resource list based on the candidate resource identifier and the resource address associated with the candidate resource identifier, and sending the multimedia resource list to the client, in response to receiving a second acquisition request for multimedia resources sent by the client, the generated slice files corresponding to the target resource identifier in the second acquisition request are sequentially sent to the client, wherein the target resource identifier is any candidate resource identifier. This ensures smooth playback of multimedia resources.
[0058] Optionally, in response to receiving the second acquisition request for multimedia resources sent by the client, a list of slice file identifiers of the generated slice files corresponding to the target resource identifier may also be sent to the client. After receiving the slice file identifier, the client may send a third acquisition request to the server one by one to obtain each slice file. After receiving the third acquisition request, the server may send the slice file corresponding to the target slice file identifier in the third acquisition request to the client. While playing the received slice file, the client sends a third acquisition request for the next slice file to the server until it determines that the character at the end of the slice file is a preset end identifier and stops requesting slice files.
[0059] Optionally, when receiving the slice file corresponding to the last slice file identifier in the slice file identifier list sent by the server, the client determines whether the character at the end of the slice file is a preset end identifier. If the character at the end of the slice file is not a preset end identifier, a second acquisition request is sent to the server to request the slice file identifier list corresponding to the remaining slice files.
[0060] In the present application, upon receiving the first acquisition request of the multimedia resource list sent by the client, it is determined whether there are source files and slice files associated with the candidate resource identifier in the local storage. If there are no source files and slice files associated with the candidate resource identifier in the local storage, the connection address corresponding to the candidate resource identifier is determined, and the source file corresponding to the candidate resource identifier is obtained from the storage node based on the connection address. After that, based on the preset allocation rules and the encoding format of the source file, the target processor is determined from different types of available processors, and the file size of the slice file is determined based on the attribute information of the source file, the status data of the target processor, and the network bandwidth. Then, based on the slice length, the target processor is called to perform transcoding and slicing operations on the source file to obtain the slice file corresponding to the source file. Thus, by determining different target processors for source files of different encoding formats, and determining the file size of the slice file based on the current network bandwidth, the status data of the target processor, and the attribute information of the source file, the efficiency of resource processing is improved, thereby ensuring smooth playback of multimedia resources.
[0061] Figure 2 A flowchart of a resource processing method provided in an embodiment of the present application.
[0062] like Figure 2 As shown, the method includes:
[0063] Step 201, in response to receiving a first acquisition request for a multimedia resource list sent by a client, determine whether there are source files and slice files associated with a candidate resource identifier in the local storage, wherein the candidate resource identifier is a resource identifier associated with the request object identifier in the first acquisition request.
[0064] Step 202, when there are no source files and slice files associated with the candidate resource identifier in the local storage, determine the connection address corresponding to the candidate resource identifier, and obtain the source file corresponding to the candidate resource identifier from the storage node based on the connection address.
[0065] Step 203: Determine a target processor from different types of available processors based on a preset allocation rule and the encoding format of the source file.
[0066] In the present application, the specific implementation process of steps 201 to 203 can be found in the detailed description of any embodiment of the present application and will not be repeated here.
[0067] Step 204, based on the network bandwidth, the preset maximum duration of the first response, the state data of the target processor, and the attribute information of the source file, the file size of the first slice file is determined.
[0068] In this application, when the user triggers a multimedia resource playback request immediately after triggering a multimedia resource acquisition request, since the server does not store the multimedia resource, it is necessary to wait for the server to obtain the source file and perform transcoding and slicing before obtaining the multimedia resource. As a result, the user may have to wait for a long time.
[0069] In order to shorten the waiting time of users, the file size of the first slice file can be determined based on the network bandwidth, the preset maximum time of the first response, the state data of the target processor, and the attribute information of the source file, so that the difference between the sum of the time required for the target processor to transcode the first slice file and the time to transmit the first slice file based on the current network bandwidth and the preset maximum time of the first response is less than a threshold. This ensures that the first slice file is quickly returned within the waiting time acceptable to the user, improving the user experience.
[0070] For example, when the source file is video data, the attribute information includes the frame size. Based on the frame size, a preset number of frame data can be obtained from the source file in sequence multiple times, and the duration of the target processor transcoding the preset number of frame data and the duration of the current network bandwidth transmitting the preset number of frame data are determined. When the sum of the total duration of the frame data obtained by the target processor transcoding the 1-n times and the total duration of the frame data obtained by the network transmission for the 1-n times is less than the difference between the maximum duration of the preset first correspondence, the frame data obtained for the 1-n times is determined as a slice file.
[0071] In addition, the efficiency of transcoding source files of different encoding formats with different state data can be determined through testing, and the efficiency of transcoding source files of different encoding formats with different state data can be associated and saved in the system. Afterwards, the efficiency can be determined based on the state data of the target processor and the encoding format of the source file, and the duration of transcoding the preset number of frame data by the target processor can be determined based on the efficiency and the size of the preset number of frame data.
[0072] Step 205: Determine the file sizes of the remaining slice files based on the playback duration of the first slice file.
[0073] In this application, the file size of the remaining slice files can be determined based on the network bandwidth, the playback time of the first slice file, the state data of the target processor, and the attribute information of the source file, so that the difference between the sum of the time required for the target processor to transcode the remaining slice files and the time for transmitting the remaining slice files based on the current network bandwidth and the playback time of the first slice file is less than the threshold. The slice file to be played next is sent to the client in time, thereby ensuring that there is no freeze during the playback of multimedia resources.
[0074] Step 206: Based on the file size, call the target processor to perform transcoding and slicing operations on the source file to obtain a slice file corresponding to the source file.
[0075] In the present application, the specific implementation process of step 206 can be found in the detailed description of any embodiment of the present application, and will not be repeated here.
[0076] In the present application, in response to receiving the first acquisition request of the multimedia resource list sent by the client, it is determined whether there are source files and slice files associated with the candidate resource identifier in the local storage. In the case that there are no source files and slice files associated with the candidate resource identifier in the local storage, the connection address corresponding to the candidate resource identifier is determined, and the source file corresponding to the candidate resource identifier is obtained from the storage node based on the connection address. After that, based on the preset allocation rule and the encoding format of the source file, the target processor is determined from different types of available processors, and the file size of the first slice file is determined based on the network bandwidth, the preset maximum duration of the first response, the status data of the target processor, and the attribute information of the source file. Based on the playback duration of the first slice file, the file size of the remaining slice files is determined, and then, based on the file size, the target processor is called to perform transcoding and slicing operations on the source file to obtain the slice files corresponding to the source file. Thus, by determining different target processors for source files of different encoding formats, and determining the file sizes of the first slice file and the remaining slice files respectively, the efficiency of resource processing is improved, thereby ensuring smooth playback of multimedia resources.
[0077] Figure 3 A flowchart of a resource processing method provided in an embodiment of the present application.
[0078] like Figure 3 As shown, the method includes:
[0079] Step 301, in response to receiving a first acquisition request for a multimedia resource list sent by a client, determining whether there are source files and slice files associated with a candidate resource identifier in a local storage, wherein the candidate resource identifier is a resource identifier associated with a request object identifier in the first acquisition request;
[0080] Step 302, when there are no source files and slice files associated with the candidate resource identifier in the local storage, determine the connection address corresponding to the candidate resource identifier, and obtain the source file corresponding to the candidate resource identifier from the storage node based on the connection address.
[0081] Step 303: Determine a target processor from different types of available processors based on a preset allocation rule and the encoding format of the source file.
[0082] Step 304, based on the attribute information of the source file, the state data of the target processor, and the network bandwidth, the file size of the slice file is determined.
[0083] Step 305: Based on the file size, call the target processor to perform transcoding and slicing operations on the source file to obtain a slice file corresponding to the source file.
[0084] In the present application, the specific implementation process of steps 301 to 305 can be found in the detailed description of any embodiment of the present application and will not be repeated here.
[0085] Step 306, based on the state data of the target processor and the network bandwidth, estimate the total duration of transcoding and transmission of the first slice file.
[0086] In this application, based on the slice length, the target processor is called to perform transcoding and slicing operations on the source file, and the slice data corresponding to the source file is obtained. At the same time, the transcoding duration of the first slice file can be determined based on the state data of the target processor, and the transmission duration of the first slice file can be determined based on the network bandwidth. In this way, the total transcoding and transmission duration of the first slice file can be determined. This facilitates the screening of recommended content resources based on the total duration.
[0087] Step 307: based on the total duration, select target recommended resources from the recommended content resource library, and send the target recommended resources to the client.
[0088] Among them, the recommended content resource library contains multiple content resources to be recommended, and the content resources to be recommended can be advertising resources, hot resources, etc., and this application does not impose any restrictions on this.
[0089] In the present application, the total duration of transcoding and transmission of the first slice file can be matched with the playback duration of each content resource to be recommended. When the difference between the playback duration of a content resource to be recommended and the total duration corresponding to the first slice file is less than a preset threshold, the content resource to be recommended is determined as a target recommended resource, and the target recommended resource slice is sent to the client. While waiting to receive the first slice file, the client can display the target recommended resource. This is conducive to reducing the waiting time perceived by the user and improving the user experience.
[0090] In this application, the total transcoding and transmission time of the first slice file can be estimated based on the state data of the target processor and the network bandwidth, and based on the total transcoding and transmission time of the first slice file, the target recommended resources can be selected from the recommended content resource library and sent to the client. This helps to reduce the waiting time perceived by the user and improve the user experience.
[0091] Figure 4 A flowchart of a resource processing method provided in an embodiment of the present application.
[0092] like Figure 4 As shown, the method includes:
[0093] Figure 4 A schematic diagram of the structure of a resource processing device provided in an embodiment of the present application.
[0094] like Figure 4 As shown, the resource processing device 400 includes: a first determination module 410 , an acquisition module 420 , a second determination module 430 , a third determination module 440 , and a transcoding module 450 .
[0095] A first determination module 410 is configured to determine whether there are source files and slice files associated with a candidate resource identifier in the local storage in response to receiving a first acquisition request for a multimedia resource list sent by a client, wherein the candidate resource identifier is a resource identifier associated with a request object identifier in the first acquisition request;
[0096] The acquisition module 420 is used to determine the connection address corresponding to the candidate resource identifier when the source file and the slice file associated with the candidate resource identifier do not exist in the local storage, and obtain the source file corresponding to the candidate resource identifier from the storage node based on the connection address;
[0097] A second determination module 430 is used to determine a target processor from different types of available processors based on a preset allocation rule and the encoding format of the source file;
[0098] A third determination module 440 is used to determine the file size of the slice file based on the attribute information of the source file, the state data of the target processor, and the network bandwidth;
[0099] The transcoding module 450 is used to call the target processor to perform transcoding and slicing operations on the source file based on the file size, and obtain a slice file corresponding to the source file.
[0100] In a possible implementation of the embodiment of the present application, the third determining module 440 is configured to:
[0101] Determine the file size of the first slice file based on the network bandwidth, the preset maximum duration of the first response, the state data of the target processor, and the attribute information of the source file;
[0102] Based on the playback duration of the first slice file, the file sizes of the remaining slice files are determined.
[0103] In a possible implementation of the embodiment of the present application, a recommendation module is further included, which is used to:
[0104] Based on the state data of the target processor and the network bandwidth, estimate the total duration of transcoding and transmission of the first slice file;
[0105] Based on the total duration, select target recommended resources from the recommended content resource library;
[0106] The target recommended resource is sent to the client.
[0107] In a possible implementation of the embodiment of the present application, the second determining module 430 is configured to:
[0108] Determine a first score of the matching degree between the encoding format of the source file and the type of each of the available processors and a second score of the status data of each of the processors based on a preset scoring rule;
[0109] Performing weighted summation on the first score and the second score corresponding to each of the processors to determine a comprehensive score corresponding to each of the processors;
[0110] Any one of the processors corresponding to a preset number of maximum comprehensive scores is determined as the target processor.
[0111] In a possible implementation of the embodiment of the present application, the transcoding module 450 is used to:
[0112] Based on the file size, calling the target processor to perform transcoding and slicing operations on the source file;
[0113] Calculate the total playback time of each generated slice file in real time;
[0114] When the total playback duration is equal to the playback duration of the source file, a preset end identifier is added to the end of the last generated slice file.
[0115] In a possible implementation manner of the embodiment of the present application, a sending module is further included, which is used to:
[0116] Generate a multimedia resource list based on the candidate resource identifier and the resource address associated with the candidate resource identifier, and send the multimedia resource list to the client;
[0117] In response to receiving a second acquisition request for multimedia resources sent by the client, the generated slice files corresponding to the target resource identifier in the second acquisition request are sent to the client in sequence, wherein the target resource identifier is any of the candidate resource identifiers.
[0118] It should be noted that the explanation of the aforementioned resource processing method embodiment is also applicable to the device of this embodiment, so it will not be repeated here.
[0119] In the present application, upon receiving the first acquisition request of the multimedia resource list sent by the client, it is determined whether there are source files and slice files associated with the candidate resource identifier in the local storage. If there are no source files and slice files associated with the candidate resource identifier in the local storage, the connection address corresponding to the candidate resource identifier is determined, and the source file corresponding to the candidate resource identifier is obtained from the storage node based on the connection address. After that, based on the preset allocation rules and the encoding format of the source file, the target processor is determined from different types of available processors, and the file size of the slice file is determined based on the attribute information of the source file, the status data of the target processor, and the network bandwidth. Then, based on the slice length, the target processor is called to perform transcoding and slicing operations on the source file to obtain the slice file corresponding to the source file. Thus, by determining different target processors for source files of different encoding formats, and determining the file size of the slice file based on the current network bandwidth, the status data of the target processor, and the attribute information of the source file, the efficiency of resource processing is improved, thereby ensuring smooth playback of multimedia resources.
[0120] According to an embodiment of the present application, the present application also provides an electronic device and a readable storage medium.
[0121] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device may include:
[0122] A memory 501 storing executable program codes;
[0123] a processor 502 coupled to the memory 501;
[0124] The processor 502 calls the executable program code stored in the memory 501 to execute the resource processing method provided in any embodiment of the present application.
[0125] The computer device embodiment and the method embodiment are embodiments based on the same inventive concept, and the relevant parts can be referenced to each other. The computer device embodiment corresponds to the method embodiment and has the same technical effect as the method embodiment. For specific description, refer to the method embodiment.
[0126] An embodiment of the present application discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute a resource processing method provided by any embodiment of the present application.
[0127] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.
[0128] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A resource processing method, characterized in that: include: In response to receiving a first acquisition request for a multimedia resource list sent by a client, determining whether there are source files and slice files associated with a candidate resource identifier in a local storage, wherein the candidate resource identifier is a resource identifier associated with a request object identifier in the first acquisition request; In the case that the source file and the slice file associated with the candidate resource identifier do not exist in the local storage, determine the connection address corresponding to the candidate resource identifier, and obtain the source file corresponding to the candidate resource identifier from the storage node based on the connection address; Determining a target processor from different types of available processors based on a preset allocation rule and an encoding format of the source file; Determine the file size of the slice file based on the attribute information of the source file, the state data of the target processor, and the network bandwidth; Based on the file size, the target processor is called to perform transcoding and slicing operations on the source file to obtain a slice file corresponding to the source file.
2. The method according to claim 1, characterized in that The determining the file size of the slice file based on the attribute information of the source file, the state data of the target processor, and the network bandwidth includes: Determine the file size of the first slice file based on the network bandwidth, the preset maximum duration of the first response, the state data of the target processor, and the attribute information of the source file; Based on the playback duration of the first slice file, the file sizes of the remaining slice files are determined.
3. The method according to claim 1, characterized in that Also includes: Based on the state data of the target processor and the network bandwidth, estimate the total duration of transcoding and transmission of the first slice file; Based on the total duration, select target recommended resources from the recommended content resource library; The target recommended resource is sent to the client.
4. The method according to claim 1, characterized in that The step of determining a target processor from different types of available processors based on a preset allocation rule and an encoding format of the source file includes: Determine a first score of the matching degree between the encoding format of the source file and the type of each of the available processors and a second score of the status data of each of the processors based on a preset scoring rule; Performing weighted summation on the first score and the second score corresponding to each of the processors to determine a comprehensive score corresponding to each of the processors; Any one of the processors corresponding to a preset number of maximum comprehensive scores is determined as the target processor.
5. The method according to claim 1, characterized in that The step of calling the target processor to perform transcoding and slicing operations on the source file based on the file size to obtain a slice file corresponding to the source file includes: Based on the file size, calling the target processor to perform transcoding and slicing operations on the source file; Calculate the total playback time of each generated slice file in real time; When the total playback duration is equal to the playback duration of the source file, a preset end identifier is added to the end of the last generated slice file.
6. The method according to claim 5, characterized in that Also includes: Generate a multimedia resource list based on the candidate resource identifier and the resource address associated with the candidate resource identifier, and send the multimedia resource list to the client; In response to receiving a second acquisition request for multimedia resources sent by the client, the generated slice files corresponding to the target resource identifier in the second acquisition request are sent to the client in sequence, wherein the target resource identifier is any of the candidate resource identifiers.
7. A resource processing device, characterized in that: include: A first determination module is configured to determine whether there are source files and slice files associated with a candidate resource identifier in a local storage in response to receiving a first acquisition request for a multimedia resource list sent by a client, wherein the candidate resource identifier is a resource identifier associated with a request object identifier in the first acquisition request; An acquisition module, used to determine a connection address corresponding to the candidate resource identifier when the source file and slice file associated with the candidate resource identifier do not exist in the local storage, and acquire the source file corresponding to the candidate resource identifier from the storage node based on the connection address; A second determination module, configured to determine a target processor from different types of available processors based on a preset allocation rule and an encoding format of the source file; A third determination module is used to determine the file size of the slice file based on the attribute information of the source file, the state data of the target processor, and the network bandwidth; The transcoding module is used to call the target processor to perform transcoding and slicing operations on the source file based on the file size, and obtain a slice file corresponding to the source file.
8. The device according to claim 7, characterized in that The third determining module is used to: Determine the file size of the first slice file based on the network bandwidth, the preset maximum duration of the first response, the state data of the target processor, and the attribute information of the source file; Based on the playback duration of the first slice file, the file sizes of the remaining slice files are determined.
9. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.
10. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-6.
Citation Information
Patent Citations
System, method and service node for providing video contents
CN103179433A
Audio and video transcoding task allocation method and allocation device
CN112422977A
Webpage-based file transmission method and device and readable storage medium
CN115914207A