CN109672887B - Video coding method and device - Google Patents
Video coding method and device Download PDFInfo
- Publication number
- CN109672887B CN109672887B CN201910168460.8A CN201910168460A CN109672887B CN 109672887 B CN109672887 B CN 109672887B CN 201910168460 A CN201910168460 A CN 201910168460A CN 109672887 B CN109672887 B CN 109672887B
- Authority
- CN
- China
- Prior art keywords
- video
- coded
- coding
- stage
- code rate
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 43
- 238000004891 communication Methods 0.000 claims description 14
- 238000004590 computer program Methods 0.000 claims description 7
- 230000008569 process Effects 0.000 description 10
- 230000000875 corresponding effect Effects 0.000 description 6
- 230000003247 decreasing effect Effects 0.000 description 6
- 230000011218 segmentation Effects 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000002596 correlated effect Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000013500 data storage Methods 0.000 description 1
- 230000007423 decrease Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000009331 sowing Methods 0.000 description 1
- 230000007704 transition Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/44—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
- H04N21/4402—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
- H04N21/440218—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display by transcoding between formats or standards, e.g. from MPEG-2 to MPEG-4
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/134—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
- H04N19/146—Data rate or code amount at the encoder output
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
The embodiment of the invention provides a video coding method and a video coding device, wherein the method comprises the following steps: acquiring a video to be coded, wherein the video to be coded comprises a video in a broadcast starting stage and a video in a non-broadcast starting stage; coding the video in the broadcast starting stage according to a preset low code rate to obtain a coded video in the broadcast starting stage; and coding the video in the non-start-up stage according to a preset normal code rate to obtain the coded video in the non-start-up stage. Compared with the prior art, the video quality requirement of the user in the starting playing stage is low, the video in the starting playing stage is encoded at the preset low bit rate, the video quality in the starting playing stage is reduced, and the video in the non-starting playing stage is encoded according to the normal bit rate, so that the starting playing speed of the user watching the encoded video to be encoded is high.
Description
Technical Field
The present invention relates to the field of coding technologies, and in particular, to a video coding method and apparatus.
Background
The development of network technology brings many conveniences to users, and users can apply the network technology in various aspects of life. Illustratively, when a user watches an online video by using an application program on a network, the online video is expected to have a higher start-up speed, and the online video can be played quickly under the condition of the higher start-up speed. In the prior art, by encoding an online video, the code rate of the online video is reduced, and the play starting speed of the online video is improved, generally, the process of encoding the online video in the prior art is as follows:
before the online video is sent to the user, according to the watching requirement of the user, an RF (Rate Factor) in a CRF (constant Rate Factor) coding mode is set to code the online video, and the coded online video is sent to the user. The RF range is [0, 51], the higher the value of the RF is, the lower the code rate of the online video is, wherein the value of the RF is 0, and the quality of the encoded online video is lossless; the RF value was taken to be 51 and the encoded on-line video quality was the worst.
However, in the process of implementing the present invention, the inventor finds that, if a user requests to watch an online video with higher definition, the server sends the online video with higher corresponding bitrate to the user for watching, and when the terminal plays the online video with higher bitrate, the network bandwidth and the video decoding pressure are increased, which affects the starting speed of the user for watching the video.
Disclosure of Invention
The embodiment of the invention aims to provide a video coding method and a video coding device, wherein a video at a broadcast starting stage is obtained from a video to be coded and is used as the video to be coded; and coding the video to be coded at a code rate lower than that of the video to be coded, so that the starting speed of the online video is increased. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a video encoding method, including:
acquiring a video to be coded, wherein the video to be coded comprises a video in a playing starting stage and a video in a non-playing starting stage;
coding the video in the broadcast starting stage according to a preset low code rate to obtain a coded video in the broadcast starting stage;
coding the video in the non-broadcast starting stage according to a preset normal code rate to obtain a coded video in the non-broadcast starting stage;
wherein the preset low code rate is smaller than the preset normal code rate.
Optionally, an embodiment of the first aspect of the present invention provides a video encoding method, further including:
determining the time length which accounts for the total time length of the video to be coded as a preset proportion as a play starting time length;
and starting from the initial position of the video to be coded, and taking a video segment corresponding to the broadcast starting time length as the broadcast starting stage video.
Optionally, the start-up phase video includes a plurality of encoding phases; the encoding the video in the broadcast starting stage according to the preset low code rate comprises the following steps:
and respectively coding the video in the start playing stage of the multiple coding stages according to the code rates from low to high.
The video coding method provided by the embodiment of the first aspect of the present invention further includes:
receiving a video request of a video to be played sent by a terminal, wherein the video request carries a playing code rate of the video to be played, and the playing code rate is used as the preset normal code rate, and the content of the video to be played is the same as that of the video to be coded.
The video coding method provided by the embodiment of the first aspect of the present invention further includes:
transmitting the encoded video to the terminal; wherein the encoded video comprises the start-up phase encoded video and the non-start-up phase encoded video.
In a second aspect, an embodiment of the present invention provides a video encoding apparatus, including:
the video acquisition module is used for acquiring a video to be encoded, wherein the video to be encoded comprises a video in a broadcast starting stage and a video in a non-broadcast starting stage;
the first coding module is used for coding the video in the broadcast starting stage according to a preset low code rate to obtain the coded video in the broadcast starting stage;
the second coding module is used for coding the video in the non-broadcast starting stage according to a preset normal code rate to obtain a coded video in the non-broadcast starting stage;
and the preset low code rate is smaller than the preset normal code rate.
Optionally, an embodiment of the second aspect of the present invention provides a video encoding apparatus, further including:
the video determining module is used for determining the time length which accounts for the total time length of the video to be coded as a preset proportion as the playing starting time length;
and starting from the initial position of the video to be coded, and taking a video segment corresponding to the start-up time length as a start-up stage video.
Optionally, the start-up phase video includes a plurality of encoding phases;
the first encoding module is specifically configured to:
and respectively coding the video in the start playing stage of the multiple coding stages according to the code rates from low to high.
The video coding device provided by the embodiment of the second aspect of the present invention further includes:
the video request module is used for receiving a video request of a video to be played, which is sent by the terminal, wherein the video request carries a playing code rate of the video to be played, the playing code rate is used as a preset normal code rate, and the content of the video to be played is the same as that of the video to be coded.
The video coding device provided by the embodiment of the second aspect of the present invention further includes:
and the video sending module is used for sending the coded video to the terminal.
Wherein the encoded video comprises a start-up phase encoded video and a non-start-up phase encoded video.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to perform a video encoding method as described in any one of the above.
In yet another aspect of the present invention, there is also provided a computer program product including instructions which, when run on a computer, cause the computer to perform a video encoding method as described in any one of the above.
The embodiment of the invention provides a video coding method and a video coding device, wherein a video to be coded is obtained, and comprises a video in a broadcast starting stage and a video in a non-broadcast starting stage; coding the video in the broadcast starting stage according to a preset low code rate to obtain a coded video in the broadcast starting stage; and coding the video in the non-start-up stage according to a preset normal code rate to obtain the coded video in the non-start-up stage. Compared with the prior art, the video quality requirement of the user in the starting playing stage is low, the video in the starting playing stage is encoded at the preset low bit rate, the video quality in the starting playing stage is reduced, and the video in the non-starting playing stage is encoded according to the normal bit rate, so that the starting playing speed of the user watching the encoded video to be encoded is high. Of course, not all of the advantages described above need to be achieved at the same time in the practice of any one product or method of the invention.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a schematic view of a video distribution scene according to an embodiment of the present invention;
fig. 2 is a flowchart of a video encoding method according to an embodiment of the present invention;
fig. 3 is a flowchart of acquiring a video at a start-up stage according to an embodiment of the present invention;
fig. 4 is a flowchart of encoding a video in a play start phase according to an embodiment of the present invention;
fig. 5 is a schematic diagram illustrating setting different RF values for the video during the start-up phase of different encoding phases according to an embodiment of the present invention;
fig. 6 is a block diagram of a video encoding apparatus according to an embodiment of the present invention;
fig. 7 is a structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
The video coding method provided by the embodiment of the invention is applied to a coding server, and can also be other equipment with similar functions except the coding server.
As shown in fig. 1, for the problem that the video watching speed of the user in the prior art is slow, the video encoding method provided in the embodiment of the present invention may be applied to an encoding server, and the specific process of the encoding server for encoding the video and then sending the encoded video to a terminal is as follows:
after the coding server acquires the video to be coded, the video to be coded is divided into a video in a play starting stage and a video in a non-play starting stage, the video in the non-play starting stage is coded according to a preset coding mode, such as 720P, 1080P and the like, and the video in the play starting stage is coded according to a lower code rate, so that the play starting speed of the terminal in playing the video is improved. In addition, the video in the broadcast starting stage can be further divided into a plurality of stages, the preset low bit rate is selected to code different stages included in the broadcast starting stage respectively according to the sequence of the bit rates from low to high, the video in the non-broadcast starting stage is coded according to the video bit rate selected by the video request sent by the user, then the coded video to be coded is sent to the slicer to be sliced, and the sliced video is finally transmitted to the terminal through the content distribution network.
And the code rate for coding the video in the broadcast starting stage is lower than the code rate for coding the video in the non-broadcast starting stage.
Therefore, when a user requests to watch an online video with higher definition, the coding server codes the video in the playing starting stage of the video to be coded according to the preset low code rate so as to improve the playing starting speed of the video to be coded, and codes the video in the non-playing starting stage of the video to be coded according to the preset normal code rate. The embodiment of the invention performs low-bit-rate coding on the video in the playing starting stage and performs preset normal-bit-rate coding on the video in the non-playing starting stage, so that the watching experience of a user on the definition of the subsequent video is not influenced while the playing starting speed of the video is improved.
The following proceeds to describe a video encoding method according to an embodiment of the present invention in detail.
Referring to fig. 1, as shown in fig. 2, a video encoding method according to an embodiment of the present invention includes:
s201, acquiring a video to be coded, wherein the video to be coded comprises a video in a broadcast starting stage and a video in a non-broadcast starting stage;
wherein, the total duration of the video to be coded and the video in the starting playing stage is positively correlated.
In order to increase the start-up speed of the online video, at least one implementation manner may be adopted in the above S201 to obtain a video to be encoded:
in a possible implementation manner, after receiving a video request of a video to be played sent by a terminal, the video to be played is taken as a video to be encoded.
In another possible implementation manner, after a video request of a video to be played sent by a terminal is received, a video which is higher than the playing code rate of the video to be played carried in the video request and has the same content as the video to be played is selected as a video to be encoded.
As shown in fig. 3, in one possible implementation, the start-up phase video is obtained by:
s301, determining the time length of the total time length of the video to be coded as a preset proportion as a starting time length;
the preset ratio is a preset ratio value, and the preset ratio may be, but is not limited to, determined by a time length of the video to be encoded. Generally, the preset ratio is positively correlated with the time length of the video to be encoded, that is, the longer the time length of the video is, the larger the preset ratio can be. The following illustrates the relationship between the preset ratio and the video to be encoded and the start-up time.
For example: the video to be encoded may also be referred to as a long video if the video is a video with a time length greater than a preset time length, wherein the preset time length may be, but is not limited to be, greater than 20 minutes. Here, the total length of the video to be encoded may be 60 minutes, and the preset ratio may beMay account for the total length of the video to be encodedAnd 6 minutes, the sowing starting time can be 6 minutes. If the video to be encoded is a video with a time length less than a preset time length, it may also be referred to as a short video. Here, the total length of the video to be encoded may be 15 seconds, and the predetermined ratio may beMay account for the total length of the video to be encodedAnd 3 seconds, the start-up time can be 3 seconds.
And S302, starting from the initial position of the video to be coded, and taking a video segment corresponding to the broadcast starting time length as a broadcast starting stage video.
In the embodiment, the video segment corresponding to the time length which takes the total duration of the video to be coded as the preset proportion is determined as the video in the starting playing stage.
S202, encoding the video in the broadcast starting stage according to a preset low code rate to obtain the encoded video in the broadcast starting stage;
wherein the preset low code rate is lower than the preset normal code rate.
In order to improve the accuracy of video coding in the start-up phase, a preset normal code rate can be obtained through at least one implementation mode:
in a possible implementation manner, a code rate value may be preset as a preset normal code rate, so as to improve the efficiency of determining the preset normal code rate.
In another possible implementation manner, a video request of a video to be played sent by a terminal may be received, and a playing code rate of the video to be played carried by the video request is used as a preset normal code rate.
The content of the video to be played is the same as that of the video to be coded.
Assuming that a user needs to watch an a video, the a video format includes 720P, 1080P and 1080i, the user selects an a video in 1080P format, the a video in 1080P format is a video to be played, and the bitrate of the a video in 1080P format carried in the a video request sent by the user is 30, and the preset normal bitrate is 30.
In a possible implementation manner, a code rate value lower than a preset normal code rate may be preset as a preset low code rate, so as to improve the efficiency of determining the preset low code rate.
In order to increase the start-up speed of the online video, at least one implementation manner may be adopted in S202, where the video in the start-up stage is encoded according to a preset low bit rate:
as shown in fig. 4, in one possible embodiment, the video in the start-up phase is encoded at a preset low bitrate by the following steps:
s401, segmenting a video in a broadcast starting stage to obtain videos in the broadcast starting stage of a plurality of coding stages;
the manner of segmenting the video in the start-up phase in step S401 may be, but is not limited to, uniform segmentation, and may also be non-uniform segmentation.
In a possible implementation manner, the video in the starting playing stage is divided into video segments according to a preset time period and a time front-back order, and the video segments are sequenced according to the time front-back order to obtain the video in the starting playing stage of a plurality of encoding stages.
The preset time period can be set according to the time length of the video in the playing starting stage, so that uniform segmentation can be realized.
The following illustrates a process of dividing the video in the start-up stage into a plurality of encoding stages with a preset time period and a time front-back order.
For example: the video in the start-up stage may be 10 seconds, and the preset time period may be 3 seconds, so that the video in the start-up stage may be divided into 4 segments, 0 to 3 seconds may be one video segment, 3 to 6 seconds may be one video segment, 6 to 9 seconds may be one video segment, and 9 to 10 seconds may be one video segment. The video clips of 0-3 seconds, 3-6 seconds, 6-9 seconds and 9-10 seconds are sequenced according to the chronological order, so that 0-3 seconds can be the start-up stage video of the first coding stage, 3-6 seconds can be the start-up stage video of the second coding stage, 6-9 can be the start-up stage video of the third coding stage, and 9-10 seconds can be the start-up stage video of the last coding stage.
In another possible implementation manner, the video in the start-up stage is divided into a preset number of video segments according to a preset time period and a time front-back order, and the video segments are sequenced according to the time front-back order to obtain the video in the start-up stage of the multiple encoding stages.
Wherein, the preset number can be: the integral part of the ratio of the time length of the video in the starting stage to the preset time period.
The following illustrates a process of dividing the video in the start-up stage into a preset number of video segments according to a preset time period and a time sequence to obtain the video in the start-up stage of multiple encoding stages.
For example: the video in the start-up phase may be 10 seconds, the preset time period may be 3 seconds, the preset number may be 3, the video in the start-up phase may be divided into 3 video segments, 0 to 3 seconds may be one video segment, 3 to 6 seconds may be one video segment, 6 to 10 seconds may be one video segment, the video segments of 0 to 3 seconds, 3 to 6 seconds, and 6 to 10 seconds are sequenced in chronological order, 0 to 3 seconds may be the video in the start-up phase of the first encoding phase, 3 to 6 seconds may be the video in the start-up phase of the second encoding phase, and 6 to 10 may be the video in the start-up phase of the last encoding phase.
S402, encoding the video in the start playing stage of the multiple encoding stages according to the code rates from low to high respectively.
In order to improve the accuracy of encoding the start-up phase video, at least one implementation manner may be adopted in S402, where the start-up phase video of multiple encoding phases is encoded according to code rates from low to high:
in a possible implementation manner, the start-up stage videos of the multiple encoding stages are encoded in an encoding mode with gradually increasing code rates according to the encoding stage sequence of the start-up stage videos at a rate lower than a preset normal code rate.
The encoding stage sequence is a front-back sequence of videos of the play starting stage of the multiple encoding stages after being sequenced according to a time sequence, so that the code rate of the encoded video of the play starting stage of the last encoding stage can be higher than that of the encoded video of the play starting stage of the first encoding stage and lower than that of the encoded video of the non-play starting stage; or, the code rate of the video coded in the start-up stage of the last coding stage can also be the same as the code rate of the video coded in the non-start-up stage.
The increasing manner in the coding mode with the code rate increasing may refer to the amplitude of each equal increase of the code rate or the amplitude of each unequal increase of the code rate.
The following illustrates that the video in the start-up stage of multiple encoding stages is encoded in an encoding mode with gradually increasing code rates according to the sequence of the encoding stages of the video in the start-up stage.
For example: the video in the start-up stage of the encoding stage is a, B, and C, the order of the encoding stage of a, B, and C may be 1, 2, and 3, respectively, and the bitrate of the video in the non-start-up stage may be 30. If the RF value is larger than 18, the code rate of the video in the non-start playing stage is lower than 30. Assuming that the RF value in CRF coding can be set to 28 in the order of coding stages, a is coded; the RF value in CRF coding may be 22 for B, 18 for C.
It can be understood that if the bitrate of the video is suddenly changed, the quality of the video is also suddenly changed, which may result in poor experience of the user in watching the video. According to the method, the video in the broadcast starting stage of the multiple coding stages is coded in the coding mode with the code rates increasing in sequence according to the coding stage sequence of the video in the broadcast starting stage and the coding modes with the code rates lower than the preset normal code rate, so that the code rate of the video in the broadcast starting stage of the last coding stage is the same as the code rate of the video in the non broadcast starting stage, the quality of the video to be coded can be gradually improved, the quality of the coded video to be coded is enabled to be in stable transition, and the user experience is improved.
In another possible implementation manner, preset code rate increase amplitudes are set according to the coding stage sequence of the video in the start-up stage, the code rate increase amplitudes are sequentially increased in an increasing manner, and the video in the start-up stage of the multiple coding stages is coded in a mode that the code rate is from low to high, so that the accuracy of coding the video in the start-up stage of the multiple coding stages is improved.
The code rate increase amplitude can be a value of the code rate increase based on the previous code rate value.
In another possible implementation, the starting-up phase video of the multiple encoding phases is encoded by setting the decreasing amplitude of the RF values in CRF encoding according to the order of the encoding phases of the starting-up phase video, and sequentially using an encoding mode in which the decreasing amplitude of the RF values is increased.
Wherein the RF decrement amplitude is: the magnitude of the RF reduction is based on the previous RF value. The RF decrement amplitude may be set to 6, but is not limited thereto.
The following illustrates the process of starting playing stage video of multiple encoding stages in an encoding mode in which the RF value decreasing amplitude in CRF encoding is set according to the segmentation order of the segmented video at a bitrate lower than the video to be encoded, and the RF decreasing amplitude is sequentially increased.
For example: the video in the start-up stage of the encoding stage is a, B, and C, the order of the encoding stage of a, B, and C may be 1, 2, and 3, respectively, and the bitrate of the video in the non-start-up stage may be 30. If the RF value is larger than 18, the code rate of the video in the non-start playing stage is lower than 30. Assuming that the RF initial value in the CRF coding can be 36 and the RF descending amplitude can be 6, the RF value in the CRF coding can be 30 according to the coding stage sequence, and A is coded; the RF value in CRF coding may be 24 for B, 18 for C.
It can be understood that RF is increased by 6 in CRF coding, and the code rate of the video is reduced by about half in the start-up period after coding; in the CRF coding, the RF is reduced by 6, and the code rate of the video in the playing starting stage after coding is doubled, so that the embodiment codes the video in the playing starting stage of a plurality of coding stages by setting the RF decreasing amplitude mode and sequentially using the RF value according to the coding mode that the RF decreasing amplitude decreases, and the code rate of the video in the playing starting stage can be quickly improved.
S203, coding the video in the non-broadcast starting stage according to a preset normal code rate to obtain the coded video in the non-broadcast starting stage.
Compared with the prior art, the video quality requirement of the user in the starting playing stage is low, the video in the starting playing stage is encoded at the preset low bit rate, the video quality in the starting playing stage is reduced, and the video in the non-starting playing stage is encoded according to the normal bit rate, so that the starting playing speed of the user watching the encoded video to be encoded is high.
The video coding method provided by the embodiment of the invention further comprises the following steps: the encoded video is transmitted to the terminal.
The coded video comprises a broadcast starting stage coded video and a non-broadcast starting stage coded video, wherein in the coded video, the broadcast starting stage coded video is in front, and the non-broadcast starting stage coded video is behind.
The following description is continued with reference to a video encoding apparatus according to an embodiment of the present invention.
As shown in fig. 6, an embodiment of the present invention provides a video encoding apparatus, including:
the video acquiring module 601 is configured to acquire a video to be encoded, where the video to be encoded includes a video in a start-playing stage and a video in a non-start-playing stage;
the first encoding module 602 is configured to encode the video at the start-up stage according to a preset low bit rate to obtain an encoded video at the start-up stage;
the second encoding module 603 is configured to encode the video in the non-start-up stage according to a preset normal code rate to obtain a non-start-up stage encoded video;
and the preset low code rate is smaller than the preset normal code rate.
Optionally, an apparatus for encoding video provided in an embodiment of the present invention further includes:
the video determining module is used for determining the time length which accounts for the total time length of the video to be coded as a preset proportion as the playing starting time length;
and starting from the initial position of the video to be coded, and taking a video segment corresponding to the start-up time length as a start-up stage video.
Optionally, the start-up phase video includes a plurality of encoding phases;
the first encoding module is specifically configured to:
and respectively coding the video in the start playing stage of the multiple coding stages according to the code rates from low to high.
The video encoding device provided by the embodiment of the invention further comprises:
the video request module is used for receiving a video request of a video to be played, which is sent by the terminal, wherein the video request carries a playing code rate of the video to be played, the playing code rate is used as a preset normal code rate, and the content of the video to be played is the same as that of the video to be coded.
The video encoding device provided by the embodiment of the invention further comprises:
and the video sending module is used for sending the coded video to the terminal.
Wherein the encoded video comprises a start-up phase encoded video and a non-start-up phase encoded video.
The embodiment of the present invention further provides a server, as shown in fig. 7, including a processor 701, a communication interface 702, a memory 703 and a communication bus 704, where the processor 701, the communication interface 702, and the memory 703 complete mutual communication through the communication bus 704,
a memory 703 for storing a computer program;
the processor 701 is configured to implement the following steps when executing the program stored in the memory 703:
acquiring a video to be coded;
coding the video in the broadcast starting stage according to a preset low code rate to obtain a coded video in the broadcast starting stage;
and coding the video in the non-start-up stage according to a preset normal code rate to obtain the coded video in the non-start-up stage.
Wherein the preset low code rate is smaller than the preset normal code rate.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In yet another embodiment of the present invention, a computer-readable storage medium is further provided, which has instructions stored therein, which when run on a computer, cause the computer to perform a video encoding method as described in any of the above embodiments.
In a further embodiment provided by the present invention, there is also provided a computer program product comprising instructions which, when run on a computer, cause the computer to perform a video encoding method as described in any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus 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, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus/electronic device/computer-readable storage medium/computer program product embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and for relevant points, reference may be made to some descriptions of the method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.
Claims (7)
1. A video coding method is applied to a coding server, wherein the coding server codes a video and then sends the video to a terminal, and the video coding method comprises the following steps:
acquiring a video to be coded, wherein the video to be coded comprises a video in a playing starting stage and a video in a non-playing starting stage;
coding the video in the broadcast starting stage according to a preset low code rate to obtain a coded video in the broadcast starting stage;
coding the video in the non-broadcast starting stage according to a preset normal code rate to obtain a coded video in the non-broadcast starting stage;
wherein the preset low code rate is smaller than the preset normal code rate;
the video in the playing starting stage is obtained by the following steps:
determining the time length which accounts for the total time length of the video to be coded as a preset proportion as a play starting time length;
starting from the initial position of the video to be coded, taking a video segment corresponding to the broadcast starting time length as the broadcast starting stage video; the preset proportion is in positive correlation with the time length of the video to be coded, and the longer the time length of the video to be coded is, the larger the preset proportion is;
the encoding the video in the broadcast starting stage according to the preset low code rate comprises the following steps:
segmenting the video in the broadcast starting stage to obtain videos in the broadcast starting stage of a plurality of coding stages;
and respectively coding the video in the start playing stage of the multiple coding stages according to the code rates from low to high.
2. The method of claim 1, further comprising:
receiving a video request of a video to be played sent by a terminal, wherein the video request carries a playing code rate of the video to be played, and the playing code rate is used as the preset normal code rate, and the content of the video to be played is the same as that of the video to be coded.
3. The method of claim 2, further comprising:
transmitting the encoded video to the terminal; wherein the encoded video comprises the start-up phase encoded video and the non-start-up phase encoded video.
4. A video encoding apparatus, applied to an encoding server, wherein the encoding server encodes a video and transmits the encoded video to a terminal, the apparatus comprising:
the video acquisition module is used for acquiring a video to be encoded, wherein the video to be encoded comprises a video in a broadcast starting stage and a video in a non-broadcast starting stage;
the first coding module is used for coding the video in the broadcast starting stage according to a preset low code rate to obtain a coded video in the broadcast starting stage;
the second coding module is used for coding the video in the non-broadcast starting stage according to a preset normal code rate to obtain a coded video in the non-broadcast starting stage;
wherein the preset low code rate is smaller than the preset normal code rate;
the device further comprises: a video determination module to:
determining the time length which accounts for the total time length of the video to be coded as a preset proportion as a play starting time length;
starting from the initial position of the video to be coded, taking a video segment corresponding to the broadcast starting time length as the broadcast starting stage video; the preset proportion is in positive correlation with the time length of the video to be coded, and the longer the time length of the video to be coded is, the larger the preset proportion is;
the first encoding module is specifically configured to:
segmenting the video in the broadcast starting stage to obtain videos in the broadcast starting stage of a plurality of coding stages;
and respectively coding the video in the start playing stage of the multiple coding stages according to the code rates from low to high.
5. The apparatus of claim 4, further comprising:
the video request module is used for receiving a video request of a video to be played, which is sent by a terminal, wherein the video request carries a playing code rate of the video to be played, the playing code rate is used as the preset normal code rate, and the content of the video to be played is the same as that of the video to be coded.
6. The apparatus of claim 5, further comprising:
the video sending module is used for sending the coded video to the terminal; wherein the encoded video comprises the start-up phase encoded video and the non-start-up phase encoded video.
7. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 3 when executing a program stored in the memory.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910168460.8A CN109672887B (en) | 2019-03-06 | 2019-03-06 | Video coding method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910168460.8A CN109672887B (en) | 2019-03-06 | 2019-03-06 | Video coding method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109672887A CN109672887A (en) | 2019-04-23 |
CN109672887B true CN109672887B (en) | 2021-04-09 |
Family
ID=66151455
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910168460.8A Active CN109672887B (en) | 2019-03-06 | 2019-03-06 | Video coding method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109672887B (en) |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8418197B2 (en) * | 2008-10-29 | 2013-04-09 | Goldspot Media | Method and apparatus for browser based advertisement insertion |
CN102509467B (en) * | 2011-10-28 | 2013-09-25 | 南京邮电大学 | Information acquisition method of traffic information display system based on mobile handheld device |
CN104581229B (en) * | 2015-01-16 | 2018-08-03 | 京东方科技集团股份有限公司 | A kind of transmission of flow media data device, method and system |
CN105335873A (en) * | 2015-10-27 | 2016-02-17 | 北京金山安全软件有限公司 | Method and device for acquiring quality of advertisement space and electronic equipment |
CN106791850A (en) * | 2016-12-05 | 2017-05-31 | 乐视控股(北京)有限公司 | Method for video coding and device |
CN106961625B (en) * | 2017-03-13 | 2020-02-21 | 华为技术有限公司 | Channel switching method and device |
-
2019
- 2019-03-06 CN CN201910168460.8A patent/CN109672887B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN109672887A (en) | 2019-04-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3657787A1 (en) | Video quality assessment method and apparatus | |
KR101708728B1 (en) | Method, player, and terminal for selecting bitstream segment based on stream media | |
US20120106669A1 (en) | Dynamic encode setting adjustment | |
CN110007893B (en) | Audio output method and electronic equipment | |
CN106688239A (en) | Video downloading method, apparatus, and system | |
CN112087633A (en) | Video decoding method, device and storage medium | |
US11973996B2 (en) | Staggered key frame video encoding | |
CN107835456B (en) | Method and related device for regulating and controlling volume of smart television | |
KR101693567B1 (en) | Streaming media segment preparation method and apparatus | |
CN110213653B (en) | Method and device for playing video | |
US20160072864A1 (en) | Method and client terminal for receiving a multimedia content split into at least two successive segments, and corresponding computer program product and computer readable mediium | |
CN106791930B (en) | Video processing method and device | |
CN111163339A (en) | Short video recommendation method and device | |
CN113490055A (en) | Data processing method and device | |
CN103929682B (en) | Method and device for setting key frames in video live broadcast system | |
CN112911343A (en) | Multi-channel video playing method and device, electronic equipment and storage medium | |
CN106385627B (en) | video encoding method and apparatus | |
CN109672887B (en) | Video coding method and device | |
CN106791714A (en) | The matching process and equipment of IP Camera and server device | |
CN115633191A (en) | Video playing method, device, system, electronic equipment and readable storage medium | |
CN114666627A (en) | Method and device for preloading streaming media video, electronic equipment and storage medium | |
CN112929201A (en) | Bandwidth adjusting method and device, electronic equipment and storage medium | |
CN110928515A (en) | Split screen display method, electronic device and computer readable storage medium | |
CN111669539A (en) | Video playing method and device and electronic equipment | |
CN118283285A (en) | Live broadcast control method, system, device, equipment and storage medium |
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 |