CN113766230A - Media file encoding method and device, computer equipment and storage medium - Google Patents

Media file encoding method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN113766230A
CN113766230A CN202111296739.8A CN202111296739A CN113766230A CN 113766230 A CN113766230 A CN 113766230A CN 202111296739 A CN202111296739 A CN 202111296739A CN 113766230 A CN113766230 A CN 113766230A
Authority
CN
China
Prior art keywords
file
coding
coded
queue
weight value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111296739.8A
Other languages
Chinese (zh)
Other versions
CN113766230B (en
Inventor
许世博
白剑
黄海亮
梁瑛玮
张海林
鲁和平
李长杰
陈焕然
李乐
王浩
洪行健
冷冬
丁一
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Yifang Information Technology Co ltd
Original Assignee
Guangzhou Easefun Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Easefun Information Technology Co ltd filed Critical Guangzhou Easefun Information Technology Co ltd
Priority to CN202111296739.8A priority Critical patent/CN113766230B/en
Publication of CN113766230A publication Critical patent/CN113766230A/en
Application granted granted Critical
Publication of CN113766230B publication Critical patent/CN113766230B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/127Prioritisation of hardware or computational resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/80Responding to QoS
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Computing Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The application relates to the field of coding, and provides a media file coding method, a device, computer equipment and a storage medium, which are used for acquiring a plurality of files to be coded; determining a coding queue corresponding to each file to be coded according to a preset method; acquiring historical data of historical release files of users corresponding to the files to be coded in each coding queue, wherein the historical data comprises one or more of first access time, access amount and average coding duration; calculating a target weight value of each file to be coded according to the historical data; calculating the resource proportion of each coding queue according to the target weight value, and distributing calculation resources for each coding queue according to the resource proportion; and coding each file to be coded according to the weight value through the distributed computing resources. By the method and the device, the files with high release failure requirements can be preferentially coded under the condition of limited computing resources.

Description

Media file encoding method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of encoding technologies, and in particular, to a method and an apparatus for encoding a media file, a computer device, and a storage medium.
Background
With the development of audio, video and internet technologies, resource data of media files such as audio and video files are rapidly increased, parameters such as definition, resolution, code rate and video duration of audio and video resources uploaded by users are different, and on the premise that computing resources are limited, effective task scheduling cannot be performed on audio and video coding, so that a large number of audio and video coding tasks are accumulated, and poor queuing waiting feeling is brought to users with high audio and video resource release timeliness requirements. If a large amount of computing resources are added to process the coding task in the peak period of the business, the cost of the computing resources is greatly increased, and the burden of a company is too heavy.
Disclosure of Invention
The application mainly aims to provide a media file encoding method, a media file encoding device, computer equipment and a storage medium, and aims to solve the technical problem that encoding tasks are stacked under the condition of limited computing resources, so that the user encoding waiting time with high publishing timeliness requirements is long.
In order to achieve the above object, the present application provides a media file encoding method, comprising the steps of:
acquiring a plurality of files to be coded;
determining a coding queue corresponding to each file to be coded according to a preset method;
acquiring historical data of historical release files of users corresponding to the files to be coded in each coding queue, wherein the historical data comprises one or more of first access time, access amount and average coding duration; calculating a target weight value of each file to be coded according to the historical data;
calculating the resource proportion of each coding queue according to the target weight value, and distributing calculation resources for each coding queue according to the resource proportion;
and coding each file to be coded according to the weight value through the distributed computing resources.
Further, the encoding queues comprise a fast encoding queue, a long video encoding queue and a short video encoding queue; the step of determining the coding queue corresponding to each file to be coded according to a preset method comprises the following steps:
detecting whether each file to be coded can carry out a coding task of multiplexing video coding;
adding the file to be coded which can carry out the coding task of multiplexing video coding into a rapid coding queue;
comparing the time length of the file to be coded of the coding task which can not carry out multiplexing video coding with a preset time length;
adding a file to be coded with the time length being more than or equal to a preset time length into a long video coding queue;
and adding the file to be coded with the time length less than the preset time length into a short video coding queue.
Further, the historical data includes a first access time; the step of calculating the target weight value of each file to be encoded according to the historical data comprises the following steps:
obtaining a classification label of each file to be coded;
determining a historical grouping corresponding to each file to be coded according to the classification label, wherein the historical grouping comprises a plurality of historical release files;
and determining a first target weight value of the corresponding file to be coded according to the first access time of the history release file in the history group corresponding to each file to be coded.
Further, the historical data includes an amount of access; the step of calculating the target weight value of each file to be encoded according to the historical data comprises the following steps:
acquiring the access quantity of the historical release file of the user corresponding to each file to be coded in a preset time period;
calculating the difference value corresponding to the access amount and the preset access threshold value in each preset time period;
and calculating a second target weight value of the corresponding file to be coded according to the difference value.
Further, the historical data comprises an average encoding duration; the step of calculating the target weight value of each file to be encoded according to the historical data comprises the following steps:
in the long video coding queue, obtaining the average coding duration of historical release files belonging to the long video coding queue in the historical release files of the users corresponding to the files to be coded;
comparing the average coding time length corresponding to each file to be coded with a preset coding time length threshold value;
if the corresponding average coding time length is larger than the preset coding time length threshold value, acquiring a default weight, and subtracting a preset weight value from the default weight to obtain a third target weight value of the corresponding file to be coded.
Further, the step of encoding each file to be encoded according to the weight value includes:
acquiring the access definition ratio of a historical release file of a user corresponding to the file to be coded;
and preferentially coding the access definition corresponding to the file to be coded with the highest definition.
Further, the step of calculating the resource proportion of each coding queue according to the target weight value includes:
acquiring the number of files to be coded, of which the target weight values in each coding queue exceed a weight threshold;
and calculating the resource occupation ratio of each coding queue according to the number.
The present application also provides a media file encoding apparatus, comprising:
the device comprises an acquisition unit, a coding unit and a coding unit, wherein the acquisition unit is used for acquiring a plurality of files to be coded;
the determining unit is used for determining the coding queue corresponding to each file to be coded according to a preset method;
the first calculation unit is used for acquiring historical data of historical release files of users corresponding to the files to be coded in each coding queue, wherein the historical data comprises one or more of first access time, access amount and average coding time; calculating a target weight value of each file to be coded according to the historical data;
the second calculation unit is used for calculating the resource proportion of each coding queue according to the target weight value and distributing calculation resources for each coding queue according to the resource proportion;
and the coding unit is used for coding each file to be coded according to the weight value through the distributed computing resources.
The present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the media file encoding method according to any one of the above when executing the computer program.
The present application also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the media file encoding method of any of the above.
According to the media file encoding method, the media file encoding device, the computer equipment and the storage medium, the target weight value of each file to be encoded is calculated through historical data, the resource proportion is calculated for each queue to be encoded according to the target weight value, the calculation resources are dynamically and elastically adjusted for each encoding queue, the encoding sequence is optimized, and queue accumulation is reduced. Meanwhile, a target weight value is calculated through historical data, the sequence of the coding queue is automatically adjusted through analysis, the file to be coded with high real-time requirement is preferentially coded, and good queuing experience is provided for users.
Drawings
FIG. 1 is a diagram illustrating steps of a media file encoding method according to an embodiment of the present application;
FIG. 2 is a block diagram of an apparatus for encoding a media file according to an embodiment of the present application;
fig. 3 is a block diagram illustrating a structure of a computer device according to an embodiment of the present application.
The implementation, functional features and advantages of the objectives of the present application will be further explained with reference to the accompanying drawings.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Referring to fig. 1, an embodiment of the present application provides a media file encoding method, including the following steps:
step S1, acquiring a plurality of files to be coded;
step S2, determining the coding queue corresponding to each file to be coded according to a preset method;
step S3, obtaining historical data of historical published files of users corresponding to the files to be coded in each coding queue, wherein the historical data comprises one or more of first access time, access amount, average coding time and access definition ratio; calculating a target weight value of each file to be coded according to the historical data;
step S4, calculating the resource ratio of each coding queue according to the target weight value, and distributing calculation resources for each coding queue according to the resource ratio;
and step S5, coding each file to be coded according to the weight value through the distributed computing resources.
In this embodiment, as described in step S1, the file to be encoded is a file that has not been encoded after being uploaded by the user, and since there are many uploaded files due to limited computing resources, the file to be encoded cannot be encoded timely and effectively, the file to be encoded includes both video and audio, and the corresponding encoding is divided into video encoding and audio encoding, where the video encoding is a manner of converting a video in a certain file format into a file in another file format by using a specific compression technique. Similarly, audio coding is a way of compressing audio.
As described in the above step S2, encoding queues are preset, and each file to be encoded can be attributed to one encoding queue.
As described in step S3, in each encoding queue, the respective target weight value of each document to be encoded is calculated, each document to be encoded is uploaded by the corresponding user, the user may have some historical published documents that have been encoded and published, and after the historical published documents are published, the user has corresponding access to form some respective corresponding historical data. The time of a first user accessing the historical release file is used as the first access time of the corresponding historical release file, all the number of visitors of the historical release file is used as the corresponding access amount, the average coding time length is the average value of the coding time lengths of all the historical release files of the user, and the release file calculates the target weight value of each file to be coded according to the historical data.
As described in the above steps S4-S5, the resource ratio is calculated for each file to be encoded according to the target weight value, the computing resources are distributed according to the corresponding resource ratio, and the files to be encoded in the encoding queue are encoded according to the distributed computing resources. The files to be coded in each coding queue have respective target weight values, and are arranged in a descending order according to the target weight values, and the files to be coded which are arranged in front are preferentially coded.
In this embodiment, the target weight value of each file to be encoded is calculated through the historical data, the resource proportion is calculated for each queue to be encoded according to the target weight value, the calculation resources are dynamically and elastically adjusted for each encoding queue, the encoding sequence is optimized, and queue accumulation is reduced. Meanwhile, a target weight value is calculated through historical data, the sequence of the coding queue is automatically adjusted through analysis, the file to be coded with high real-time requirement is preferentially coded, and good queuing experience is provided for users.
In one embodiment, the encoding queues include a fast encoding queue, a long video encoding queue, a short video encoding queue; the step S2 of determining the encoding queue corresponding to each file to be encoded according to a preset method includes:
step S21, detecting whether each file to be coded can carry out the coding task of multiplexing video coding;
step S22, adding the file to be coded which can carry out the coding task of multiplexing video coding into a rapid coding queue;
step S23, comparing the time length of the file to be coded of the coding task which can not carry out multiplexing video coding with the preset time length;
step S24, adding the file to be coded with the time length more than or equal to the preset time length into a long video coding queue;
and step S25, adding the file to be coded with the time length less than the preset time length into a short video coding queue.
In this embodiment, as described in the above steps S21-S22, three encoding queues are preset, which are a fast encoding queue, a long video encoding queue and a short video encoding queue, so that a user can select whether to multiplex video encoding when uploading a file, and add a file to be encoded, which can perform an encoding task of multiplexing video encoding, to a specific fast encoding queue through selection during file uploading. Because the encoding task of the part of the file to be encoded is short in time consumption, the encoding can be completed quickly, and better experience can be provided for customers.
As described in the above steps S23-S25, for the to-be-encoded file that is not added to the fast encoding queue, the time length of the to-be-encoded file is analyzed, if the time length is less than the preset time length, and if the preset time length can be set to 10 minutes, the to-be-encoded file is added to the short video encoding queue, and the remaining to-be-encoded files are automatically added to the long video encoding queue. According to the embodiment, the files to be coded are divided into three coding queues according to the selection and the duration of the user, so that the method can adapt to different files to be coded.
In one embodiment, the historical data includes a first access time; the step of calculating the target weight value of each file to be encoded according to the historical data comprises the following steps:
obtaining a classification label of each file to be coded;
determining a historical grouping corresponding to each file to be coded according to the classification label, wherein the historical grouping comprises a plurality of historical release files;
and determining a first target weight value of the corresponding file to be coded according to the first access time of the history release file in the history group corresponding to each file to be coded.
In this embodiment, a big data analysis platform may be pre-established for analyzing the CDN access log, and the CDN access log records key information about CDN operation and a user request, so that it is very critical to analyze the CDN service quality, and it is also very significant to perform data mining analysis on the CDN service quality. A common CDN log contains mainly the following fields: time, duration, traffic, request URL, request source IP address, UA, status code, hit status, etc. The time field stores the time requested by a User, the duration field stores the duration of the request, the flow field stores a downlink flow value when the flow field is pulled, the uplink flow value when the flow field is pushed, the request URL field stores a specific URL requested by the User, a request source IP address stores a source IP address of the User who initiates the request, the UA field stores a User-Agent type used when the User initiates the request, the state code field stores a state code of the request, common states are 2XX, 3XX, 4XX and 5XX, the HIT state field stores the state of whether the CDN cache is HIT or not, and the value can be HIT or MISS.
When a user uploads a file, a classification label is selected for the file, meanwhile, corresponding classification labels also exist in all historical release files of the user, a historical group is automatically formed according to the classification labels, the classification labels of the files to be coded automatically classify the files to be coded into the historical groups with the same classification labels, the first access time of all the historical release files of the user in the historical group where the files to be coded are located is obtained, and the release time of the corresponding historical release files is compared. If a historical release file has first access within 30 minutes after release, setting a first historical weight value of the historical release file to be 10; if the file is accessed for the first time within 30-60 minutes after the file is published, setting a first historical weight value of the historical published file to be 9; if the file is accessed for the first time within 1-3 hours, setting the first history weight value of the history release file to be 8; if the file is accessed for the first time within 4-6 hours, setting a first history weight value of the history release file to be 7; if the file is accessed for the first time within 7-9 hours, setting a first history weight value of the history release file to be 6; if the file is accessed for the first time within 10-12 hours, setting a first history weight value of the history release file to be 5; if the file is accessed for the first time within 13-16 hours, setting a first history weight value of the history release file to be 4; if the file is accessed for the first time within 17-19 hours, setting the first history weight value of the history release file to be 3; if the file is accessed for the first time within 20-23 hours, setting a first history weight value of the history release file to be 2; if the access is not performed for the first time after 24 hours, the first historical weight value of the historical publishing file is set to be 1. Analyzing first history weight values of all history published files in the history grouping, calculating an average history weight value of the history grouping according to the first history weight values, and taking the first history weight value of the history grouping as a first target weight value of the file to be encoded.
In an embodiment, the historical data includes an amount of visits; the step of calculating the target weight value of each file to be encoded according to the historical data comprises the following steps:
acquiring the access quantity of the historical release file of the user corresponding to each file to be coded in a preset time period;
calculating the difference value corresponding to the access amount and the preset access threshold value in each preset time period;
and calculating a second target weight value of the corresponding file to be coded according to the difference value.
In this embodiment, the access amount of the history release file of the user corresponding to each file to be encoded in a preset time period may be obtained according to the CDN access log, for example, the access amount of each history release file on the first day after release is obtained, a default weight is set, a difference between the access amount on the first day and a preset access threshold is calculated, if the difference is greater than 0, a result obtained by adding a preset weight value to the default weight is used as a second target weight value of the history release file, if the difference is equal to 0, the default weight is directly used as a second history weight value of the history release file, if the difference is less than 0, a result obtained by subtracting a preset weight value from the default weight is used as a second history weight value of the history release file, and an average of the second history weight values of all history release files of the corresponding user is calculated, and taking the average value as a second target weight value of the corresponding file to be coded.
Further, a preset time period can be divided into a fixed number of time segments, for example, one day is divided into 12 time segments, one time segment lasts for two hours, if the access volume of the first day after the historical release file of the user is released shows a rising trend, a preset weight value is added to the default weight value to serve as a second historical weight value, specifically, the access volume of the next time segment in the adjacent related time segments is greater than or equal to the access volume of the previous time segment; and if the visit volume of the user on the first day after the historical release file is released shows a descending trend, namely the visit volume of the next time segment in the adjacent relevant time segments is less than that of the previous time segment, subtracting the preset weight value from the default weight value to serve as a second historical weight value.
In one embodiment, the historical data includes an average encoding duration; the step of calculating the target weight value of each file to be encoded according to the historical data comprises the following steps:
in the long video coding queue, obtaining the average coding duration of historical release files belonging to the long video coding queue in the historical release files of the users corresponding to the files to be coded;
comparing the average coding time length corresponding to each file to be coded with a preset coding time length threshold value;
if the corresponding average coding time length is larger than the preset coding time length threshold value, acquiring a default weight, and subtracting a preset weight value from the default weight to obtain a third target weight value of the corresponding file to be coded.
In this embodiment, the big data analysis platform stores an encoding log for recording the encoding duration of each historical published file, but because the encoding durations of the fast encoding queue and the short video encoding queue are both relatively short, this embodiment is applied to the long video encoding queue to obtain the historical published files of the users corresponding to the files to be encoded in the long video encoding queue, determine the historical published files belonging to the long video encoding queue according to the historical published files, calculate the average encoding duration according to the encoding durations of the historical published files belonging to the long video encoding queue, compare the average encoding duration with the preset encoding duration threshold, and set the default weight to 5. And if the average coding time length exceeds a preset coding time length threshold value, subtracting 1 from the default weight to obtain a third target weight value, and otherwise, adding 1 to the default weight.
Further, the first target weight value, the second target weight value, and the third target weight value may be individually used as a final target weight value of each to-be-encoded file, or three values may be fused together to be used as a final target weight value, specifically, the final target weight value may be calculated according to Y = aX1+ bX2+ cX3, where X1, X2, and X3 are the first target weight value, the second target weight value, and the third target weight value, and a, b, and c are preset weights corresponding to the first target weight value, the second target weight value, and the third target weight value, respectively.
In an embodiment, the step of encoding each file to be encoded according to the weight value includes:
acquiring the access definition ratio of a historical release file of a user corresponding to the file to be coded;
and preferentially coding the access definition corresponding to the file to be coded with the highest definition.
In this embodiment, the access definition ratio refers to a definition ratio used by all visitors to a history distribution file, for example, the history distribution file has 3 definitions, which are respectively smooth, high definition and super definition, and the definition ratios are used. And acquiring all access definition proportion conditions of users corresponding to the file to be coded, and when the file to be coded is coded, the file to be coded is coded smoothly with the highest access definition proportion, and the file to be coded is coded into smooth definition preferentially.
In an embodiment, the step of calculating the resource proportion of each coding queue according to the target weight value includes:
acquiring the number of files to be coded, of which the target weight values in each coding queue exceed a weight threshold;
and calculating the resource occupation ratio of each coding queue according to the number.
In this embodiment, a weight threshold is preset, and the target weight values of all the files to be encoded are compared with the weight threshold to obtain the number of the files to be encoded whose target weight values are greater than the weight threshold in each encoding queue, for example, if the number of the fast encoding queues is 10, the number of the long video encoding queues is 15, and the number of the short video encoding queues is 20, the total number is 45, the resource occupation ratio of the fast encoding queues is 10/45, the resource occupation ratio of the long video encoding queues is 15/45, and the resource occupation ratio of the short video encoding queues is 20/45. Further, when each coding queue is coded, coding is carried out according to the descending order of the target weight values, when all the files to be coded with the target weight values larger than the preset weight values are coded, the resource occupation ratio is recalculated, similarly, another weight threshold value is set, the other weight threshold value is smaller than the initial weight threshold value, the resource occupation ratio is recalculated according to the target weight values and the weight threshold values of the rest files to be coded, and the resource occupation ratio condition of each coding queue is dynamically adjusted.
Referring to fig. 2, an embodiment of the present application provides a media file encoding apparatus, including:
an obtaining unit 10, configured to obtain a plurality of files to be encoded;
the determining unit 20 is configured to determine, according to a preset method, an encoding queue corresponding to each to-be-encoded file;
the first calculating unit 30 is configured to obtain, in each encoding queue, historical data of a history release file of a user corresponding to each to-be-encoded file, where the historical data includes one or more of first access time, access amount, and average encoding duration; calculating a target weight value of each file to be coded according to the historical data;
the second calculating unit 40 is configured to calculate a resource proportion of each coding queue according to the target weight value, and allocate a calculation resource to each coding queue according to the resource proportion;
and the encoding unit 50 is configured to encode each to-be-encoded file according to the weight value through the allocated computing resource.
In one implementation, the determining unit 20 includes:
the detection subunit is used for detecting whether each file to be coded can carry out a coding task of multiplexing video coding;
the first adding subunit is used for adding the file to be coded, which can carry out a coding task of multiplexing video coding, into a fast coding queue;
the first comparison subunit is used for comparing the time length of the file to be coded of the coding task which can not carry out multiplexing video coding with a preset time length;
the second adding subunit is used for adding the file to be coded with the time length greater than or equal to the preset time length into the long video coding queue;
and the third adding subunit is used for adding the file to be coded, of which the time length is less than the preset time length, into the short video coding queue.
In one implementation, the first computing unit 30 includes:
the first obtaining subunit is used for obtaining the classification label of each file to be coded;
the first determining subunit is configured to determine, according to the classification tag, a history group corresponding to each to-be-encoded file, where the history group includes a plurality of history release files;
and the second determining subunit determines a first target weight value of the corresponding file to be encoded according to the first access time of the history release file in the history group corresponding to each file to be encoded.
In one implementation, the first computing unit 30 includes:
the second obtaining subunit is configured to obtain an access amount of a history release file of a user corresponding to each to-be-encoded file within a preset time period;
the first calculating subunit is used for calculating the difference value corresponding to the access amount and the preset access threshold value in each preset time period;
and the second calculating subunit is used for calculating a second target weight value of the corresponding file to be encoded according to the difference value.
In one implementation, the first computing unit 30 includes:
a third obtaining subunit, configured to obtain, in the long video coding queue, an average coding duration of a history published file belonging to the long video coding queue in history published files of users corresponding to the files to be coded;
the second comparison subunit is configured to compare the average coding duration corresponding to each to-be-coded file with a preset coding duration threshold;
and the fourth obtaining subunit is configured to obtain a default weight if the corresponding average coding duration is greater than the preset coding duration threshold, and subtract a preset weight from the default weight to obtain a third target weight of the corresponding file to be coded.
In one embodiment, the encoding unit 50 includes:
a fifth obtaining subunit, configured to obtain an access clarity ratio of a history release file of a user corresponding to the file to be encoded;
and the coding subunit is used for preferentially coding the access definition corresponding to the file to be coded with the highest definition.
In an embodiment, the second computing unit 40 includes:
a sixth obtaining subunit, configured to obtain the number of files to be encoded in each encoding queue, where a target weight value exceeds a weight threshold;
and the third calculation subunit is used for calculating the resource occupation ratio of each coding queue according to the number.
In this embodiment, please refer to the above method embodiment for the specific implementation of each unit and sub-unit, which is not described herein again.
Referring to fig. 3, a computer device, which may be a server and whose internal structure may be as shown in fig. 3, is also provided in the embodiment of the present application. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the computer designed processor is used to provide computational and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing data and the like. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a media file encoding method.
Those skilled in the art will appreciate that the architecture shown in fig. 3 is only a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects may be applied.
An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon, where the computer program, when executed by a processor, implements a media file encoding method.
In summary, for the media file encoding method, apparatus, computer device and storage medium provided in the embodiments of the present application, a plurality of files to be encoded are obtained; determining a coding queue corresponding to each file to be coded according to a preset method; acquiring historical data of historical release files of users corresponding to the files to be coded in each coding queue, wherein the historical data comprises one or more of first access time, access amount and average coding duration; calculating a target weight value of each file to be coded according to the historical data; calculating the resource proportion of each coding queue according to the target weight value, and distributing calculation resources for each coding queue according to the resource proportion; and coding each file to be coded according to the weight value through the distributed computing resources. According to the method and the device, the target weight value of each file to be coded is calculated through historical data, the resource proportion is calculated for each queue to be coded according to the target weight value, the calculation resources are adjusted for each coding queue through dynamic elasticity, the coding sequence is optimized, and queue accumulation is reduced. Meanwhile, a target weight value is calculated through historical data, the sequence of the coding queue is automatically adjusted through analysis, the file to be coded with high real-time requirement is preferentially coded, and good queuing experience is provided for users.
It will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by hardware associated with instructions of a computer program, which may be stored on a non-volatile computer-readable storage medium, and when executed, may include processes of the above embodiments of the methods. Any reference to memory, storage, database, or other medium provided herein and used in the examples may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double-rate SDRAM (SSRSDRAM), Enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that includes the element.
The above description is only for the preferred embodiment of the present application and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application, or which are directly or indirectly applied to other related technical fields, are intended to be included within the scope of the present application.

Claims (10)

1. A method for encoding a media file, comprising the steps of:
acquiring a plurality of files to be coded;
determining a coding queue corresponding to each file to be coded according to a preset method;
acquiring historical data of historical release files of users corresponding to the files to be coded in each coding queue, wherein the historical data comprises one or more of first access time, access amount and average coding duration; calculating a target weight value of each file to be coded according to the historical data;
calculating the resource proportion of each coding queue according to the target weight value, and distributing calculation resources for each coding queue according to the resource proportion;
and coding each file to be coded according to the weight value through the distributed computing resources.
2. The media file encoding method of claim 1, wherein the encoding queue comprises a fast encoding queue, a long video encoding queue, a short video encoding queue; the step of determining the coding queue corresponding to each file to be coded according to a preset method comprises the following steps:
detecting whether each file to be coded can carry out a coding task of multiplexing video coding;
adding the file to be coded which can carry out the coding task of multiplexing video coding into a rapid coding queue;
comparing the time length of the file to be coded of the coding task which can not carry out multiplexing video coding with a preset time length;
adding a file to be coded with the time length being more than or equal to a preset time length into a long video coding queue;
and adding the file to be coded with the time length less than the preset time length into a short video coding queue.
3. The media file encoding method of claim 1, wherein the history data includes a first access time; the step of calculating the target weight value of each file to be encoded according to the historical data comprises the following steps:
obtaining a classification label of each file to be coded;
determining a historical grouping corresponding to each file to be coded according to the classification label, wherein the historical grouping comprises a plurality of historical release files;
and determining a first target weight value of the corresponding file to be coded according to the first access time of the history release file in the history group corresponding to each file to be coded.
4. The media file encoding method of claim 1, wherein the history data includes an access amount; the step of calculating the target weight value of each file to be encoded according to the historical data comprises the following steps:
acquiring the access quantity of the historical release file of the user corresponding to each file to be coded in a preset time period;
calculating the difference value corresponding to the access amount and the preset access threshold value in each preset time period;
and calculating a second target weight value of the corresponding file to be coded according to the difference value.
5. The media file encoding method of claim 2, wherein the historical data comprises an average encoding duration; the step of calculating the target weight value of each file to be encoded according to the historical data comprises the following steps:
in the long video coding queue, obtaining the average coding duration of historical release files belonging to the long video coding queue in the historical release files of the users corresponding to the files to be coded;
comparing the average coding time length corresponding to each file to be coded with a preset coding time length threshold value;
if the corresponding average coding time length is larger than the preset coding time length threshold value, acquiring a default weight, and subtracting a preset weight value from the default weight to obtain a third target weight value of the corresponding file to be coded.
6. The method according to claim 1, wherein the step of encoding each of the files to be encoded according to the weight value comprises:
acquiring the access definition ratio of a historical release file of a user corresponding to the file to be coded;
and preferentially coding the access definition corresponding to the file to be coded with the highest definition.
7. The method according to claim 1, wherein the step of calculating the resource ratio of each encoding queue according to the target weight value comprises:
acquiring the number of files to be coded, of which the target weight values in each coding queue exceed a weight threshold;
and calculating the resource occupation ratio of each coding queue according to the number.
8. An apparatus for encoding a media file, comprising:
the device comprises an acquisition unit, a coding unit and a coding unit, wherein the acquisition unit is used for acquiring a plurality of files to be coded;
the determining unit is used for determining the coding queue corresponding to each file to be coded according to a preset method;
the first calculation unit is used for acquiring historical data of historical release files of users corresponding to the files to be coded in each coding queue, wherein the historical data comprises one or more of first access time, access amount and average coding time; calculating a target weight value of each file to be coded according to the historical data;
the second calculation unit is used for calculating the resource proportion of each coding queue according to the target weight value and distributing calculation resources for each coding queue according to the resource proportion;
and the coding unit is used for coding each file to be coded according to the weight value through the distributed computing resources.
9. A computer device comprising a memory and a processor, the memory having stored therein a computer program, characterized in that the processor, when executing the computer program, implements the steps of a media file encoding method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the media file encoding method of any one of claims 1 to 7.
CN202111296739.8A 2021-11-04 2021-11-04 Media file encoding method and device, computer equipment and storage medium Active CN113766230B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111296739.8A CN113766230B (en) 2021-11-04 2021-11-04 Media file encoding method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111296739.8A CN113766230B (en) 2021-11-04 2021-11-04 Media file encoding method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113766230A true CN113766230A (en) 2021-12-07
CN113766230B CN113766230B (en) 2022-04-01

Family

ID=78784607

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111296739.8A Active CN113766230B (en) 2021-11-04 2021-11-04 Media file encoding method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113766230B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114697299A (en) * 2022-04-21 2022-07-01 湖南快乐阳光互动娱乐传媒有限公司 Audio and video transcoding priority determination method, system, device and storage medium
CN116737676A (en) * 2023-08-15 2023-09-12 中移(苏州)软件技术有限公司 File storage method, device, electronic equipment and readable storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10304372A (en) * 1997-04-30 1998-11-13 Sony Corp Image coding method and device, and image transmission method
US20040210930A1 (en) * 2002-07-26 2004-10-21 Sean Cullinan Automatic selection of encoding parameters for transmission of media objects
US20080013628A1 (en) * 2006-07-14 2008-01-17 Microsoft Corporation Computation Scheduling and Allocation for Visual Communication
CN102130949A (en) * 2011-03-10 2011-07-20 肖智刚 User contribution-based method and system for sharing personalized digital resources
CN105141965A (en) * 2015-08-05 2015-12-09 中央电视台 Coding method and coding device
CN107911716A (en) * 2010-04-14 2018-04-13 爱立信电视公司 Adaptation rate for conveying Video service to service group changes
CN111212301A (en) * 2020-01-09 2020-05-29 鹏城实验室 Video code rate matching method, storage medium and terminal equipment
CN112312135A (en) * 2020-10-23 2021-02-02 广州市百果园网络科技有限公司 Video publishing method and device, computer equipment and storage medium
WO2021047287A1 (en) * 2019-09-11 2021-03-18 北京达佳互联信息技术有限公司 Video uploading method and apparatus, electronic device, and storage medium
WO2021139173A1 (en) * 2020-01-12 2021-07-15 苏州浪潮智能科技有限公司 Ai video processing method and apparatus
US20210274199A1 (en) * 2012-07-09 2021-09-02 Vid Scale, Inc. Power Aware Video Decoding and Streaming

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10304372A (en) * 1997-04-30 1998-11-13 Sony Corp Image coding method and device, and image transmission method
US20040210930A1 (en) * 2002-07-26 2004-10-21 Sean Cullinan Automatic selection of encoding parameters for transmission of media objects
US20080013628A1 (en) * 2006-07-14 2008-01-17 Microsoft Corporation Computation Scheduling and Allocation for Visual Communication
CN107911716A (en) * 2010-04-14 2018-04-13 爱立信电视公司 Adaptation rate for conveying Video service to service group changes
CN102130949A (en) * 2011-03-10 2011-07-20 肖智刚 User contribution-based method and system for sharing personalized digital resources
US20210274199A1 (en) * 2012-07-09 2021-09-02 Vid Scale, Inc. Power Aware Video Decoding and Streaming
CN105141965A (en) * 2015-08-05 2015-12-09 中央电视台 Coding method and coding device
WO2021047287A1 (en) * 2019-09-11 2021-03-18 北京达佳互联信息技术有限公司 Video uploading method and apparatus, electronic device, and storage medium
CN111212301A (en) * 2020-01-09 2020-05-29 鹏城实验室 Video code rate matching method, storage medium and terminal equipment
WO2021139173A1 (en) * 2020-01-12 2021-07-15 苏州浪潮智能科技有限公司 Ai video processing method and apparatus
CN112312135A (en) * 2020-10-23 2021-02-02 广州市百果园网络科技有限公司 Video publishing method and device, computer equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114697299A (en) * 2022-04-21 2022-07-01 湖南快乐阳光互动娱乐传媒有限公司 Audio and video transcoding priority determination method, system, device and storage medium
CN114697299B (en) * 2022-04-21 2024-05-10 湖南快乐阳光互动娱乐传媒有限公司 Audio and video transcoding priority determining method, system and device and storage medium
CN116737676A (en) * 2023-08-15 2023-09-12 中移(苏州)软件技术有限公司 File storage method, device, electronic equipment and readable storage medium

Also Published As

Publication number Publication date
CN113766230B (en) 2022-04-01

Similar Documents

Publication Publication Date Title
CN113766230B (en) Media file encoding method and device, computer equipment and storage medium
CN111629028B (en) Data transmission scheduling system for distributed multi-cloud storage
US8527610B2 (en) Cache server control device, content distribution system, method of distributing content, and program
CN101842812B (en) System and method for quality-aware selection of parameters in transcoding of digital images
CN110716808B (en) Service processing method, device, computer equipment and storage medium
CN110798502B (en) Grayscale publishing method and device based on micro-service framework and computer equipment
KR20070089155A (en) System and method for providing a web page
CN106375471B (en) Edge node determination method and device
CN110545258B (en) Streaming media server resource allocation method and device and server
CN102802053A (en) Audio and video file transcoding cluster dispatching method and device
EP3624453A1 (en) A transcoding task allocation method, scheduling device and transcoding device
CN114153581A (en) Data processing method, data processing device, computer equipment and storage medium
KR101569502B1 (en) Apparatus, method and computer readable recording medium for assigning trnscording works
Zabrovskiy et al. FSpot: Fast and Efficient Video Encoding Workloads Over Amazon Spot Instances.
CN108737853B (en) Data file code reduction processing method and server
CN113538022A (en) Flow monitoring method, device, equipment and storage medium
CN115086940B (en) QoS adjustment method, system, device and storage medium based on 5G
JP6517342B2 (en) Delivery rate selection device, delivery rate selection method, and program
CN113612841B (en) Task scheduling method, device, computer equipment and storage medium
CN110535853B (en) Video request scheduling method, device, server and storage medium
CN108834087B (en) Short message sending method and device, computer equipment and storage medium
CN110691143B (en) File pushing method and device, electronic equipment and medium
CN112491939B (en) Multimedia resource scheduling method and system
CN108243348A (en) A kind of stream process asks distribution server
KR102108835B1 (en) Method and apparatus for load balancing with prediction and computer-readable recording medium having method for load balancing with prediction

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: Room 402, No. 66, North Street, University Town Center, Panyu District, Guangzhou City, Guangdong Province, 510006

Patentee after: Yifang Information Technology Co.,Ltd.

Address before: 510006 Room 601, 603, 605, science museum, Guangdong University of technology, 100 Waihuan West Road, Xiaoguwei street, Panyu District, Guangzhou City, Guangdong Province

Patentee before: GUANGZHOU EASEFUN INFORMATION TECHNOLOGY Co.,Ltd.