CN109120933B - Method, device and equipment for dynamically adjusting code rate and storage medium - Google Patents

Method, device and equipment for dynamically adjusting code rate and storage medium Download PDF

Info

Publication number
CN109120933B
CN109120933B CN201811186095.5A CN201811186095A CN109120933B CN 109120933 B CN109120933 B CN 109120933B CN 201811186095 A CN201811186095 A CN 201811186095A CN 109120933 B CN109120933 B CN 109120933B
Authority
CN
China
Prior art keywords
time stamp
encoding
video data
interval
adjusted
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
CN201811186095.5A
Other languages
Chinese (zh)
Other versions
CN109120933A (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.)
Guangzhou Kugou Computer Technology Co Ltd
Original Assignee
Guangzhou Kugou Computer Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Kugou Computer Technology Co Ltd filed Critical Guangzhou Kugou Computer Technology Co Ltd
Priority to CN201811186095.5A priority Critical patent/CN109120933B/en
Publication of CN109120933A publication Critical patent/CN109120933A/en
Application granted granted Critical
Publication of CN109120933B publication Critical patent/CN109120933B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods 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/146Data rate or code amount at the encoder output
    • 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/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/2343Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
    • H04N21/234381Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements by altering the temporal resolution, e.g. decreasing the frame rate by frame skipping
    • 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/25Management operations performed by the server for facilitating the content distribution or administrating data related to end-users or client devices, e.g. end-user or client device authentication, learning user preferences for recommending movies
    • H04N21/266Channel or content management, e.g. generation and management of keys and entitlement messages in a conditional access system, merging a VOD unicast channel into a multicast channel
    • H04N21/2662Controlling the complexity of the video stream, e.g. by scaling the resolution or bitrate of the video stream based on the client capabilities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/85Assembly of content; Generation of multimedia applications
    • H04N21/854Content authoring
    • H04N21/8547Content authoring involving timestamps for synchronizing content

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Databases & Information Systems (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The invention discloses a method, a device, equipment and a storage medium for dynamically adjusting code rate, and belongs to the technical field of coding. The method comprises the following steps: acquiring video data to be coded, wherein the video data carries an initial coding time stamp; adjusting the initial encoding timestamp of the video data according to the pre-adjusted encoding timestamp interval to obtain adjusted video data, wherein the adjusted video data carries the adjusted encoding timestamp; and transmitting the adjusted video data to an encoder, wherein the encoder is used for encoding the adjusted video data according to the adjusted encoding time stamp. The invention realizes the dynamic adjustment of the code rate on the premise of not restarting the encoder, simplifies the operation of adjusting the code rate and improves the efficiency.

Description

Method, device and equipment for dynamically adjusting code rate and storage medium
Technical Field
The present invention relates to the field of coding technologies, and in particular, to a method, an apparatus, a device, and a storage medium for dynamically adjusting a code rate.
Background
With the development of multimedia technology, the quality of the original video acquired by the video acquisition sensor is continuously improved, and accordingly, the data volume of the original video with high quality is also large. Therefore, it is usually necessary to encode the original video to remove redundant information of the original video, reduce the data size of the original video, and facilitate transmission and storage of the video.
At present, an encoder is mostly used to encode an original video. When encoding, working parameters such as code rate of an encoder are set, and the encoder is started, so that the encoder encodes an original video according to the set code rate. For a high-version system, the encoder can dynamically adjust the coding rate in the encoding process according to the complexity of the original video picture.
The inventors found that the related art has at least the following problems:
for a low-version system, when the code rate is adjusted, the code rate of the encoder needs to be set again, and the encoder needs to be restarted, so that the encoder encodes the original video according to the newly set code rate, the operation process is complex, and the efficiency is not high.
Disclosure of Invention
The embodiment of the invention provides a method, a device, equipment and a storage medium for dynamically adjusting a code rate, and aims to solve the problems of complicated operation process and low efficiency when the code rate is adjusted by the related technology. The technical scheme is as follows:
in one aspect, a method for dynamically adjusting a code rate is provided, where the method includes:
acquiring video data to be coded, wherein the video data carries an initial coding time stamp;
adjusting the initial encoding timestamp of the video data according to the pre-adjusted encoding timestamp interval to obtain adjusted video data, wherein the adjusted video data carries the adjusted encoding timestamp;
and transmitting the adjusted video data to an encoder, wherein the encoder is used for encoding the adjusted video data according to the adjusted encoding time stamp.
Optionally, the method further comprises: detecting the network communication quality, and determining the preset coding time stamp interval according to the detection result;
or acquiring a set encoding time stamp interval, and taking the set encoding time stamp interval as the pre-adjusted encoding time stamp interval.
Optionally, the obtaining the set encoding timestamp interval includes: and displaying an encoding time stamp interval setting interface, and acquiring the set encoding time stamp interval through the encoding time stamp interval setting interface.
Optionally, the pre-adjusted encoding timestamp interval is a first encoding timestamp interval, and the first encoding timestamp interval is greater than an initial encoding timestamp interval corresponding to the initial encoding timestamp;
the adjusting the initial encoding timestamp of the video data according to the pre-adjusted encoding timestamp interval includes: adjusting an initial encoding timestamp of the video data according to the first encoding timestamp interval.
Optionally, the preset encoding timestamp interval is a second encoding timestamp interval, and the second encoding timestamp interval is smaller than an initial encoding timestamp interval corresponding to the initial encoding timestamp;
the adjusting the initial encoding timestamp of the video data according to the pre-adjusted encoding timestamp interval includes: adjusting an initial encoding timestamp of the video data according to the second encoding timestamp interval.
In one aspect, an apparatus for dynamically adjusting a code rate is provided, the apparatus comprising:
the first acquisition module is used for acquiring video data to be encoded, wherein the video data carries an initial encoding timestamp;
the adjusting module is used for adjusting the initial coding timestamp of the video data according to the preset coding timestamp interval to obtain adjusted video data, and the adjusted video data carries the adjusted coding timestamp;
and the transmission module is used for transmitting the adjusted video data to an encoder, and the encoder is used for encoding the adjusted video data according to the adjusted encoding timestamp.
Optionally, the apparatus further comprises: the detection module is used for detecting the network communication quality and determining the preset coding time stamp interval according to the detection result;
or, the second obtaining module is configured to obtain a set encoding timestamp interval, and use the set encoding timestamp interval as the pre-adjusted encoding timestamp interval.
Optionally, the second obtaining module includes: the display unit is used for displaying an encoding timestamp interval setting interface;
and the acquisition unit is used for acquiring the set encoding timestamp interval through the encoding timestamp setting interface.
Optionally, the preset encoding timestamp interval is a first encoding timestamp interval, and the first encoding timestamp interval is smaller than an initial encoding timestamp interval corresponding to the initial encoding timestamp;
the adjusting module is configured to adjust the initial encoding timestamp of the video data according to the first encoding timestamp interval.
Optionally, the preset encoding timestamp interval is a second encoding timestamp interval, and the second encoding timestamp interval is smaller than an initial encoding timestamp interval corresponding to the initial encoding timestamp;
and the adjusting module is used for adjusting the initial encoding time stamp of the video data according to the second encoding time stamp interval.
In one aspect, an apparatus for dynamically adjusting a code rate is provided, the apparatus comprising a memory and a processor; at least one instruction is stored in the memory, and the at least one instruction is loaded and executed by the processor, so as to implement the method for dynamically adjusting the code rate provided by the embodiment of the invention.
In another aspect, a storage medium for dynamically adjusting a code rate is provided, where at least one instruction is stored in the storage medium, and the instruction is loaded and executed by a processor to implement the method for dynamically adjusting a code rate according to the embodiment of the present invention.
The technical scheme provided by the embodiment of the invention has the beneficial effects that at least:
the initial coding timestamp carried by the video data is adjusted according to the pre-adjusted coding timestamp interval, the adjusted video data is obtained, and the adjusted video data is encoded according to the adjusted coding timestamp through the encoder, so that the code rate of the encoded video data output by the encoder is changed, the dynamic adjustment of the code rate is realized on the premise of not restarting the encoder, the operation of adjusting the code rate is simplified, and the efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic diagram of an implementation environment provided by an embodiment of the invention;
FIG. 2 is a flowchart of a method for dynamically adjusting a code rate according to an embodiment of the present invention;
FIG. 3 is a flowchart of a method for dynamically adjusting a code rate according to an embodiment of the present invention;
FIG. 4 is a flowchart of a method for dynamically adjusting a code rate according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of an apparatus for dynamically adjusting a code rate according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an apparatus for dynamically adjusting a code rate according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an apparatus for dynamically adjusting a code rate according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
With the development of multimedia technology, the quality of the original video acquired by the video acquisition sensor is continuously improved, and accordingly, the data volume of the original video with high quality is also large. Therefore, it is usually necessary to encode the original video to remove redundant information of the original video, reduce the data size of the original video, and facilitate transmission and storage of the video.
In the related art, when an encoder is used for encoding an original video, working parameters such as a code rate of the encoder are set in advance, and the encoder is started, so that the encoder encodes the original video according to the set code rate. For a high-version system (for example, a system with a version higher than Android 19), the encoder may dynamically adjust the coding rate during the encoding process according to the complexity of the original video picture. However, for a low-version system (for example, a system with a version lower than Android 19), when the code rate is adjusted, the code rate of the encoder needs to be set again, and the encoder needs to be restarted, so that the encoder encodes the original video according to the newly set code rate, which is tedious in operation process and low in efficiency.
To this end, the embodiment of the present invention provides a method for dynamically adjusting a code rate without restarting an encoder, and the method for dynamically adjusting a code rate can be applied in the implementation environment shown in fig. 1. In fig. 1, a client 11, an encoder 12, at least one input buffer 13 and at least one output buffer 14 are included.
The client 11 firstly obtains at least one blank input buffer 13, and fills data to be coded into the at least one blank input buffer 13; the encoder 12 acquires data to be encoded from the input buffer 13, and encodes the data to be encoded; after the encoding is completed, the encoder 12 fills the encoded data into at least one blank output buffer 14, and the client 11 can obtain the encoded data from the output buffer 14.
After acquiring the encoded data, the client 11 may perform operations such as playing or transmitting the encoded data. In addition, the data to be encoded filled in the input buffer 13 and the encoded data filled in the output buffer 14 can be released, the output buffer 13 and the output buffer 14 after releasing are changed into blank buffers which can be filled with data again, and the client 11 and the encoder 12 can reuse the blank buffers.
Based on the implementation environment shown in fig. 1, referring to fig. 2, an embodiment of the present invention provides a method for dynamically adjusting a bitrate, where the method is applicable to a client 11 in the implementation environment shown in fig. 1. As shown in fig. 2, the method includes:
step 201, acquiring video data to be encoded, wherein the video data carries an initial encoding timestamp;
the video data to be coded can be original video data collected by a camera or other collection equipment, and the original video data is uncoded video data; the video data to be encoded may also be a video file decoded by a decoder, the video file is the encoded original video data before being decoded by the decoder, and the original video data can be obtained again after being decoded by the decoder, and the original video data is used as the video data to be encoded according to different encoding modes and encoded again.
The video data carries an initial encoding time stamp, the initial encoding time stamp is a time index in an encoding process, and an encoder can encode the video data to be encoded according to the initial encoding time stamp: and the encoder confirms the time length of the corresponding video data according to the initial encoding time stamp so as to finish encoding the video data. For example, when the encoder acquires an initial encoding time stamp of 1s (second) at a certain time, it can be confirmed that video data having a time length of 1s has been acquired, and then the encoder can encode the video data within 1 s.
In addition to the initial encoding time stamp, the video data may also carry data information such as chrominance, luminance, and frame rate. The chrominance and the luminance are human sensory indexes, the frame rate is the frame number of a still picture included in a 1 second video, when the still picture is played, the still picture is played fast and continuously, namely, a motion false image can be formed in human eyes, the more the frame number of the still picture played in 1 second is, the more the motion false image is formed, and the frame rate is an evaluation index of the video fluency degree.
In the acquisition process, the frame rate can be set through a camera or other acquisition equipment. Taking a camera as an example, if the frame rate of the camera is set to 20fps (frames per second), the camera acquires 20 frames of still picture data per second. Each frame of still picture data may correspond to an initial encoding time stamp, and the initial encoding time stamp is generally in units of ms (milliseconds). For example, if the camera captures 20 frames of still picture data within 1 second, the initial encoding timestamp of the still picture data captured in the 1 st frame is 50ms, the initial encoding timestamp of the still picture data captured in the 2 nd frame is 100ms, and so on, and the initial encoding timestamp of the still picture data captured in the 20 th frame is 1000 ms.
Step 202, adjusting an initial encoding timestamp of the video data according to a pre-adjusted encoding timestamp interval to obtain adjusted video data, wherein the adjusted video data carries the adjusted encoding timestamp;
the interval between each initial coding time stamp of the video data is changed by adjusting the initial coding time stamp of the video data, and the adjusting process can be carried out for multiple times, so that the adjusted coding time stamp interval is the pre-adjusted coding time stamp interval.
The encoder confirms the time length of the acquired video data according to the encoding time stamp, so that the initial encoding time stamp of the video data is adjusted according to the pre-adjusted encoding time stamp interval for the video data with a certain time length, and the judgment of the encoder on the time length of the video data can be changed. For example, for video data having a time length of 1s, if the initial encoding time stamp of one frame of video data is 500ms and the initial encoding time stamp of one frame of video data is 1s, the initial encoding time stamp of 500ms is adjusted to 1s, and the initial encoding time stamp of 1s is adjusted to 2s, that is, the initial encoding time stamp interval is 500ms, and the adjusted encoding time stamp interval is 1s, the encoder determines that the time length of the video data is 2s after acquiring the adjusted encoding time stamp, and actually, the time length of the video data is still 1 s.
Step 203, transmitting the adjusted video data to an encoder, where the encoder is configured to encode the adjusted video data according to the adjusted encoding timestamp.
After an encoder is created, working parameters such as a code rate of the encoder need to be set, and the encoder is started, so that the encoder encodes an original video according to the set code rate. It should be noted that the code rate is the size of the encoded video data output by the encoder every second after the video data to be encoded is encoded by the encoder. For example, if the coding rate of the encoder is set to 100kbps (kilobits per second), the encoder encodes the video data to be encoded for 1s, and outputs encoded video data having a size of 100kb (kilobits).
Next, a method for dynamically adjusting a code rate provided by the embodiment of the present invention is described by taking two frames of video data with initial encoding timestamps of 500ms and 1s and adjusted encoding timestamps of 1s and 2s as an example:
suppose the code rate of the encoder is set to 100kbps, i.e. the data encoded in 1s of the encoder is 100 kb; the initial coding time stamp is 500ms and 1s, namely two frames of video data are coded in one second, the data size is 100kb, each frame of video data can be averagely allocated to 50kb, and the actual code rate is 50 kb/frame x2 frame/s which is 100 kbps; the adjusted encoding time stamp is 1s and 2s, namely one frame of video data is encoded in one second, the data size is 100kb, the encoded data of each frame can be distributed to 100kb on average, and the actual code rate is two frames of video data per second, namely the actual code rate is 100 kb/frame x2 frames/s-200 kbps.
And coding the video data according to the adjusted coding timestamp so as to change the actual code rate of the coded video data, thereby realizing the dynamic adjustment of the code rate of the coded video data on the premise of not restarting the coder.
In an alternative embodiment, referring to fig. 3, the method further comprises:
and 204, detecting the network communication quality, and determining the preset encoding time stamp interval according to the detection result.
In an alternative embodiment, referring to fig. 4, the method further comprises:
step 205, acquiring the set encoding time stamp interval, and taking the set encoding time stamp interval as the pre-adjusted encoding time stamp interval.
The original video data collected by a camera or other collection devices usually carries data information such as chrominance, luminance, frame rate and the like, and the basic principle of coding by an encoder is to remove redundant data information carried by the original video data, so as to reduce the data volume of the original video, thereby facilitating the storage and transmission of the video. The redundant data information includes chrominance information which is easily ignored by human eyes, luminance information which cannot be distinguished by human eyes, and the like.
Therefore, the smaller the amount of redundant data information removed in the encoding process, the larger the amount of encoded video data, the higher the code rate of the encoded video data, that is, the smaller the image quality difference between the encoded video data and the original video data; similarly, the more redundant data information removed in the encoding process, the smaller the encoded video data amount, the lower the code rate of the encoded video data, that is, the greater the image quality difference between the encoded video data and the original video data.
If the video data is analyzed only from the image quality perspective, the larger the code rate of the video data is, the better the video data is; however, the higher the demand of the high-rate video data on the network transmission speed, once the network transmission speed is lower than the rate of the video data, the phenomena of blocking or even stagnation will occur during the storage and transmission processes, resulting in the reduction of the transmission efficiency.
Therefore, the embodiment of the invention detects the network communication quality before determining the preset coding time stamp interval, and determines the preset coding time stamp interval according to the detection result so as to prevent the phenomena of stagnation, stagnation and the like in the storage and transmission processes; or, the embodiment of the invention can also directly acquire the preset encoding timestamp interval defined by the user, so as to adjust the initial encoding timestamp according to the preset encoding timestamp interval, and enable the code rate of the video data to meet the requirements of the user.
Optionally, the present embodiment may display an encoding timestamp interval setting interface, where the setting interface provides an input box, and a user may enter a custom pre-adjusted timestamp interval through the input box of the setting interface; alternatively, the setup interface provides an optional pre-adjusted time stamp interval from which the user may also select the pre-adjusted time stamp interval.
In an alternative embodiment, the pre-adjusted encoding time stamp interval is a first encoding time stamp interval, and the first encoding time stamp interval is greater than an initial encoding time stamp interval corresponding to the initial encoding time stamp;
adjusting an initial encoding timestamp of the video data according to the pre-adjusted encoding timestamp interval, including: the initial encoding timestamp of the video data is adjusted by a first encoding timestamp interval.
The adjustment process will be explained by taking the example that the code rate of the encoder is set to 100 kbps:
TABLE 1
50 100 150 200 250 300 350 400 450 500
550 600 650 700 750 800 850 900 950 1000
TABLE 2
100 200 300 400 500 600 700 800 900 1000
1100 1200 1300 1400 1500 1600 1700 1800 1900 2000
The code rate of the encoder is set to 100kbps, namely the data coded in the encoder 1s is 100 kb; referring to table 1, the initial encoding time stamp refers to that twenty frames of video data are encoded in one second, the data size is 100kb, each frame of video data can be allocated to 5kb on average, and the actual code rate is 5 kb/frame x20 frame/s which is 100 kbps; the adjusted encoding time stamp is shown in table 2, that is, ten frames of video data are encoded in one second, the data size is 100kb, the encoded data in each frame can be allocated to 10kb on average, and the actual rate is twenty frames of video data per second, that is, the actual rate is 10 kb/frame x20 frames/s-200 kbps.
Therefore, the code rate of the output video data can be increased by adjusting the initial encoding time stamps of the video data according to the first encoding time stamp interval, that is, by increasing the interval between the initial encoding time stamps.
Optionally, the pre-adjusted encoding timestamp interval may also be a second encoding timestamp interval, where the second encoding timestamp interval is smaller than the initial encoding timestamp interval corresponding to the initial encoding timestamp;
adjusting the initial encoding timestamp of the video data according to the pre-adjusted encoding timestamp interval, including: the initial encoding timestamp of the video data is adjusted by a second encoding timestamp interval.
Next, the adjustment process will be described by taking the example that the code rate of the encoder is set to 100 kbps;
TABLE 3
25 50 75 100 125 150 175 200 225 250
275 300 325 350 375 400 425 450 475 500
525 550 575 600 625 650 675 700 725 750
775 800 825 850 875 900 925 950 975 1000
The code rate of the encoder is set to 100kbps, namely the data coded in the encoder 1s is 100 kb; referring to table 1, the initial encoding time stamp refers to that twenty frames of video data are encoded in one second, the data size is 100kb, each frame of video data can be allocated to 5kb on average, and the actual code rate is 5 kb/frame x20 frame/s which is 100 kbps; the adjusted encoding time stamp is shown in table 3, that is, forty frames of video data are encoded in one second, the data size is 100kb, the encoded data in each frame can be allocated to 2.5kb on average, and there are twenty frames of video data in each second actually, that is, the actual code rate is 2.5 kb/frame x20 frames/s, which is 50 kbps.
Therefore, the code rate of the output video data can be reduced by adjusting the initial encoding time stamps of the video data according to the second encoding time stamp interval, that is, by reducing the interval between the initial encoding time stamps.
In summary, in the embodiments of the present invention, the initial encoding timestamp carried by the video data is adjusted according to the pre-adjusted encoding timestamp interval to obtain the adjusted video data, and the encoder encodes the adjusted video data according to the adjusted encoding timestamp, so that the code rate of the encoded video data output by the encoder changes, and thus the dynamic adjustment of the code rate is implemented on the premise of not restarting the encoder.
The interval of the initial coding time stamp is adjusted to be larger, so that the code rate of the video data can be increased; the interval of the initial coding time stamp is adjusted to be small, so that the code rate of the video data can be reduced.
Furthermore, the embodiment of the invention can determine the pre-adjustment scheme of the coding time stamp interval according to the detection result of the network communication quality, so that the code rate of the coded video data is matched with the network transmission capability, and the phenomena of blocking and the like are avoided; the embodiment of the invention can also obtain the coding time stamp interval which is set by the user in a self-defining way, and the coding time stamp interval which is set by the user in the self-defining way is used as a pre-adjustment scheme of the coding time stamp interval, thereby meeting the requirement of the user on the video data code rate.
Based on the same inventive concept, an embodiment of the present invention provides an apparatus for dynamically adjusting a code rate, as shown in fig. 5, the apparatus includes:
a first obtaining module 501, configured to obtain video data to be encoded, where the video data carries an initial encoding timestamp;
an adjusting module 502, configured to adjust an initial encoding timestamp of the video data according to a pre-adjusted encoding timestamp interval to obtain adjusted video data, where the adjusted video data carries an adjusted encoding timestamp;
a transmitting module 503, configured to transmit the adjusted video data to an encoder, where the encoder is configured to encode the adjusted video data according to the adjusted encoding timestamp.
Optionally, the apparatus further comprises: as shown in fig. 6, the detecting module 504 is configured to detect network communication quality, and determine the pre-adjusted encoding timestamp interval according to the detection result;
optionally, the apparatus further comprises: as shown in fig. 7, the second obtaining module 505 is configured to obtain a set encoding timestamp interval, and use the set encoding timestamp interval as the pre-adjusted encoding timestamp interval.
Optionally, the second obtaining module 505 includes: the display unit is used for displaying an encoding timestamp interval setting interface;
and the acquisition unit is used for acquiring the set encoding timestamp interval through the encoding timestamp setting interface.
Optionally, the pre-adjusted encoding timestamp interval is a first encoding timestamp interval, and the first encoding timestamp interval is smaller than an initial encoding timestamp interval corresponding to the initial encoding timestamp;
an adjusting module 502, configured to adjust the initial encoding timestamp of the video data according to the first encoding timestamp interval.
Optionally, the pre-adjusted encoding timestamp interval is a second encoding timestamp interval, and the second encoding timestamp interval is smaller than the initial encoding timestamp interval corresponding to the initial encoding timestamp;
an adjusting module 502, configured to adjust the initial encoding timestamp of the video data according to the second encoding timestamp interval.
In summary, in the apparatus provided in the embodiment of the present invention, the initial encoding timestamp carried by the video data is adjusted according to the pre-adjusted encoding timestamp interval to obtain the adjusted video data, and the encoder encodes the adjusted video data according to the adjusted encoding timestamp, so that the code rate of the encoded video data output by the encoder changes, and thus the dynamic adjustment of the code rate is implemented on the premise of not restarting the encoder.
The interval of the initial coding time stamp is adjusted to be larger, so that the code rate of the video data can be increased; the interval of the initial coding time stamp is adjusted to be small, so that the code rate of the video data can be reduced.
Furthermore, a pre-adjustment scheme of the coding time stamp interval can be determined according to the detection result of the network communication quality, so that the code rate of the coded video data is matched with the network transmission capability, and the phenomena of blocking and the like are avoided; the invention can also obtain the coding time stamp interval set by the user in a self-defining way, and the coding time stamp interval set by the user in the self-defining way is used as a pre-adjustment scheme of the coding time stamp interval, thereby meeting the requirement of the user on the video data code rate.
Referring to fig. 8, a schematic structural diagram of a terminal 800 for dynamically adjusting a code rate according to an embodiment of the present disclosure is shown. The terminal 800 may be a portable mobile terminal such as: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, motion video Experts compression standard Audio Layer 3), an MP4 player (Moving Picture Experts Group Audio Layer IV, motion video Experts compression standard Audio Layer 4), a notebook computer, or a desktop computer. The terminal 800 may also be referred to by other names such as user equipment, portable terminal, laptop terminal, desktop terminal, etc.
In general, the terminal 800 includes: a processor 801 and a memory 802.
The processor 801 may include one or more processing cores, such as 4 core processors, 8 core processors, and so forth. The processor 801 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 801 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 801 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 801 may further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
Memory 802 may include one or more computer-readable storage media, which may be non-transitory. Memory 802 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 802 is used to store at least one instruction for execution by processor 801 to implement the method of dynamically adjusting a code rate provided by the method embodiments herein.
In some embodiments, the terminal 800 may further include: a peripheral interface 803 and at least one peripheral. The processor 801, memory 802 and peripheral interface 803 may be connected by bus or signal lines. Various peripheral devices may be connected to peripheral interface 803 by a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 804, a touch screen display 808, a camera 806, an audio circuit 807, a positioning component 808, and a power supply 809.
The peripheral interface 803 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 801 and the memory 802. In some embodiments, the processor 801, memory 802, and peripheral interface 803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 801, the memory 802, and the peripheral interface 803 may be implemented on separate chips or circuit boards, which are not limited by this embodiment.
The Radio Frequency circuit 804 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 804 communicates with communication networks and other communication devices via electromagnetic signals. The rf circuit 804 converts an electrical signal into an electromagnetic signal to be transmitted, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 804 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuit 804 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: metropolitan area networks, various generation mobile communication networks (2G, 3G, 4G, and 8G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the radio frequency circuit 804 may further include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 805 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display 805 is a touch display, the display 805 also has the ability to capture touch signals on or above the surface of the display 805. The touch signal may be input to the processor 801 as a control signal for processing. At this point, the display 805 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display 805 may be one, providing the front panel of the terminal 800; in other embodiments, the display 805 may be at least two, respectively disposed on different surfaces of the terminal 800 or in a folded design; in still other embodiments, the display 805 may be a flexible display disposed on a curved surface or a folded surface of the terminal 800. Even further, the display 805 may be arranged in a non-rectangular irregular pattern, i.e., a shaped screen. The Display 805 can be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), and other materials.
The camera assembly 806 is used to capture images or video. Optionally, camera assembly 806 includes a front camera and a rear camera. Generally, a front camera is disposed at a front panel of the terminal, and a rear camera is disposed at a rear surface of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 806 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
The audio circuit 807 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 801 for processing or inputting the electric signals to the radio frequency circuit 804 to realize voice communication. For the purpose of stereo sound collection or noise reduction, a plurality of microphones may be provided at different portions of the terminal 800. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 801 or the radio frequency circuit 804 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, the audio circuitry 808 may also include a headphone jack.
The positioning component 808 is used to locate the current geographic position of the terminal 800 for navigation or LBS (Location Based Service). The Positioning component 808 may be a Positioning component based on the GPS (Global Positioning System) in the united states, the beidou System in china, the graves System in russia, or the galileo System in the european union.
Power supply 809 is used to provide power to various components in terminal 800. The power supply 809 can be ac, dc, disposable or rechargeable. When the power source 809 comprises a rechargeable battery, the rechargeable battery may support wired or wireless charging. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, terminal 800 also includes one or more sensors 810. The one or more sensors 810 include, but are not limited to: acceleration sensor 811, gyro sensor 812, pressure sensor 813, fingerprint sensor 814, optical sensor 818, and proximity sensor 816.
The acceleration sensor 810 can detect the magnitude of acceleration in three coordinate axes of the coordinate system established with the terminal 800. For example, the acceleration sensor 811 may be used to detect the components of the gravitational acceleration in three coordinate axes. The processor 801 may control the touch screen 808 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 811. The acceleration sensor 811 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 812 may detect a body direction and a rotation angle of the terminal 800, and the gyro sensor 812 may cooperate with the acceleration sensor 811 to acquire a 3D motion of the user with respect to the terminal 800. From the data collected by the gyro sensor 812, the processor 801 may implement the following functions: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
Pressure sensors 813 may be disposed on the side bezel of terminal 800 and/or underneath touch screen display 808. When the pressure sensor 813 is disposed on the side frame of the terminal 800, the holding signal of the user to the terminal 800 can be detected, and the processor 801 performs left-right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 813. When the pressure sensor 813 is disposed at the lower layer of the touch display screen 808, the processor 801 controls the operability control on the UI interface according to the pressure operation of the user on the touch display screen 808. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The fingerprint sensor 814 is used for collecting a fingerprint of the user, and the processor 801 identifies the identity of the user according to the fingerprint collected by the fingerprint sensor 814, or the fingerprint sensor 814 identifies the identity of the user according to the collected fingerprint. Upon identifying that the user's identity is a trusted identity, the processor 801 authorizes the user to perform relevant sensitive operations including unlocking a screen, viewing encrypted information, downloading software, paying for and changing settings, etc. Fingerprint sensor 814 may be disposed on the front, back, or side of terminal 800. When a physical button or a vendor Logo is provided on the terminal 800, the fingerprint sensor 814 may be integrated with the physical button or the vendor Logo.
The optical sensor 815 is used to collect the ambient light intensity. In one embodiment, the processor 801 may control the display brightness of the touch screen 805 based on the ambient light intensity collected by the optical sensor 815. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 805 is increased; when the ambient light intensity is low, the display brightness of the touch display 805 is turned down. In another embodiment, the processor 801 may also dynamically adjust the shooting parameters of the camera assembly 806 based on the ambient light intensity collected by the optical sensor 815.
A proximity sensor 816, also known as a distance sensor, is typically provided on the front panel of the terminal 800. The proximity sensor 816 is used to collect the distance between the user and the front surface of the terminal 800. In one embodiment, when the proximity sensor 816 detects that the distance between the user and the front surface of the terminal 800 gradually decreases, the processor 801 controls the touch display 805 to switch from the bright screen state to the dark screen state; when the proximity sensor 816 detects that the distance between the user and the front surface of the terminal 800 becomes gradually larger, the processor 801 controls the touch display 805 to switch from the screen-on state to the screen-on state.
Those skilled in the art will appreciate that the configuration shown in fig. 8 is not intended to be limiting of terminal 800 and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components may be used.
Based on the same inventive concept, the embodiment of the invention provides a device for dynamically adjusting code rate, which comprises a memory and a processor; the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the method for dynamically adjusting the code rate provided by the embodiment of the invention.
Based on the same inventive concept, the embodiment of the present invention provides a storage medium for dynamically adjusting a code rate, where the storage medium stores at least one instruction, and the instruction is loaded and executed by a processor to implement the method for dynamically adjusting a code rate provided by the embodiment of the present invention. All the above optional technical solutions may be combined arbitrarily to form the optional embodiments of the present disclosure, and are not described herein again.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only exemplary of the present invention and should not be taken as limiting the invention, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (8)

1. A method for dynamically adjusting a code rate, the method comprising:
acquiring video data to be coded, wherein the video data carries an initial coding time stamp;
adjusting the initial encoding timestamp of the video data according to a preset encoding timestamp interval to obtain adjusted video data, wherein the adjusted video data carries the adjusted encoding timestamp, and the adjusted encoding timestamp is used for changing the judgment of an encoder on the time length of the video data;
transmitting the adjusted video data to the encoder, wherein the encoder is configured to encode the adjusted video data according to the adjusted encoding timestamp;
the pre-adjusted encoding time stamp interval acquisition method comprises the following steps: detecting the network communication quality, and determining a preset coding time stamp interval according to a detection result; or displaying an encoding time stamp interval setting interface, and taking the self-defined encoding time stamp interval entered in the input box of the interface as the pre-adjusted encoding time stamp interval, or providing selectable encoding time stamp intervals by the interface, and taking the selected encoding time stamp interval in the selectable encoding time stamp intervals as the pre-adjusted encoding time stamp interval.
2. The method of claim 1, wherein the pre-adjusted encoding time stamp interval is a first encoding time stamp interval, and the first encoding time stamp interval is greater than an initial encoding time stamp interval corresponding to the initial encoding time stamp;
the adjusting the initial encoding timestamp of the video data according to the pre-adjusted encoding timestamp interval includes:
adjusting an initial encoding timestamp of the video data according to the first encoding timestamp interval.
3. The method of claim 1, wherein the pre-adjusted encoding time stamp interval is a second encoding time stamp interval, and the second encoding time stamp interval is smaller than an initial encoding time stamp interval corresponding to the initial encoding time stamp;
the adjusting the initial encoding timestamp of the video data according to the pre-adjusted encoding timestamp interval includes:
adjusting an initial encoding timestamp of the video data according to the second encoding timestamp interval.
4. An apparatus for dynamically adjusting a code rate, the apparatus comprising:
the first acquisition module is used for acquiring video data to be encoded, wherein the video data carries an initial encoding timestamp;
the adjusting module is used for adjusting the initial coding time stamp of the video data according to the preset coding time stamp interval to obtain adjusted video data, wherein the adjusted video data carries the adjusted coding time stamp, and the adjusted coding time stamp is used for changing the judgment of the encoder on the time length of the video data;
a transmission module, configured to transmit the adjusted video data to the encoder, where the encoder is configured to encode the adjusted video data according to the adjusted encoding timestamp;
the first acquisition module is further used for detecting the network communication quality and determining the preset encoding timestamp interval according to the detection result; or displaying an encoding time stamp interval setting interface, and taking the self-defined encoding time stamp interval entered in the input box of the interface as the pre-adjusted encoding time stamp interval, or providing selectable encoding time stamp intervals by the interface, and taking the selected encoding time stamp interval in the selectable encoding time stamp intervals as the pre-adjusted encoding time stamp interval.
5. The apparatus for dynamically adjusting code rate according to claim 4, wherein the pre-adjusted encoding time stamp interval is a first encoding time stamp interval, and the first encoding time stamp interval is smaller than an initial encoding time stamp interval corresponding to the initial encoding time stamp;
the adjusting module is configured to adjust the initial encoding timestamp of the video data according to the first encoding timestamp interval.
6. The apparatus for dynamically adjusting code rate according to claim 4, wherein the pre-adjusted encoding time stamp interval is a second encoding time stamp interval, and the second encoding time stamp interval is smaller than an initial encoding time stamp interval corresponding to the initial encoding time stamp;
and the adjusting module is used for adjusting the initial encoding time stamp of the video data according to the second encoding time stamp interval.
7. An apparatus for dynamically adjusting a code rate, the apparatus comprising a memory and a processor; the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the method for dynamically adjusting a code rate according to any one of claims 1 to 3.
8. A computer-readable storage medium having stored thereon at least one instruction, which is loaded and executed by a processor to implement the method for dynamically adjusting a code rate as recited in any of claims 1-3.
CN201811186095.5A 2018-10-11 2018-10-11 Method, device and equipment for dynamically adjusting code rate and storage medium Active CN109120933B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811186095.5A CN109120933B (en) 2018-10-11 2018-10-11 Method, device and equipment for dynamically adjusting code rate and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811186095.5A CN109120933B (en) 2018-10-11 2018-10-11 Method, device and equipment for dynamically adjusting code rate and storage medium

Publications (2)

Publication Number Publication Date
CN109120933A CN109120933A (en) 2019-01-01
CN109120933B true CN109120933B (en) 2021-05-14

Family

ID=64857926

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811186095.5A Active CN109120933B (en) 2018-10-11 2018-10-11 Method, device and equipment for dynamically adjusting code rate and storage medium

Country Status (1)

Country Link
CN (1) CN109120933B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110784718B (en) 2019-10-31 2021-07-20 广州市网星信息技术有限公司 Video data encoding method, apparatus, device and storage medium
CN111010576B (en) * 2019-12-18 2021-04-27 腾讯科技(深圳)有限公司 Data processing method and related equipment
CN111083536B (en) * 2019-12-31 2022-02-22 广州酷狗计算机科技有限公司 Method and device for adjusting video code rate
CN111263153B (en) * 2020-02-20 2022-10-11 广州市百果园信息技术有限公司 Video encoding method, device, equipment and storage medium
CN111478914B (en) * 2020-04-14 2022-08-16 广州酷狗计算机科技有限公司 Timestamp processing method, device, terminal and storage medium
CN113453114B (en) * 2021-06-30 2023-04-07 Oppo广东移动通信有限公司 Encoding control method, encoding control device, wireless headset and storage medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104702922A (en) * 2013-12-10 2015-06-10 中国电信股份有限公司 Method and system for transmitting video
CN103888846B (en) * 2014-03-04 2017-02-08 浙江大学 Wireless video streaming service self-adaption rate control method based on QoE
CN104010232B (en) * 2014-05-23 2017-12-12 惠州Tcl移动通信有限公司 A kind of intelligence plays method, system, player and the mobile terminal of Online Video
CN104202614B (en) * 2014-08-15 2016-03-09 小米科技有限责任公司 A kind of method of Network Environment adjustment video image quality and device
US10218986B2 (en) * 2016-09-26 2019-02-26 Google Llc Frame accurate splicing
CN107360424B (en) * 2017-07-28 2019-10-25 深圳岚锋创视网络科技有限公司 A kind of bit rate control method based on video encoder, device and video server
CN107566795B (en) * 2017-09-04 2019-11-19 浙江大华技术股份有限公司 A kind of method, apparatus and system improving real-time pictures fluency

Also Published As

Publication number Publication date
CN109120933A (en) 2019-01-01

Similar Documents

Publication Publication Date Title
CN109120933B (en) Method, device and equipment for dynamically adjusting code rate and storage medium
CN110502954B (en) Video analysis method and device
CN108401124B (en) Video recording method and device
CN108391171B (en) Video playing control method and device, and terminal
CN109348247B (en) Method and device for determining audio and video playing time stamp and storage medium
CN111372126B (en) Video playing method, device and storage medium
CN108965757B (en) Video recording method, device, terminal and storage medium
CN111586431B (en) Method, device and equipment for live broadcast processing and storage medium
CN109635133B (en) Visual audio playing method and device, electronic equipment and storage medium
CN111083526B (en) Video transition method and device, computer equipment and storage medium
CN107896337B (en) Information popularization method and device and storage medium
CN110839174A (en) Image processing method and device, computer equipment and storage medium
CN111586413B (en) Video adjusting method and device, computer equipment and storage medium
CN108845777B (en) Method and device for playing frame animation
CN112667835A (en) Work processing method and device, electronic equipment and storage medium
CN108848405B (en) Image processing method and device
CN108734662B (en) Method and device for displaying icons
CN110856152A (en) Method, device, electronic equipment and medium for playing audio data
CN111010588B (en) Live broadcast processing method and device, storage medium and equipment
CN111083554A (en) Method and device for displaying live gift
CN109819314B (en) Audio and video processing method and device, terminal and storage medium
CN109783176B (en) Page switching method and device
CN111586279B (en) Method, device and equipment for determining shooting state and storage medium
CN108401194B (en) Time stamp determination method, apparatus and computer-readable storage medium
CN107888975B (en) Video playing method, device 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