CN112616053B - Transcoding method and device for live video and electronic equipment - Google Patents

Transcoding method and device for live video and electronic equipment Download PDF

Info

Publication number
CN112616053B
CN112616053B CN202011380232.6A CN202011380232A CN112616053B CN 112616053 B CN112616053 B CN 112616053B CN 202011380232 A CN202011380232 A CN 202011380232A CN 112616053 B CN112616053 B CN 112616053B
Authority
CN
China
Prior art keywords
live broadcast
transcoding
broadcast type
media data
streaming media
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.)
Active
Application number
CN202011380232.6A
Other languages
Chinese (zh)
Other versions
CN112616053A (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.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet 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 Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202011380232.6A priority Critical patent/CN112616053B/en
Publication of CN112616053A publication Critical patent/CN112616053A/en
Application granted granted Critical
Publication of CN112616053B publication Critical patent/CN112616053B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/40Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using video transcoding, i.e. partial or full decoding of a coded input stream followed by re-encoding of the decoded output stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/21Server components or server architectures
    • H04N21/218Source of audio or video content, e.g. local disk arrays
    • H04N21/2187Live feed

Abstract

The disclosure relates to a transcoding method and device of live video and electronic equipment, and belongs to the technical field of network live broadcasting. Wherein the method comprises the following steps: acquiring a switched live broadcast type sent by a client; when the switched live broadcast type is different from the current live broadcast type, determining a first transcoding template corresponding to the switched live broadcast type, wherein one or more first code rates are configured in the first transcoding template; and transcoding the original streaming media data according to the first transcoding template to obtain first streaming media data with the first code rate. By the method, the streaming media data can be updated timely, so that the code rate of the streaming media data obtained by re-transcoding can be matched with the switched live broadcast type, and the transmission effect of the subsequent streaming media data is effectively ensured.

Description

Transcoding method and device for live video and electronic equipment
Technical Field
The disclosure relates to the technical field of network live broadcasting, and in particular relates to a transcoding method and device of live video and electronic equipment.
Background
With the rapid development of the live broadcast industry, more and more types of live broadcast scenes are mined, and the live broadcast scenes such as game live broadcast scenes and live broadcast scenes adopting cameras are characterized in that: the live video stream has high code rate, multiple types and large difference, so how to optimize the transmission cost of the video streams of the live scenes is one of important work of a live company.
In the related art, transcoding is generally used to reduce the transmission cost of a video stream, and the transcoding refers to processing streaming media data (such as video shot by a host user in a live broadcast process and sent to a server side) of a host push stream into a plurality of streaming media data with different bit rates through data processing, such as using a special transcoding template.
In this way, if the host user switches the live broadcast type in one live broadcast process, the code rate of the transcoded streaming media data cannot be effectively adapted to the switched live broadcast type, so that the transmission efficiency of the subsequent streaming media data may be affected.
Disclosure of Invention
The disclosure provides a transcoding method, device, electronic equipment, storage medium and computer program product for live video, so as to at least solve the technical problem that if a live broadcast type is switched by a host user in a live broadcast process, the code rate of stream media data obtained by transcoding cannot be effectively adapted to the switched live broadcast type, and therefore the transmission efficiency of the stream media data may be affected. The technical scheme of the present disclosure is as follows:
according to a first aspect of an embodiment of the present disclosure, there is provided a method for transcoding live video, applied to a server, including: acquiring a switched live broadcast type sent by a client; when the switched live broadcast type is different from the current live broadcast type, determining a first transcoding template corresponding to the switched live broadcast type, wherein one or more first code rates are configured in the first transcoding template; and transcoding the original streaming media data according to the first transcoding template to obtain first streaming media data with the code rate of the first code rate.
In some embodiments of the present disclosure, before the acquiring the switched live type sent by the client, the method further includes:
acquiring the current live broadcast type sent by the client;
determining a second transcoding template corresponding to the current live broadcast type, wherein one or more second code rates are configured in the second transcoding template, and the first code rate is different from the second code rate;
and transcoding the original streaming media data according to the second transcoding template to obtain second streaming media data with the code rate of the second code rate.
In some embodiments of the present disclosure, the method further comprises:
and when the original streaming media data is transcoded according to the first transcoding template, the second streaming media data is reserved.
In some embodiments of the present disclosure, the method further comprises:
generating a notification message in response to a transcoding completion instruction, wherein the notification message carries the one or more first code rates;
and sending the notification message to the client of the audience user, thereby triggering the client of the audience user to acquire the first streaming media data again.
In some embodiments of the present disclosure, before the acquiring the switched live type sent by the client, the method further includes:
Determining a plurality of candidate live broadcast types, and determining matching code rates with the candidate live broadcast types;
generating corresponding candidate transcoding templates according to the matching code rates of the candidate live broadcast types;
generating a mapping relation between the candidate live broadcast type and a candidate transcoding template corresponding to the candidate live broadcast type;
the determining a first transcoding template corresponding to the switched live broadcast type comprises:
and determining a candidate live broadcast type matched with the switched live broadcast type from the mapping relation, and taking a candidate transcoding template corresponding to the matched candidate live broadcast type as the first transcoding template.
In some embodiments of the present disclosure, the method further comprises:
acquiring a current time point and a target time point, wherein the target time point is the time of pushing the second streaming media data to the client in the last time;
and deleting the second streaming media data if the duration between the current time point and the target time point is greater than or equal to a set duration threshold.
According to a second aspect of the embodiments of the present disclosure, there is provided a transcoding method of live video, applied to a client, including: determining a switched live broadcast type, wherein the switched live broadcast type is different from the current live broadcast type; generating a request message according to the switched live broadcast type; and sending the request message to a server to trigger the server to transcode the original streaming media data according to a first transcoding template corresponding to the switched live broadcast type.
In some embodiments of the present disclosure, before the determining the live type after the switching, the method further includes:
analyzing the original streaming media data to obtain the current live broadcast type;
and sending the current live broadcast type to the server to trigger the server to transcode the original streaming media data according to a second transcoding template corresponding to the current live broadcast type.
In some embodiments of the present disclosure, the step of determining the live type after the switching includes:
responding to an operation instruction of a host user to a preset interface, and displaying candidate live broadcast types;
and responding to a selection instruction of the anchor user, and taking the candidate live broadcast type selected by the selection instruction as the switched live broadcast type.
In some embodiments of the present disclosure, the step of determining the live type after the switching includes:
responding to a trigger instruction of the anchor user to a preset component of the client;
and determining the live broadcast type matched with the preset component, and taking the matched live broadcast type as the switched live broadcast type.
In some embodiments of the present disclosure, the preset component is a camera component.
According to a third aspect of the embodiments of the present disclosure, there is provided a transcoding device of live video, applied to a server, including: the first acquisition module is configured to acquire the switched live broadcast type sent by the client; the first determining module is configured to determine a first transcoding template corresponding to the switched live broadcast type when the switched live broadcast type is different from the current live broadcast type, wherein one or more first code rates are configured in the first transcoding template; and the transcoding module is configured to transcode the original streaming media data according to the first transcoding template to obtain first streaming media data with the code rate of the first code rate.
In some embodiments of the present disclosure, further comprising:
the first obtaining module is configured to obtain the current live broadcast type sent by the client before obtaining the switched live broadcast type sent by the client;
the first determining module is configured to determine a second transcoding template corresponding to the current live broadcast type, one or more second code rates are configured in the second transcoding template, and the first code rate and the second code rate are different;
And the transcoding module is configured to transcode the original streaming media data according to the second transcoding template to obtain second streaming media data with the code rate of the second code rate.
In some embodiments of the present disclosure, the apparatus further comprises:
and the storage module is configured to retain the second streaming media data when the original streaming media data is transcoded according to the first transcoding template.
In some embodiments of the present disclosure, the apparatus further comprises:
a first generation module configured to generate a notification message in response to a transcoding complete instruction, the notification message carrying the one or more first code rates;
and the first sending module is configured to send the notification message to the client of the audience user, so as to trigger the client of the audience user to acquire the first streaming media data again.
In some embodiments of the present disclosure, the apparatus further comprises:
the second determining module is configured to determine a plurality of candidate live broadcast types before the switched live broadcast types sent by the client are acquired, and determine matching code rates with the candidate live broadcast types;
The second generation module is configured to generate corresponding candidate transcoding templates according to the matching code rates of the candidate live broadcast types, and generate a mapping relation between the candidate live broadcast types and the candidate transcoding templates corresponding to the candidate live broadcast types;
the first determining module is configured to determine a candidate live broadcast type matched with the switched live broadcast type from the mapping relation, and take a candidate transcoding template corresponding to the matched candidate live broadcast type as the first transcoding template.
In some embodiments of the present disclosure, the apparatus further comprises:
the second acquisition module is configured to acquire a current time point and a target time point, wherein the target time point is the time of the last pushing of the second streaming media data to the client;
and the processing module is configured to delete the second streaming media data when the duration between the current time point and the target time point is greater than or equal to a set duration threshold value.
According to a fourth aspect of embodiments of the present disclosure, there is provided a transcoding device of live video, applied to a client, including: the third determining module is configured to determine the switched live broadcast type, wherein the switched live broadcast type is different from the current live broadcast type; the third generation module is configured to generate a request message according to the switched live broadcast type; the second sending module is configured to send the request message to a server to trigger the server to transcode the original streaming media data according to a first transcoding template corresponding to the switched live broadcast type.
In some embodiments of the present disclosure, the apparatus further comprises:
the analyzing module is configured to analyze the original streaming media data to obtain the current live broadcast type before the switched live broadcast type is determined;
the second sending module is configured to send the current live broadcast type to the server to trigger the server to transcode the original streaming media data according to a second transcoding template corresponding to the current live broadcast type.
In some embodiments of the present disclosure, the third determining module is configured to:
responding to an operation instruction of a host user to a preset interface, and displaying candidate live broadcast types;
and responding to a selection instruction of the anchor user, and taking the candidate live broadcast type selected by the selection instruction as the switched live broadcast type.
In some embodiments of the present disclosure, the third determining module is configured to:
responding to a trigger instruction of the anchor user to a preset component of the client;
and determining the live broadcast type matched with the preset component, and taking the matched live broadcast type as the switched live broadcast type.
In some embodiments of the present disclosure, the preset component is a camera component.
According to a fifth aspect of embodiments of the present disclosure, there is provided an electronic device, comprising: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement a method of transcoding live video as previously described.
According to a sixth aspect of embodiments of the present disclosure, there is provided a storage medium, which when executed by a processor of an electronic device, enables the electronic device to perform a method of transcoding live video as previously described.
According to a seventh aspect of embodiments of the present disclosure, there is provided a computer program product, which, when executed by a processor of an electronic device, enables the electronic device to perform a method of transcoding live video as previously described.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects: by acquiring the switched live broadcast type sent by the client, when the switched live broadcast type is different from the current live broadcast type, determining a first transcoding template corresponding to the switched live broadcast type, wherein one or more first code rates are configured in the first transcoding template, and transcoding the original streaming media data according to the first transcoding template to obtain first streaming media data with the first code rate, so that the streaming media data can be updated in time, the code rate of the streaming media data obtained by re-transcoding can be matched with the switched live broadcast type, and the transmission effect of the subsequent streaming media data is effectively ensured.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure and do not constitute an undue limitation on the disclosure.
Fig. 1 is a flowchart illustrating a method of transcoding live video according to an exemplary embodiment.
Fig. 2 is a flowchart illustrating a method of transcoding live video according to another exemplary embodiment.
Fig. 3 is a flowchart illustrating a method of transcoding live video according to yet another exemplary embodiment.
Fig. 4 is a flowchart illustrating a method of transcoding live video according to yet another exemplary embodiment.
Fig. 5 is a block diagram of a transcoding device for live video, according to an exemplary embodiment.
Fig. 6 is a block diagram of a transcoding device of live video, shown according to another exemplary embodiment.
Fig. 7 is a block diagram of an electronic device, according to an example embodiment.
Detailed Description
In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
Fig. 1 is a flowchart illustrating a method of transcoding live video according to an exemplary embodiment.
The present embodiment is exemplified in a transcoding device in which a transcoding method of live video is configured as live video.
The method for transcoding the live video in the embodiment may be configured in a device for transcoding the live video, and the device for transcoding the live video may be set in a server.
The execution body of the embodiment of the present disclosure may be, for example, a central processing unit (Central Processing Unit, CPU) of a server in hardware, or may be, for example, a related background service in a server in software, which is not limited thereto.
As shown in fig. 1, the method for transcoding live video includes the following steps:
in step S101, a switched live broadcast type sent by a client is acquired.
The application scenario in the embodiment of the present disclosure is a scenario in which a user uses a live broadcast application program to perform live video broadcast, that is, in the application scenario, a host user sends a live video stream to a client (sometimes referred to as a user client) on a viewer user side by using a host client (the host client is a client on the host user side), and the user client correspondingly displays the live video stream.
The process that the host broadcasting user adopts the client to send the live video stream to the user client is that the host broadcasting client pushes the live video stream (pushing, which can represent the process that the client uploads the live video stream to the server or the process that the server pushes the live video stream to the client) to the background server, the server correspondingly transcodes the live video stream, and the server can respond to the instruction of the pulling of the user client (pulling, which means the process that the client obtains the live video stream from the server), so as to push the live video stream to the user client.
The execution subject of the embodiments of the present disclosure is the server in the scenario described above, and the description for the anchor client may be referred to the subsequent embodiments.
In the step, in a one-time live broadcast process, if a host user has a requirement of switching live broadcast types, an electronic device to which the host client belongs responds to a switching instruction of the host user to obtain the switched live broadcast types.
In one embodiment, the current live type of the hosting client during the live process may be referred to as the current live type.
Wherein, the live type is used to describe the type of live content, such as education, games, product promotions, etc., or the live type may be used to describe the type of live scene.
For example, assuming that the live content is [ child song order ], the live type may be an educational type; if the live broadcast content is the magic beast world, the live broadcast type can be a game type, and the game type can be further subdivided into the magic beast world type or the anti-terrorism elite type; if the live content is an advertisement, the corresponding live type may be a product promotion type. For example, if the live broadcast content is switched from live broadcast content to live broadcast through a camera (that is, the live broadcast scene is switched), the live broadcast type after the switching can be specifically the type corresponding to the scene after the switching, and the live broadcast type after the switching is, for example, the live broadcast type [ camera ], without limitation.
When the live broadcast type is divided, the live broadcast type can be divided according to the resolution, the frame rate, the color saturation of the picture and the like of the live broadcast video, or the live broadcast type can be divided directly according to the semantics of the live broadcast content, or the live broadcast type can be divided directly according to the live broadcast scene, and the like, so that the live broadcast type is not limited.
It should be noted that the naming of the live broadcast type is not limited to the above description, and other identifiers (text or numerical values) may be used to name different live broadcast types, which is not limited.
Thus, the switched live type or the current live type may be any of the live types in the above examples, and the switched live type and the current live type may be different live types, or may be the same live type.
In the embodiment of the present disclosure, the current live broadcast type may be the game type described above, and the switched live broadcast type is exemplified by the live broadcast type [ camera ], which is not limited thereto.
The embodiment of the disclosure is particularly applied to a one-time live broadcast process, if a host user switches the live broadcast type of the one-time live broadcast process (such as from a type of a 'magic beast world' to a type of a 'camera') and accordingly, the disclosure can timely inform a server to trigger the server to re-transcode original streaming media data according to the switched live broadcast type, so that the streaming media data can be timely updated, the code rate of the streaming media data obtained by re-transcoding can be matched with the switched live broadcast type, and the transmission effect of the subsequent streaming media data can be effectively ensured.
In step S102, when the switched live broadcast type is different from the current live broadcast type, a first transcoding template corresponding to the switched live broadcast type is determined, where one or more first code rates are configured in the first transcoding template.
The transcoding template corresponding to the switched live broadcast type may be referred to as a first transcoding template, where one first code rate may be configured in the first transcoding template, or a plurality of first code rates may also be configured in the first transcoding template, where the code rate configured in the first transcoding template may be referred to as a first code rate.
After transcoding the original stream data using the first transcoding template, the original stream data may be processed into stream data of a first bitrate, and when the first bitrate is one, the original stream data may be processed into one piece of stream data of the first bitrate, and when the first bitrate is multiple, the original stream data may be processed into multiple pieces of stream data of the first bitrate.
The description of the transcoding template may be as follows:
because the parameters of the transcoding operation are many, repeated filling is troublesome when the transcoding operation is submitted each time, the transcoding template is a concept proposed for solving the problem, the nature of the transcoding template is to combine some common parameters together, and the transcoding template comprises various scenes such as video transcoding, audio transcoding, transcoding packaging and the like, for example, "MP 4-high definition", "MP3-128K", and the transcoding template is not limited.
The transcoding templates in the embodiments of the present disclosure encapsulate different code rates, and further encapsulate other transcoding processing logic required for performing transcoding operations, where the code rates configured in the different transcoding templates may be different, and the code rates configured in the different transcoding templates may specifically correspond to one live type, that is, the different transcoding templates may be adapted to the corresponding live type.
For example, if the live broadcast type is a game type, code rates of 5000k, 3000k and 1000k are configured in the transcoding templates corresponding to the game type, so that the original streaming media data can be transcoded into streaming media data corresponding to 5000k, 3000k and 1000k respectively by using the transcoding templates corresponding to the game type.
For example, if the live broadcast type is an education type, code rates of 4000k, 2000k and 800k are configured in the transcoding templates corresponding to the education type, so that the original streaming media data can be transcoded into streaming media data corresponding to 4000k, 2000k and 800k respectively by using the transcoding templates corresponding to the education type.
In some embodiments, before the step of obtaining the switched live broadcast type sent by the client, the current live broadcast type sent by the client is also obtained, a second transcoding template corresponding to the current live broadcast type is determined, one or more second code rates are configured in the second transcoding template, the first code rate is different from the second code rate, and transcoding processing is performed on the original streaming media data according to the second transcoding template, so as to obtain second streaming media data with the second code rate.
The transcoding template corresponding to the current live broadcast type may be referred to as a second transcoding template, and the code rate configured in the second transcoding template may be referred to as a second code rate, where one or more second code rates are configured in the second transcoding template, where the first code rate and the second code rate are different.
That is, in a live broadcast process, the embodiment of the present disclosure first supports the server to transcode the original streaming media data according to the second transcoding template corresponding to the current live broadcast type to obtain streaming media data with the second code rate (where the streaming media data with the second code rate may be referred to as second streaming media data), and in the live broadcast process, if the live broadcast type of the live broadcast process is switched by the main broadcast user (other live broadcast types are switched by the current live broadcast type), the other live broadcast types may be switched live broadcast types.
Accordingly, the embodiment of the application supports the server to re-transcode the original streaming media data according to the first transcoding template corresponding to the switched live broadcast type to obtain the first streaming media data with the first bitrate, thereby realizing timely updating of the streaming media data and enabling the bitrate of the streaming media data obtained by re-transcoding to be matched with the switched live broadcast type.
In step S103, transcoding is performed on the original streaming media data according to the first transcoding template, so as to obtain first streaming media data with a first code rate.
For example, if the current live broadcast type is a game type, the original streaming media data can be transcoded into second streaming media data corresponding to 5000k, 3000k and 1000k respectively by using a second transcoding template corresponding to the game type, then, the live broadcast type of the live broadcast process is switched by the host user, and the switched live broadcast type is an education type, in the embodiment of the application, the original streaming media data can be transcoded into first streaming media data corresponding to 4000k, 2000k and 800k respectively by using a first transcoding template corresponding to the education type, so that updating of the streaming media data is realized, and the code rate of the streaming media data obtained by transcoding can be matched with the switched live broadcast type.
Optionally, in some embodiments, after performing transcoding processing on the original streaming media data according to the first transcoding template to obtain the first streaming media data with the first bitrate, whether the transcoding is completed may be monitored. If the transcoding is completed, a corresponding transcoding completion instruction is generated, the control server responds to the transcoding completion instruction, a notification message is generated, the notification message carries one or more first code rates, and the notification message is sent to the client of the audience user, so that the client of the audience user is triggered to acquire the first streaming media data again.
According to the method and the device for updating the streaming media data, the continuity of the streaming media data updating can be effectively guaranteed, so that the audience user can timely acquire the first code rate most suitable for the current live broadcast type, and the audience user can be assisted to timely acquire the first streaming media data corresponding to the first code rate.
The sending of the notification message to the user client may further support displaying the first code rate on the user client interface, and if the viewer user selects one first code rate from the plurality of first code rates, the first streaming media data corresponding to the first code rate selected by the viewer user may be pushed to the user client to trigger the user client to update the second streaming media data based on the first streaming media data corresponding to the target code rate.
The notification message is, for example, the media information has been modified, so that the audience user in the live broadcast room can be timely notified of the media information has been modified, and thus the audience user in the live broadcast room is assisted to use the first code rate to perform streaming so as to use the first streaming media data to update the second streaming media data.
For example, after transcoding the original streaming media data into the first streaming media data corresponding to 4000k, 2000k, and 800k respectively, and updating the streaming media data, another notification message may be generated according to 4000k, 2000k, and 800k, and a code rate selection control for displaying 4000k, 2000k, and 800k on the user client is triggered based on the another notification message, which indicates that the anchor user has updated the live type, and the first streaming media data corresponding to 4000k, 2000k, and 800k respectively is ready on the server, and then, in response to a selection instruction of the viewer user, the first streaming media data is pulled based on the first code rate (for example, 2000 k) selected by the selection instruction.
Optionally, in some embodiments, considering that some audience users may also use the client to pull a stream from the server based on the current live broadcast type (where the client is used to obtain a live video stream from the server by the audience users, for example), in order to effectively ensure continuity of streaming media data transmission, avoid affecting the streaming experience of the audience users, the foregoing may also retain the second streaming media data when transcoding the original streaming media data according to the first transcoding template.
In other embodiments, in order to save storage resource consumption of the server, improve response efficiency of the server, determine a proper time, so as to trigger deletion of the second streaming media data based on the proper time, for example, a current time point and a target time point may be obtained, where the target time point is a time of last pushing the second streaming media data to the client, and delete the second streaming media data if a duration between the current time point and the target time point is greater than or equal to a set duration threshold.
The set duration threshold is a duration threshold of the second streaming media data which is not pushed, and the duration threshold may be preset by a factory program of the server, or may be adaptively adjusted according to an actual live broadcast application requirement, which is not limited.
The set duration threshold may be obtained by reading a configuration file corresponding to the live broadcast application program stored in the server, for example, and is not limited thereto.
Thus, if the duration between the current time point and the target time point is greater than or equal to the set duration threshold, the server is indicated to not push the second streaming media data to the user client, the second streaming media data can be deleted from the storage space of the server, and if the duration between the current time point and the target time point is less than the set duration threshold, the server is indicated to possibly push the second streaming media data to the user client, and the second streaming media data can be reserved.
In some other embodiments, after the server performs transcoding processing on the original streaming media data according to the first transcoding template to obtain first streaming media data with a first bitrate, the first streaming media data may be stored locally at the server, and the subsequent server may push the first streaming media data to the user client.
In other embodiments, when the first streaming media data with the first code rate is obtained, the first streaming media data may be pushed to the client on the user side of the audience, which is not limited.
In this embodiment, by acquiring the switched live broadcast type sent by the client, when the switched live broadcast type is different from the current live broadcast type, determining a first transcoding template corresponding to the switched live broadcast type, where one or more first code rates are configured in the first transcoding template, and performing transcoding processing on original streaming media data according to the first transcoding template to obtain first streaming media data with the first code rate, so that the streaming media data can be updated in time, so that the code rate of the streaming media data obtained by re-transcoding can be adapted to the switched live broadcast type, and the transmission effect of the subsequent streaming media data is effectively ensured.
Fig. 2 is a flowchart illustrating a method of transcoding live video according to another exemplary embodiment.
The method for transcoding the live video in the embodiment may be configured in a device for transcoding the live video, and the device for transcoding the live video may be set in a server.
The execution body of the embodiment of the present disclosure may be, for example, a central processing unit (Central Processing Unit, CPU) of a server in hardware, or may be, for example, a related background service in a server in software, which is not limited thereto.
As shown in fig. 2, the transcoding method of the live video includes the following steps:
in step S201, a plurality of candidate live broadcast types are determined, and a matching code rate with the various candidate live broadcast types is determined.
The execution timing of the embodiment may be before the switched live broadcast type sent by the client is acquired, which is not limited.
The method comprises the steps of dividing the live video into a plurality of candidate live broadcast types according to the resolution ratio, the frame rate, the picture color degree requirement and the like of the live video in advance, or dividing the live video into a plurality of candidate live broadcast types according to live broadcast scenes directly, and determining the matching code rate with the candidate live broadcast types. The matching code rate is a code rate based on optimal transcoding of original streaming media data live broadcast under the corresponding candidate live broadcast type, that is, after the original streaming media data of the corresponding candidate live broadcast type is transcoded by adopting the matching code rate, the presentation effect of the original streaming media data can be ensured as much as possible under the condition of reducing the transmission code rate.
In step S202, corresponding candidate transcoding templates are generated according to the matching code rates with the various candidate live broadcast types.
After determining multiple candidate live broadcast types and determining the matching code rates with the various candidate live broadcast types, generating corresponding candidate transcoding templates according to the matching code rates with the various candidate live broadcast types.
That is, the embodiment realizes that candidate transcoding templates corresponding to various candidate live broadcast types are generated in advance at the server side, so that the first transcoding template can be rapidly determined in the actual live broadcast process.
And then, forming a corresponding candidate transcoding template according to the transcoding processing logic, so that the candidate transcoding template comprises corresponding transcoding processing logic.
In step S203, a mapping relationship between the candidate live broadcast type and the candidate transcoding template corresponding to the candidate live broadcast type is generated.
After the candidate transcoding templates corresponding to the various candidate live broadcast types are generated, the candidate live broadcast types and the mapping relation between the candidate transcoding templates corresponding to the candidate live broadcast types can be generated, the mapping relation is stored in the memory of the server, the candidate live broadcast types matched with the switched live broadcast types can be determined by the subsequent server according to the mapping relation, the candidate transcoding templates corresponding to the matched candidate live broadcast types are used as first transcoding templates, the acquisition efficiency of the first transcoding templates is improved, and the candidate transcoding templates corresponding to each candidate live broadcast type are obtained by pre-configuration learning, so that the transcoding accuracy can be effectively ensured, the updating efficiency of streaming media data is improved, and seamless updating and migration are realized.
In step S204, the switched live broadcast type sent by the client is obtained.
The step S204 may be illustrated by the above embodiments, and will not be described herein.
In step S205, a candidate live broadcast type matching the switched live broadcast type is determined from the mapping relation, and a candidate transcoding template corresponding to the matched candidate live broadcast type is used as a first transcoding template.
In step S206, the original streaming media data is transcoded according to the first transcoding template, so as to obtain first streaming media data with a first bitrate.
The step S206 may be illustrated by the above embodiments, and will not be described herein.
In this embodiment, the server side can determine candidate live broadcast types matched with the switched live broadcast types according to the mapping relationship, and uses a candidate transcoding template corresponding to the matched candidate live broadcast types as a first transcoding template, so that the acquisition efficiency of the first transcoding template is improved, and the candidate transcoding template corresponding to each candidate live broadcast type is obtained by pre-configuring and learning, so that the transcoding accuracy can be effectively ensured, the updating efficiency of the streaming media data is improved, and seamless updating and migration are realized.
Fig. 3 is a flowchart illustrating a method of transcoding live video according to yet another exemplary embodiment.
In this embodiment, taking an example that the live video transcoding device is configured in an electronic device, the electronic device may be a hardware device with various operating systems and imaging devices, such as a mobile phone, a tablet computer, a personal digital assistant, and a wearable device.
The execution body of the present embodiment may be, for example, a central processing unit (Central Processing Unit, CPU) in the electronic device in hardware, or a related background service in the electronic device in software, which is not limited thereto.
The execution body of the embodiment may specifically be, for example, a Client of a live broadcast application program running on an electronic device, where the Client (Client) or referred to as a Client refers to a program corresponding to a server, and provides a local service for a user, which is not limited.
The execution body of the embodiment may specifically be, for example, a client of an application program on the anchor user side.
As shown in fig. 3, the transcoding method of the live video includes the following steps:
In step S301, the switched live broadcast type is determined, and the switched live broadcast type is different from the current live broadcast type.
The application scenario in this embodiment is an application scenario in which a user uses a live broadcast application program to perform live broadcast, that is, in the application scenario, a host user sends a live broadcast video stream to a user client by using a client, and the user client displays the live broadcast video stream.
When a live broadcast user adopts a client to send a live broadcast video stream to the user client, the live broadcast video stream is pushed to a server by the live broadcast client, and the server correspondingly carries out transcoding processing on the live broadcast video stream. The server side can also respond to a streaming instruction at the user side of the audience to push the live video stream to the user client side.
The execution body of the embodiment is the anchor client in the above-described scenario, and the description of the server may refer to the above-described embodiment, which is not repeated herein.
In the step, the client is a main broadcasting client, and if the main broadcasting user has the requirement of switching the live broadcasting type in one live broadcasting process, the electronic equipment to which the main broadcasting client belongs can respond to the switching instruction of the main broadcasting user to obtain the switched live broadcasting type.
Wherein, the live type is used to describe the type of live content, such as education, games, product promotions, etc., or the live type may be used to describe the type of live scene.
For example, assuming that the live content is [ child song order ], the live type may be an educational type; if the live broadcast content is the magic beast world, the live broadcast type can be a game type, and the game type can be further subdivided into the magic beast world type or the anti-terrorism elite type; if the live content is an advertisement, the corresponding live type may be a product promotion type. For example, if the live broadcast content is switched from live broadcast content to live broadcast through a camera (that is, the live broadcast scene is switched), the live broadcast type after the switching can be specifically the type corresponding to the scene after the switching, and the live broadcast type after the switching is, for example, the live broadcast type [ camera ], without limitation.
When the live broadcast type is divided, the live broadcast type can be divided according to the resolution, the frame rate, the color saturation of the picture and the like of the live broadcast video, or the live broadcast type can be divided directly according to the semantics of the live broadcast content, or the live broadcast type can be divided directly according to the live broadcast scene, and the like, so that the live broadcast type is not limited.
It should be noted that the naming of the live broadcast type is not limited to the above description, and other identifiers (text or numerical values) may be used to name different live broadcast types, which is not limited.
Thus, the live broadcast type after switching or the current live broadcast type may be any one of the live broadcast types in the above examples, and the live broadcast type after switching and the current live broadcast type may be different live broadcast types, or may also be the same live broadcast type.
The embodiment of the disclosure is particularly applied to a one-time live broadcast process, if a host user switches the live broadcast type of the one-time live broadcast process (such as from a game type to a [ camera ] live broadcast type), accordingly, the embodiment of the disclosure can timely inform the server to trigger the server to re-transcode original streaming media data according to the switched live broadcast type, so that the streaming media data can be timely updated, and the code rate of the streaming media data obtained by re-transcoding can be matched with the switched live broadcast type, thereby effectively guaranteeing the transmission effect of subsequent streaming media data.
Before the step of determining the switched live broadcast type, the current live broadcast type may be further sent to the server to trigger the server to transcode the original streaming media data according to the current live broadcast type.
That is, in a live broadcast process, the embodiment of the present disclosure first supports the server to transcode original streaming media data according to the second transcoding template corresponding to the current live broadcast type, and in the live broadcast process, if the live broadcast type of the live broadcast process is switched by the main broadcast user (for example, the live broadcast type is switched to the live broadcast type by the game type [ camera ]), the server is correspondingly triggered to transcode the original streaming media data again according to the first transcoding template corresponding to the switched live broadcast type, so as to obtain the first streaming media data corresponding to the first code rate, so that the streaming media data can be updated in time, and the code rate of the streaming media data obtained by re-transcoding can be adapted to the switched live broadcast type, thereby effectively guaranteeing the transmission effect of the subsequent streaming media data.
In some embodiments, the method may determine the live broadcast type after switching at the anchor client, for example, a preset interface may be provided (the preset interface may be a switching control), so as to monitor, in real time, in the live broadcast process, whether an operation instruction of the anchor user for the preset interface is received, and if the operation instruction of the anchor user for the preset interface is monitored to be received, display candidate live broadcast types (the number of the candidate live broadcast types may be multiple) on the live broadcast interface of the client, so as to receive a selection instruction of the anchor user. In response to a selection instruction of a host user, the candidate live broadcast type selected by the selection instruction is used as the switched live broadcast type, so that the method is simple and convenient to implement, convenient to operate, and capable of not affecting the live broadcast experience of the host user, guaranteeing the continuity of the live broadcast process, and effectively assisting the server side in timely updating streaming media data.
In other embodiments, in order to effectively improve the implementation flexibility of the transcoding method of the live video, the implementation of the transcoding method of the live video is effectively adapted to the switching requirements of different live scenes, the live experience degree of a host user is improved, and the triggering instruction of the host user on a preset component of a client can also be responded; and determining the live broadcast type matched with the preset component, and taking the matched live broadcast type as the switched live broadcast type.
The preset component is a camera component, or may be other components, such as a microphone component, etc., which is not limited thereto.
That is, if the current live broadcast type is a game type and then it is monitored that the host user starts the camera component of the electronic device to which the client belongs, the host user is indicated to have a requirement of switching live broadcast scenes at the moment, the game live broadcast scenes are switched to video live broadcast scenes, at the moment, the switched live broadcast type can be determined to be the video live broadcast type, and accordingly, the switched live broadcast type is determined to be the video live broadcast type, so that the subsequent steps are triggered to be executed.
In step S302, a request message is generated according to the switched live broadcast type.
In step S303, a request message is sent to the server to trigger the server to transcode the original streaming media data according to the first transcoding template corresponding to the switched live broadcast type.
In this embodiment, by determining the switched live broadcast type, the switched live broadcast type is different from the current live broadcast type, generating a request message according to the switched live broadcast type, and sending the request message to the server to trigger the server to transcode the original streaming media data according to the first transcoding template corresponding to the switched live broadcast type, the server can be timely notified when the live broadcast type is switched, and the server is triggered to transcode the original streaming media data again according to the switched live broadcast type, so that the server can timely update the streaming media data, and the code rate of the streaming media data obtained by re-transcoding can be matched with the switched live broadcast type, thereby effectively guaranteeing the transmission effect of the subsequent streaming media data.
Fig. 4 is a flowchart illustrating a method of transcoding live video according to yet another exemplary embodiment.
The embodiment shows the interaction processing logic of the anchor client and the server in the live interaction process.
As shown in fig. 4, the transcoding method of the live video includes the following steps:
in step S401, the anchor client determines a switched live broadcast type, where the switched live broadcast type is different from the current live broadcast type.
In step S402, the anchor client generates a request message according to the switched live broadcast type.
In step S403, the anchor client sends a request message to the server to trigger the server to transcode the original streaming media data according to the first transcoding template corresponding to the switched live broadcast type.
In step S404, the server acquires the switched live broadcast type sent by the client.
In step S405, when the switched live broadcast type is different from the current live broadcast type, the server determines a first transcoding template corresponding to the switched live broadcast type, where one or more first code rates are configured in the first transcoding template.
In step S406, the server performs transcoding processing on the original streaming media data according to the first transcoding template, so as to obtain first streaming media data with a first code rate.
In step S407, the server side generates a notification message in response to the transcoding complete instruction, where the notification message carries one or more first code rates.
In step S408, the server sends a notification message to the user client, thereby triggering the user client to reacquire the first streaming media data.
The steps S401 to S408 may be exemplified by the above embodiments, and are not described herein.
Fig. 5 is a block diagram of a transcoding device for live video, according to an exemplary embodiment.
The method is applied to the server.
As shown in fig. 5, the transcoding device 50 of the live video includes:
a first obtaining module 501 configured to obtain a switched live broadcast type sent by a client;
a first determining module 502, configured to determine a first transcoding template corresponding to the switched live broadcast type when the switched live broadcast type is different from the current live broadcast type, where one or more first code rates are configured in the first transcoding template;
the transcoding module 503 is configured to transcode the original streaming media data according to the first transcoding template, so as to obtain first streaming media data with a first code rate.
In some embodiments of the present disclosure, further comprising:
a first obtaining module 501, configured to obtain a current live broadcast type sent by a client before obtaining a switched live broadcast type sent by the client;
A first determining module 502, configured to determine a second transcoding template corresponding to the current live broadcast type, where one or more second code rates are configured in the second transcoding template, where the first code rate and the second code rate are different;
the transcoding module 503 is configured to transcode the original streaming media data according to the second transcoding template, so as to obtain second streaming media data with a second bitrate.
In some embodiments of the present disclosure, the apparatus further comprises:
the storage module is configured to retain the second streaming media data when transcoding the original streaming media data according to the first transcoding template.
In some embodiments of the present disclosure, the apparatus further comprises:
the first generation module is configured to respond to the transcoding completion instruction and generate a notification message, wherein the notification message carries one or more first code rates;
and the first sending module is configured to send the notification message to the client of the audience user, so as to trigger the client of the audience user to acquire the first streaming media data again.
In some embodiments of the present disclosure, the apparatus further comprises:
the second determining module is configured to determine a plurality of candidate live broadcast types before acquiring the switched live broadcast types sent by the client, and determine matching code rates with the candidate live broadcast types;
The second generation module is configured to generate corresponding candidate transcoding templates according to the matching code rates of the candidate live broadcast types, and generate mapping relations between the candidate live broadcast types and the candidate transcoding templates corresponding to the candidate live broadcast types;
the first determining module 502 is configured to determine a candidate live broadcast type matching the switched live broadcast type from the mapping relation, and take a candidate transcoding template corresponding to the matched candidate live broadcast type as a first transcoding template.
In some embodiments of the present disclosure, the apparatus further comprises:
the second acquisition module is configured to acquire a current time point and a target time point, wherein the target time point is the time of pushing second streaming media data to the client last time;
and the processing module is configured to delete the second streaming media data when the duration between the current time point and the target time point is greater than or equal to a set duration threshold value.
The specific manner in which the respective modules perform the operations in the apparatus for transcoding live video in the above embodiment has been described in detail in the embodiment regarding the method for transcoding live video, and will not be described in detail here.
In this embodiment, by acquiring the switched live broadcast type sent by the client, when the switched live broadcast type is different from the current live broadcast type, determining a first transcoding template corresponding to the switched live broadcast type, where one or more first code rates are configured in the first transcoding template, and performing transcoding processing on original streaming media data according to the first transcoding template to obtain first streaming media data with the first code rate, so that the streaming media data can be updated in time, so that the code rate of the streaming media data obtained by re-transcoding can be adapted to the switched live broadcast type, and the transmission effect of the subsequent streaming media data is effectively ensured.
Fig. 6 is a block diagram of a transcoding device of live video, shown according to another exemplary embodiment.
Is applied to the client.
As shown in fig. 6, the transcoding device 60 of the live video includes:
a third determining module 601, configured to determine a switched live broadcast type, where the switched live broadcast type is different from the current live broadcast type;
a third generating module 602 configured to generate a request message according to the switched live broadcast type;
the second sending module 603 is configured to send a request message to the server, so as to trigger the server to transcode the original streaming media data according to the first transcoding template corresponding to the switched live broadcast type.
In some embodiments of the present disclosure, the apparatus further comprises:
the analyzing module is configured to analyze the original streaming media data to obtain the current live broadcast type before determining the switched live broadcast type;
the second sending module 603 is configured to send the current live broadcast type to the server, so as to trigger the server to transcode the original streaming media data according to a second transcoding template corresponding to the current live broadcast type.
In some embodiments of the present disclosure, the third determining module 601 is configured to:
Responding to an operation instruction of a host user to a preset interface, and displaying candidate live broadcast types;
and responding to a selection instruction of the anchor user, and taking the candidate live broadcast type selected by the selection instruction as the switched live broadcast type.
In some embodiments of the present disclosure, the third determining module 601 is configured to:
responding to a trigger instruction of a host user to a preset component of a client;
and determining the live broadcast type matched with the preset component, and taking the matched live broadcast type as the switched live broadcast type.
In some embodiments of the present disclosure, the preset component is a camera component.
The specific manner in which the respective modules perform the operations in the apparatus for transcoding live video in the above embodiment has been described in detail in the embodiment regarding the method for transcoding live video, and will not be described in detail here.
In this embodiment, by determining the switched live broadcast type, the switched live broadcast type is different from the current live broadcast type, generating a request message according to the switched live broadcast type, and sending the request message to the server to trigger the server to transcode the original streaming media data according to the first transcoding template corresponding to the switched live broadcast type, the server can be timely notified when the live broadcast type is switched, and the server is triggered to transcode the original streaming media data again according to the switched live broadcast type, so that the server can timely update the streaming media data, and the code rate of the streaming media data obtained by re-transcoding can be matched with the switched live broadcast type, thereby effectively guaranteeing the transmission effect of the subsequent streaming media data.
The disclosed embodiments also provide an electronic device, and fig. 7 is a block diagram of an electronic device, which is shown according to an exemplary embodiment. For example, the electronic device 700 may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, exercise device, personal digital assistant, or the like.
Referring to fig. 7, an electronic device 700 may include one or more of the following components: a processing component 702, a memory 704, a power component 706, a multimedia component 708, an audio component 710, an input/output (I/O) interface 712, a sensor component 714, and a communication component 716.
The processing component 702 generally controls overall operation of the electronic device 700, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 702 may include one or more processors 720 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 702 can include one or more modules that facilitate interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate interaction between the multimedia component 708 and the processing component 702.
The memory 704 is configured to store various types of data to support operations at the electronic device 700. Examples of such data include instructions for any application or method operating on the electronic device 700, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 704 may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The power supply component 706 provides power to the various components of the electronic device 700. Power supply components 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for electronic device 700.
The multimedia component 708 includes a touch-sensitive display screen that provides an output interface between the electronic device 700 and a user. In some embodiments, the touch display screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or sliding action, but also the duration and pressure associated with the touch or sliding operation. In some embodiments, the multimedia component 708 includes a front-facing camera and/or a rear-facing camera. When the electronic device 700 is in an operational mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 710 is configured to output and/or input audio signals. For example, the audio component 710 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 700 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 704 or transmitted via the communication component 716.
In some embodiments, the audio component 710 further includes a speaker for outputting audio signals.
The I/O interface 712 provides an interface between the processing component 702 and peripheral interface modules, which may be a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 714 includes one or more sensors for providing status assessment of various aspects of the electronic device 700. For example, the sensor assembly 714 may detect an on/off state of the electronic device 700, a relative positioning of the components, such as a display and keypad of the electronic device 700, the sensor assembly 714 may also detect a change in position of the electronic device 700 or a component of the electronic device 700, the presence or absence of a user's contact with the electronic device 700, an orientation or acceleration/deceleration of the electronic device 700, and a change in temperature of the electronic device 700. The sensor assembly 714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 714 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 714 may also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 716 is configured to facilitate communication between the electronic device 700 and other devices, either wired or wireless. The electronic device 700 may access a wireless network based on a communication standard, such as WiFi,2G, or 3G, or a combination thereof. In one exemplary embodiment, the communication component 716 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication component 716 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 700 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements for performing the method of transcoding live video described above.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 704, including instructions executable by processor 720 of electronic device 700 to perform the above-described method. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
A non-transitory computer readable storage medium, which when executed by a processor of an electronic device 700, enables the electronic device 700 to perform a method of transcoding live video.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any adaptations, uses, or adaptations of the disclosure following the general principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (18)

1. A method for transcoding live video, applied to a server, the method comprising:
acquiring a switched live broadcast type sent by a client;
When the switched live broadcast type is different from the current live broadcast type, determining a first transcoding template corresponding to the switched live broadcast type, wherein one or more first code rates and transcoding processing logic required by other transcoding execution operations are configured in the first transcoding template;
transcoding the original streaming media data according to the first transcoding template to obtain first streaming media data with the code rate of the first code rate;
before the acquiring the switched live broadcast type sent by the client, the method further comprises the following steps:
acquiring the current live broadcast type sent by the client;
determining a second transcoding template corresponding to the current live broadcast type, wherein one or more second code rates are configured in the second transcoding template, and the first code rate is different from the second code rate;
transcoding the original streaming media data according to the second transcoding template to obtain second streaming media data with the code rate of the second code rate;
the method further comprises the steps of:
when the original streaming media data is transcoded according to the first transcoding template, the second streaming media data is reserved;
Acquiring a current time point and a target time point, wherein the target time point is the time of pushing the second streaming media data to the client in the last time;
and deleting the second streaming media data if the duration between the current time point and the target time point is greater than or equal to a set duration threshold.
2. The method according to claim 1, wherein the method further comprises:
generating a notification message in response to a transcoding completion instruction, wherein the notification message carries the one or more first code rates;
and sending the notification message to the client of the audience user, thereby triggering the client of the audience user to acquire the first streaming media data again.
3. The method of claim 1, wherein prior to the acquiring the switched live type sent by the client, the method further comprises:
determining a plurality of candidate live broadcast types, and determining matching code rates with the candidate live broadcast types;
generating corresponding candidate transcoding templates according to the matching code rates of the candidate live broadcast types;
generating a mapping relation between the candidate live broadcast type and a candidate transcoding template corresponding to the candidate live broadcast type;
The determining a first transcoding template corresponding to the switched live broadcast type comprises:
and determining a candidate live broadcast type matched with the switched live broadcast type from the mapping relation, and taking a candidate transcoding template corresponding to the matched candidate live broadcast type as the first transcoding template.
4. A method for transcoding live video, applied to a client, the method comprising:
determining a switched live broadcast type, wherein the switched live broadcast type is different from the current live broadcast type;
generating a request message according to the switched live broadcast type;
the request message is sent to a server to trigger the server to transcode original streaming media data according to a first transcoding template corresponding to the switched live broadcast type, wherein one or more first code rates and transcoding processing logic required by other transcoding execution operations are configured in the first transcoding template;
wherein, the server is further configured to:
acquiring the current live broadcast type sent by the client;
determining a second transcoding template corresponding to the current live broadcast type, wherein one or more second code rates are configured in the second transcoding template, and the first code rate is different from the second code rate;
Transcoding the original streaming media data according to the second transcoding template to obtain second streaming media data with the code rate of the second code rate;
the server side reserves the second streaming media data when transcoding the original streaming media data according to a first transcoding template corresponding to the switched live broadcast type;
acquiring a current time point and a target time point, wherein the target time point is the time of pushing the second streaming media data to the client in the last time;
and deleting the second streaming media data if the duration between the current time point and the target time point is greater than or equal to a set duration threshold.
5. The method of claim 4, further comprising, prior to said determining the post-switch live type:
analyzing the original streaming media data to obtain the current live broadcast type;
and sending the current live broadcast type to the server to trigger the server to transcode the original streaming media data according to a second transcoding template corresponding to the current live broadcast type.
6. The method of claim 4, wherein the step of determining the type of live after the switch comprises:
Responding to an operation instruction of a host user to a preset interface, and displaying candidate live broadcast types;
and responding to a selection instruction of the anchor user, and taking the candidate live broadcast type selected by the selection instruction as the switched live broadcast type.
7. The method of claim 4, wherein the step of determining the type of live after the switch comprises:
responding to a trigger instruction of a host user to a preset component of the client;
and determining the live broadcast type matched with the preset component, and taking the matched live broadcast type as the switched live broadcast type.
8. The method of claim 7, wherein the preset component is a camera component.
9. A transcoding device for live video, applied to a server, the device comprising:
the first acquisition module is configured to acquire the switched live broadcast type sent by the client;
the first determining module is configured to determine a first transcoding template corresponding to the switched live broadcast type when the switched live broadcast type is different from the current live broadcast type, wherein one or more first code rates and transcoding processing logic required by other transcoding execution operations are configured in the first transcoding template;
The transcoding module is configured to transcode the original streaming media data according to the first transcoding template to obtain first streaming media data with the code rate of the first code rate;
the first obtaining module is configured to obtain the current live broadcast type sent by the client before obtaining the switched live broadcast type sent by the client;
the first determining module is configured to determine a second transcoding template corresponding to the current live broadcast type, one or more second code rates are configured in the second transcoding template, and the first code rate and the second code rate are different;
the transcoding module is configured to transcode the original streaming media data according to the second transcoding template to obtain second streaming media data with a code rate of the second code rate;
the storage module is configured to retain the second streaming media data when the original streaming media data is transcoded according to the first transcoding template;
the second acquisition module is configured to acquire a current time point and a target time point, wherein the target time point is the time of the last pushing of the second streaming media data to the client;
And the processing module is configured to delete the second streaming media data when the duration between the current time point and the target time point is greater than or equal to a set duration threshold value.
10. The apparatus of claim 9, wherein the apparatus further comprises:
a first generation module configured to generate a notification message in response to a transcoding complete instruction, the notification message carrying the one or more first code rates;
and the first sending module is configured to send the notification message to the client of the audience user, so as to trigger the client of the audience user to acquire the first streaming media data again.
11. The apparatus of claim 9, wherein the apparatus further comprises:
the second determining module is configured to determine a plurality of candidate live broadcast types before the switched live broadcast types sent by the client are acquired, and determine matching code rates with the candidate live broadcast types;
the second generation module is configured to generate corresponding candidate transcoding templates according to the matching code rates of the candidate live broadcast types, and generate a mapping relation between the candidate live broadcast types and the candidate transcoding templates corresponding to the candidate live broadcast types;
The first determining module is configured to determine a candidate live broadcast type matched with the switched live broadcast type from the mapping relation, and take a candidate transcoding template corresponding to the matched candidate live broadcast type as the first transcoding template.
12. A transcoding device for live video, for application to a client, the device comprising:
the third determining module is configured to determine the switched live broadcast type, wherein the switched live broadcast type is different from the current live broadcast type;
the third generation module is configured to generate a request message according to the switched live broadcast type;
the second sending module is configured to send the request message to a server to trigger the server to transcode the original streaming media data according to a first transcoding template corresponding to the switched live broadcast type, wherein one or more first code rates and transcoding processing logic required by other transcoding execution operations are configured in the first transcoding template;
wherein, the server is further configured to:
acquiring the current live broadcast type sent by the client;
determining a second transcoding template corresponding to the current live broadcast type, wherein one or more second code rates are configured in the second transcoding template, and the first code rate is different from the second code rate;
Transcoding the original streaming media data according to the second transcoding template to obtain second streaming media data with the code rate of the second code rate;
the server side reserves the second streaming media data when transcoding the original streaming media data according to a first transcoding template corresponding to the switched live broadcast type;
acquiring a current time point and a target time point, wherein the target time point is the time of pushing the second streaming media data to the client in the last time;
and deleting the second streaming media data if the duration between the current time point and the target time point is greater than or equal to a set duration threshold.
13. The apparatus of claim 12, wherein the apparatus further comprises:
the analyzing module is configured to analyze the original streaming media data to obtain the current live broadcast type before the switched live broadcast type is determined;
the second sending module is configured to send the current live broadcast type to the server to trigger the server to transcode the original streaming media data according to a second transcoding template corresponding to the current live broadcast type.
14. The apparatus of claim 12, wherein the third determination module is configured to:
responding to an operation instruction of a host user to a preset interface, and displaying candidate live broadcast types;
and responding to a selection instruction of the anchor user, and taking the candidate live broadcast type selected by the selection instruction as the switched live broadcast type.
15. The apparatus of claim 12, wherein the third determination module is configured to:
responding to a trigger instruction of a host user to a preset component of the client;
and determining the live broadcast type matched with the preset component, and taking the matched live broadcast type as the switched live broadcast type.
16. The apparatus of claim 15, wherein the preset assembly is a camera assembly.
17. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method of transcoding live video as claimed in any of claims 1 to 3 or to implement the method of transcoding live video as claimed in any of claims 4 to 8.
18. A storage medium, which when executed by a processor of an electronic device, enables the electronic device to perform the method of transcoding live video as claimed in any one of claims 1 to 3, or the method of transcoding live video as claimed in any one of claims 4 to 8.
CN202011380232.6A 2020-11-30 2020-11-30 Transcoding method and device for live video and electronic equipment Active CN112616053B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011380232.6A CN112616053B (en) 2020-11-30 2020-11-30 Transcoding method and device for live video and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011380232.6A CN112616053B (en) 2020-11-30 2020-11-30 Transcoding method and device for live video and electronic equipment

Publications (2)

Publication Number Publication Date
CN112616053A CN112616053A (en) 2021-04-06
CN112616053B true CN112616053B (en) 2023-09-05

Family

ID=75229781

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011380232.6A Active CN112616053B (en) 2020-11-30 2020-11-30 Transcoding method and device for live video and electronic equipment

Country Status (1)

Country Link
CN (1) CN112616053B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113852843B (en) * 2021-08-26 2024-03-22 北京乐我无限科技有限责任公司 Content synchronization method, device, electronic equipment and storage medium
CN114979714B (en) * 2022-07-29 2022-11-01 中关村科学城城市大脑股份有限公司 Video transcoding playing method and device, electronic equipment and computer readable medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105338372A (en) * 2015-10-30 2016-02-17 中山大学 Adaptive video stream transcoding method applied to game live broadcast platform
WO2017101369A1 (en) * 2015-12-14 2017-06-22 乐视控股(北京)有限公司 Live video transcoding method and apparatus
CN110913245A (en) * 2019-11-08 2020-03-24 网宿科技股份有限公司 Method and device for controlling video transcoding code rate
CN111107386A (en) * 2019-12-27 2020-05-05 北京达佳互联信息技术有限公司 Live video playback method and device, electronic equipment, system and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105338372A (en) * 2015-10-30 2016-02-17 中山大学 Adaptive video stream transcoding method applied to game live broadcast platform
WO2017101369A1 (en) * 2015-12-14 2017-06-22 乐视控股(北京)有限公司 Live video transcoding method and apparatus
CN110913245A (en) * 2019-11-08 2020-03-24 网宿科技股份有限公司 Method and device for controlling video transcoding code rate
CN111107386A (en) * 2019-12-27 2020-05-05 北京达佳互联信息技术有限公司 Live video playback method and device, electronic equipment, system and storage medium

Also Published As

Publication number Publication date
CN112616053A (en) 2021-04-06

Similar Documents

Publication Publication Date Title
CN109274510B (en) Message processing method, device, client, server and storage medium
CN109451341B (en) Video playing method, video playing device, electronic equipment and storage medium
CN113365153B (en) Data sharing method and device, storage medium and electronic equipment
US20210389856A1 (en) Method and electronic device for displaying interactive content
CN110737415A (en) Screen sharing method and device, computer equipment and storage medium
CN112616053B (en) Transcoding method and device for live video and electronic equipment
CN114025180A (en) Game operation synchronization system, method, device, equipment and storage medium
CN105763552B (en) Transmission method, device and system in remote control
CN111182328B (en) Video editing method, device, server, terminal and storage medium
CN107272896B (en) Method and device for switching between VR mode and non-VR mode
CN112291631A (en) Information acquisition method, device, terminal and storage medium
CN113596175A (en) Scene synchronization method, terminal, server and system
US20220159336A1 (en) Method and system for displaying screen
CN105227426B (en) Application interface switching method and device and terminal equipment
CN107247794B (en) Topic guiding method in live broadcast, live broadcast device and terminal equipment
CN110913276B (en) Data processing method, device, server, terminal and storage medium
CN109787890B (en) Instant messaging method, device and storage medium
CN109245992B (en) Request processing method and device, electronic equipment and storage medium
CN107885464B (en) Data storage method, device and computer readable storage medium
CN110908814A (en) Message processing method and device, electronic equipment and storage medium
CN114268802B (en) Virtual space display method and device, electronic equipment and storage medium
CN109981729B (en) File processing method and device, electronic equipment and computer readable storage medium
CN114272600A (en) Control right switching system, method, device, equipment and storage medium
CN111049732B (en) Push message display method and device, electronic equipment and medium
CN110213531B (en) Monitoring video processing method and device

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