Video codec dynamic adjustment method, electronic device, medium and video system
By dynamically adjusting the format of the decoder and encoder on the server side of the video system, the problem of low adjustment efficiency of decoder and encoder in the video system in the prior art is solved, and the video fluency and system compatibility are improved.
Patent Information
- Application Number
- CN202411944445.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-04
AI Technical Summary
When existing video systems issue multiple requests at multiple data receiving ends, they cannot effectively adjust the decoder and encoder, resulting in a decrease in video fluency and affecting system compatibility and transmission efficiency.
By implementing a dynamic adjustment method on the server side of the video system, responding to the request information of the receiver, determining the target receiver, and obtaining its supported decoding and encoding format information, unifying the formats of all receivers and sending ends, real-time dynamic switching between different codecs is realized.
Ensures video fluency during codec switching, improves system compatibility and transmission efficiency, and can automatically select compatible codecs when multiple receivers have different decoding capabilities.
Smart Images

Figure CN119767054A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of video data processing, and in particular to a video codec dynamic adjustment method, electronic equipment, medium and video system. Background Art
[0002] With the widespread application of real-time video systems in the fields of remote communication, driving monitoring and security monitoring, system compatibility and network adaptability have become particularly critical. At present, such video systems usually include a data transmitter (such as a vehicle camera), a processing terminal (such as a server) and a data receiver (such as a monitoring display or a large screen). Generally, the decoder and encoder are determined according to the video stream format of the data receiver. When there are multiple data receivers sending multiple requests, the decoder and encoder need to be frequently adjusted according to the video stream format of each data receiver. The video fluency cannot be guaranteed during the switching process, and it will also affect the system compatibility and transmission efficiency. Summary of the invention
[0003] The present invention provides a video codec dynamic adjustment method, electronic equipment, medium and video system to achieve real-time dynamic switching between different codecs, ensure video fluency during codec switching, and improve system compatibility and transmission efficiency.
[0004] According to one aspect of the present invention, a method for dynamically adjusting a video codec is provided, which is applied to a server of a video system, and the method comprises:
[0005] In response to the request information sent by the first receiving end, determining a target receiving end, wherein the target receiving end is determined according to whether the video system has a second receiving end, and the second receiving end is a receiving end other than the first receiving end operated by the video system;
[0006] Obtain target decoding information of the target receiving end, and determine target codec information according to the target decoding information; the target decoding information is used to describe the maximum decoding format information supported by each of the target receiving ends, and the target codec information is used to describe the maximum codec format information commonly supported by all the target receiving ends;
[0007] Sending the target codec information to the target receiving end, so that the target receiving end selects a target decoder according to the target codec information, and uses the target decoder to decode the encoded target video stream;
[0008] The target codec information is sent to the sending end, so that the sending end selects a target encoder according to the target codec information and uses the target encoder to encode the target video stream.
[0009] According to another aspect of the present invention, a video system is provided, the system comprising a sending end, a service end and a receiving end; the service end comprises a receiving end determination module, an information determination module and a sending module;
[0010] The receiving end determination module is used to determine a target receiving end in response to the request information sent by the first receiving end, and the target receiving end is determined according to whether there is a second receiving end in the video system, and the second receiving end is a receiving end other than the first receiving end operated by the video system;
[0011] The information determination module is used to obtain target decoding information of the target receiving end, and determine target codec information according to the target decoding information; the target decoding information is used to describe the maximum decoding format information supported by each of the target receiving ends, and the target codec information is used to describe the maximum codec format information commonly supported by all the target receiving ends;
[0012] The sending module is used to send the target encoding and decoding information to the target receiving end and the sending end;
[0013] The target receiving end is used to select a target decoder according to the target encoding and decoding information, and use the target decoder to decode the encoded target video stream;
[0014] The transmitting end is used to select a target encoder according to the target encoding and decoding information, and use the target encoder to encode the target video stream.
[0015] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0016] at least one processor; and
[0017] a memory communicatively connected to the at least one processor; wherein,
[0018] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the video codec dynamic adjustment method described in any embodiment of the present invention.
[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the video codec dynamic adjustment method described in any embodiment of the present invention when executed.
[0020] The technical solution of the embodiment of the present invention is applied to the server end of the video system, responds to the request information sent by the first receiving end, determines the target receiving end according to whether the video system has a second receiving end, the second receiving end is the other receiving end except the first receiving end running in the video system, so as to unify the decoders of all receiving ends in the future, further obtain the target decoding information of the target receiving end, and determine the target codec information according to the target decoding information; the target decoding information is used to describe the decoding format information with the largest format supported by each target receiving end, and the target codec information is used to describe the codec format information with the largest format supported by all target receiving ends, so as to unify the codec format information, facilitate the selection of the codec, and then send the target codec information to the target receiving end so that the target receiving end can select the target codec according to the target decoding information. The target codec information selects a target decoder, and uses the target decoder to decode the encoded target video stream; the target codec information is sent to the sending end, so that the sending end selects a target encoder according to the target codec information, and uses the target encoder to encode the target video stream, that is, all sending ends and receiving ends of the video system are unified into the same format information, and real-time dynamic switching between different codecs is realized. It can automatically select a compatible codec when the decoding capabilities of multiple receiving ends are different, ensuring the real-time and stability of the video stream. In addition, the codec information is determined at the server end to avoid determining the format information at the receiving end, which affects the video fluency during the switching process, thereby ensuring the video fluency during the codec switching process and improving the system compatibility and transmission efficiency.
[0021] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0023] Figure 1 is a flow chart of a method for dynamically adjusting a video codec provided according to an embodiment of the present invention;
[0024] Figure 2 is a flowchart of another method for dynamically adjusting a video codec provided according to an embodiment of the present invention;
[0025] Figure 3 is a structural schematic diagram of a video system provided according to an embodiment of the present invention;
[0026] Figure 4 It is a structural schematic diagram of an electronic device for implementing the video codec dynamic adjustment method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0028] It should be noted that the terms "first", "second", "target", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] Embodiment 1
[0030] Figure 1 A flowchart of a video codec dynamic adjustment method provided in an embodiment of the present invention. This embodiment can be applied to the situation of dynamically adjusting the codec in an unmanned vehicle video system. The method can be executed by a video codec dynamic adjustment device. The video codec dynamic adjustment device can be implemented in the form of hardware and / or software. The video codec dynamic adjustment device can be configured in any electronic device with network communication function.
[0031] The present invention uses the TCP protocol and the UDP protocol in coordination, that is, the target protocols of the present invention are the TCP protocol and the UDP protocol. The maximum currently supported encoding and decoding format is written in the keep-alive data packet of the TCP protocol, and the currently used codec is written in the extension header (Extension Header) of the UDP protocol. For example, for the receiving end, the maximum currently supported decoding format is written in the keep-alive data packet of the TCP protocol, and the currently used decoder is written in the extension header (Extension Header) of the UDP protocol. For the sending end, the maximum currently supported encoding format information is written in the keep-alive data packet of the TCP protocol, and the maximum format information of the currently used encoder is written in the extension header (Extension Header) of the UDP protocol.
[0032] The following is a detailed description of the TCP protocol and the UDP protocol:
[0033] The TCP protocol packet is designed based on a private keep-alive information data packet. An extended identification bit is added to the header of the keep-alive data packet to identify whether the keep-alive data packet also contains codec switching information.
[0034] The overall format of a TCP data packet is as follows:
[0035] version extend type payload 1 0 / 1 0 / 1
[0036] Field Description:
[0037] version: indicates the version number used by the current protocol, occupies one byte, and is used to prevent version mismatches. extend: indicates the data packet sequence number, occupies one byte, and is used to indicate whether the following value exists. type: occupies one byte, indicating the type of data packet, and its value is 0 or 1, which is used to let the receiving end confirm what form of data packet it is. For example, a value of 0 is a ping packet sent out, and a value of 1 is a pong packet replied by the server. payload: is extended data, which is fixed to 5 bytes. When extend is 0, value does not exist, and when extend is 1, value is 5 direct values.
[0038] The overall format of the payload keep-alive data packet is as follows:
[0039] payload type value 0 / 1 H264
[0040] Payload type: occupies one byte, with a value of 0 or 1, where 0 indicates that the following information is video information; 1 indicates that the following information is audio information.
[0041] value: indicates the maximum supported codec format (for example, when the value is VP8, VP8 and H264 are supported).
[0042] The UDP protocol is a standard extension based on the RTP protocol;
[0043]
[0044] The above is a standard RTP protocol. In the present invention, X (1 bit) is always set to 1, and the currently used codec is filled in the extension header (ExtensionHeader), for example: H264 or VP8 or VP9.
[0045] like Figure 1 As shown, the video codec dynamic adjustment method is applied to the server of the video system. The video codec dynamic adjustment method of the present invention includes the following process:
[0046] S110. In response to the request information sent by the first receiving end, determine a target receiving end, where the target receiving end is determined based on whether there is a second receiving end in the video system, where the second receiving end is another receiving end in the video system except the first receiving end.
[0047] The request information includes an access request or an exit request. The access request may be a request for the first receiving end to access the video system, and the exit request may be a request for the first receiving end to exit the video system.
[0048] Specifically, determining the target receiving end includes: if the video system has a second receiving end, the target receiving end is the first receiving end and the second receiving end; if the video system does not have the second receiving end, the target receiving end is the first receiving end.
[0049] S120, obtaining target decoding information of the target receiving end, and determining target codec information according to the target decoding information; the target decoding information is used to describe the decoding format information with the largest format supported by each target receiving end, and the target codec information is used to describe the codec format information with the largest format commonly supported by all target receiving ends.
[0050] The target decoding information may include an extended data packet carrying an extended header and a keep-alive data packet; the extended data packet is used to record the format information of the decoder currently used by the target receiving end; the keep-alive data packet is used to record the maximum decoding format information that the target receiving end can support. The target decoding information is the information sent by the target receiving end to the server.
[0051] The target codec information can be understood as the format information to which the decoder at the receiving end and the encoder at the sending end are uniformly adjusted, that is, the formats of the decoder and the encoder are unified; for example, if the target codec information is H265, the format information of the decoder at the receiving end and the encoder at the sending end should both be H265.
[0052] Specifically, by analyzing the keep-alive data packets in the target decoding information, the decoding format information with the largest format currently supported by all target receiving ends can be known, and the format is used as the target coding and decoding information.
[0053] In this embodiment, the server may optionally include a codec selection list; the codec selection list is a list that sorts format information supported by all codecs from large to small. Accordingly, determining the target codec information according to the target decoding information includes: traversing all target decoding information according to the codec selection list to determine the target codec information.
[0054] Specifically, the target decoding information is sequentially judged according to the codec selection list whether the target receiving end supports all the reference format information, thereby determining the target codec information, as follows:
[0055] Determine the reference format information of the current judgment round. The reference format information is updated downward one by one starting from the format information of the first column of the codec selection list. That is, during the first judgment, the reference format information is the format information corresponding to the first column of the codec selection list. During the second judgment, the reference format information is the format information corresponding to the second column of the codec selection list, and so on, until the last column is judged, that is, the reference format information is the format information of the reference column in the codec selection list, and the value of the reference column is the value of the current judgment round.
[0056] If the target receiving end fully supports the reference format information, the reference format information is used as the target codec information; if the target receiving end does not fully support the reference format information, the reference format information is updated to determine whether the target receiving end fully supports the updated reference format information, until the target receiving end fully supports the reference format information, the reference format information is used as the target codec information, or, if the reference format information is updated to the format information corresponding to the last column of the codec selection list, the format information corresponding to the last column of the codec selection list is used as the target codec information.
[0057] It should be noted that the sending end of the present invention will also send an extended data packet carrying an extended header to the server end, so that the server end can determine whether it is necessary to switch the encoder of the sending end.
[0058] Furthermore, if all target receiving ends support the reference format information, the reference format information is used as the target codec information, and further determines whether the format information of the extended data packet of the sending end is consistent with the format information of the target codec information. If they are consistent, the server sends information not to switch the encoder to the sending end, that is, the sending end does not need to switch the encoder. If they are inconsistent, the server sends information to switch the encoder according to the target codec information. For example, Figure 2 As shown, if all target receiving ends support H265, it is determined whether the sending end is H265. If so, the sending end does not switch the encoder. If not, the sending end switches to the H265 encoder.
[0059] The method for judging whether the target receiving end fully supports the reference format information is as follows: traverse each target decoding information, and if the format information commonly supported by each target decoding information is consistent with the reference format information, it means that the target receiving end fully supports the reference format information.
[0060] Optionally, the formats in the codec selection list include H265, VP9, VP8 and H264. And the order of the format information in the codec selection list is H265, VP9, VP8 and H264. For example, Figure 2 As shown, it is determined one by one according to the codec selection list whether the target receiving end supports all the reference format information, so as to determine the target codec information, specifically including: traversing and querying one by one in the order of H265, VP9, VP8 and H264, until it is determined that the supported format information corresponding to all target receiving ends is consistent with any one of H265, VP9, VP8 and H264, then the corresponding format information is used as the target codec information.
[0061] The technical solution of this embodiment determines the target codec information on the server side, so that the transmitter and receiver can quickly switch the encoder and decoder according to the target codec information, realize timely switching of the encoder, ensure the real-time and stability of the video stream, and greatly improve the efficiency of the unmanned vehicle operation.
[0062] In addition, the unmanned vehicle of the present invention pushes H265 encoded video data by default to reduce traffic costs.
[0063] S130, sending the target codec information to the target receiving end, so that the target receiving end selects a target decoder according to the target codec information, and uses the target decoder to decode the encoded target video stream.
[0064] Specifically, the server sends the target codec information to the target receiving end, and the target receiving end can select the target decoder according to the target codec information, so that the video system can automatically select a compatible decoder when the decoding capabilities of multiple receiving ends are different, thereby ensuring the real-time and stability of the video stream.
[0065] S140, sending the target codec information to the sending end, so that the sending end selects a target encoder according to the target codec information, and uses the target encoder to encode the target video stream.
[0066] Specifically, the server sends the target codec information to the sender so that the sender selects the target encoder according to the target codec information to ensure that the encoding format of the target video stream sent to the receiving end is consistent with the decoding format of the receiving end, thereby improving the efficiency of video processing and ensuring the real-time and stability of the video stream.
[0067] The technical solution of the embodiment of the present invention is applied to the server end of the video system, responds to the request information sent by the first receiving end, determines the target receiving end according to whether the video system has a second receiving end, the second receiving end is the other receiving end except the first receiving end running in the video system, so as to unify the decoders of all receiving ends in the future, further obtain the target decoding information of the target receiving end, and determine the target codec information according to the target decoding information; the target decoding information is used to describe the decoding format information with the largest format supported by each target receiving end, and the target codec information is used to describe the codec format information with the largest format supported by all target receiving ends, so as to unify the codec format information, facilitate the selection of the codec, and then send the target codec information to the target receiving end so that the target receiving end can select the target codec according to the target decoding information. The target codec information selects a target decoder, and uses the target decoder to decode the encoded target video stream; the target codec information is sent to the sending end, so that the sending end selects a target encoder according to the target codec information, and uses the target encoder to encode the target video stream, that is, all sending ends and receiving ends of the video system are unified into the same format information, and real-time dynamic switching between different codecs is realized. It can automatically select a compatible codec when the decoding capabilities of multiple receiving ends are different, ensuring the real-time and stability of the video stream. In addition, the codec information is determined at the server end to avoid determining the format information at the receiving end, which affects the video fluency during the switching process, thereby ensuring the video fluency during the codec switching process and improving the system compatibility and transmission efficiency.
[0068] Embodiment 2
[0069] The technical solution of this embodiment is based on the above embodiment, and describes in detail the detailed measures taken by the target receiving end after sending the target codec information to the target receiving end. That is, the process of selecting the target decoder according to the target codec information and using the target decoder to decode the encoded target video stream is described in detail. This embodiment can be combined with each optional solution in one or more of the above embodiments. All receiving ends support at least H264.
[0070] In this embodiment, the target receiving end selects a target decoder according to the target codec information, and uses the target decoder to decode the encoded target video stream, including: the target receiving end uses the decoder with the same decoding format information as the target codec information as the target decoder. After receiving the encoded target video stream, the target receiving end determines that the old data packets in the cache queue cannot form a complete video packet, and then clears the cache queue. When the target decoder of the target receiving end decodes the encoded target video stream, if it receives a video frame data packet of the target video stream encoded by the original encoder, the video frame data packet is deleted. Among them, the video frame data packet is at least one data packet contained in the target video stream, and is a data packet lost during the transmission of the target video stream.
[0071] Specifically, the target video stream is encoded by the sending end and sent to the server end. After the server end detects the application of the receiving end for the target video stream, the server end is responsible for sending the target video stream to the receiving end. If the video frame data packet is lost in the process of the server end sending the target video stream to the receiving end, the receiving end will send the information of the video frame data packet loss to the server end, and request the information of sending the video frame data packet, and confirm the target video stream with the lost data packet as the reference video stream, and put the reference video stream in the cache list;
[0072] Further, when the server sends the video frame data packet again, if the decoder of the receiving end switches, that is, the encoding format of the target video stream changes, the receiving end will receive the target video stream with the changed encoding format. At this time, the reference video stream in the cache list cannot form a complete video packet, so the reference video stream in the cache queue is cleared;
[0073] In the process of decoding the target video stream after the coding format is changed, a video frame data packet of the original coding format may be received, that is, a video frame data packet corresponding to the reference video stream. This data packet is no longer useful, so it is deleted.
[0074] The operation process of the receiving end of the present invention may be:
[0075] 1. After the receiving end is started, it collects the decoding capabilities it can support. After the collection is completed, it writes the maximum supported codec format into the keep-alive data packet of this protocol and sends it to the server.
[0076] 2. The receiving end initializes and starts all supported decoders at the same time and waits for calls.
[0077] 3. After receiving the target codec information selected by the server, the receiving end puts the corresponding decoder that has been started in item 2 as the currently used decoder and waits for the target video stream to be decoded.
[0078] 4. If the decoding operation starts after receiving the video stream of the new encoder, if the video stream encoded by the old encoder is also received at this time, it will be abandoned directly.
[0079] 5. The information of the new and old encoders / decoders in Article 4 is judged by the content of the extension header in the RTP protocol.
[0080] 6. After receiving the video stream using the new encoder, if the old video stream in the original cache queue still cannot form a complete video package, the buffer queue will be cleared directly to prevent the video from being stuck.
[0081] In the technical solution of this embodiment, the target receiving end uses the decoder with the same decoding format information as the target codec information as the target decoder. After receiving the encoded target video stream, the target receiving end determines that the old data packets in the cache queue cannot form a complete video packet, and then clears the cache queue to prevent the video from freezing. When the target decoder of the target receiving end decodes the encoded target video stream, if it receives the video frame data packet of the target video stream encoded by the original encoder, and the video frame data is no longer useful, the video frame data packet is deleted to avoid occupying space and improve the operating efficiency of the unmanned vehicle.
[0082] Embodiment 3
[0083] The technical solution of this embodiment is based on the above embodiment, and describes in detail the detailed measures taken by the receiving end after sending the target codec information to the receiving end. That is, the process of selecting the target encoder according to the target codec information and using the target encoder to encode the target video stream is described in detail. This embodiment can be combined with each optional solution in one or more of the above embodiments.
[0084] In this embodiment, the sending end selects a target encoder according to the target codec information, and uses the target encoder to encode the target video stream, including: the sending end selects an encoder with the same encoding format information as the target codec information as the target encoder. The sending end encodes the first video frame of the target video stream into a key frame, obtains the encoded target video stream, and sets the extended header in the RTP to the encoding format information of the target encoder when the encoded target video stream is packaged and sent to the server.
[0085] The operation process of the sending end of the present invention may be:
[0086] On the sending end device, the switching of the encoder requires the ability to adjust in real time. After the encoder is switched, the sending end needs to encode the first frame of the video stream into a key frame. The specific process is as follows:
[0087] 1. Initialize and start all encoders, fill the maximum format information supported by the encoder into the keep-alive data packet of the TCP protocol, and fill the format information of the encoder currently executing the encoding task into the extension header of the UDP protocol, and send them to the server accordingly.
[0088] 2. After receiving the target codec information selected by the server, the sender sets the encoder corresponding to the target codec information as the currently used target encoder.
[0089] 3. After setting the currently used target encoder, encode the first video frame of the target video stream into a key frame.
[0090] 4. After the key frame is encoded, when it is packaged and sent, the extended header in RTP is set to the encoding format information of the target encoder.
[0091] 5. Wait for the server to notify the next encoder adjustment.
[0092] In the technical solution of this embodiment, the sending end selects the encoder with the same encoding format information as the target encoder in the target encoding and decoding information. The sending end encodes the first video frame of the target video stream into a key frame, obtains the encoded target video stream, and sets the extended header in RTP to the encoding format information of the target encoder when the encoded target video stream is packaged and sent to the server. That is, the target encoding and decoding information can be used to achieve fast and accurate switching of the encoder, solving the problem that the encoder at the sending end cannot be switched in time. In addition, the encoding format information of the target encoder is set in the extended header in RTP, which can let the server know the format information of the encoder currently encoding more quickly, so as to be able to judge more quickly with the target encoding and decoding information whether to execute the encoder switching, which can ensure the accuracy of the switching and ensure real-time switching to the optimal encoder, greatly improving the efficiency of the unmanned vehicle operation.
[0093] Embodiment 4
[0094] Figure 3 FIG. 1 is a schematic diagram of a structure of a video system provided by an embodiment of the present invention. This embodiment is applicable to the case of dynamically adjusting the codec in the video system. Figure 3 As shown, the video system 21 includes a transmitter 210, a server 220 and a receiver 230; the server includes a receiver determination module 2201, an information determination module 2202 and a transmitter module 2203. The server of the video system of this embodiment executes the video codec dynamic adjustment method of the present invention.
[0095] The receiving end determination module 2201 is used to determine a target receiving end in response to the request information sent by the first receiving end, and the target receiving end is determined according to whether there is a second receiving end in the video system, and the second receiving end is a receiving end other than the first receiving end running in the video system;
[0096] The information determination module 2202 is used to obtain target decoding information of the target receiving end, and determine target codec information according to the target decoding information; the target decoding information is used to describe the maximum decoding format information supported by each of the target receiving ends, and the target codec information is used to describe the maximum codec format information commonly supported by all the target receiving ends;
[0097] The sending module 2203 is used to send the target codec information to the target receiving end and the sending end;
[0098] The target receiving end 230 is used to select a target decoder according to the target encoding and decoding information, and use the target decoder to decode the encoded target video stream;
[0099] The transmitting end 210 is used to select a target encoder according to the target encoding and decoding information, and use the target encoder to encode the target video stream.
[0100] Optionally, the receiving end determination module is further used to: if the second receiving end exists, the target receiving end is the first receiving end and the second receiving end; if the second receiving end does not exist, the target receiving end is the first receiving end.
[0101] Optionally, the server includes a codec selection list; the codec selection list is a list in which supported formats of all codecs are sorted from largest to smallest.
[0102] Optionally, the information determination module is further configured to traverse all the target decoding information according to the codec selection list to determine the target codec information.
[0103] Optionally, the target receiving end uses a decoder with the same decoding format information as the target codec information as the target decoder; after receiving the encoded target video stream, it is determined that the old data packets in the cache queue cannot form a complete video packet, and the cache queue is cleared; when the target decoder decodes the encoded target video stream, if it receives a video frame data packet of the target video stream encoded by the original encoder, the video frame data packet is deleted.
[0104] Optionally, the sending end is used to select an encoder with the same encoding format information as the target encoding and decoding information as the target encoder; encode the first video frame of the target video stream into a key frame, obtain the encoded target video stream, and when the encoded target video stream is packaged and sent to the server, set the extended header in RTP to the encoding format information of the target encoder.
[0105] Optionally, the formats in the codec selection list include H265, VP9, VP8 and H264.
[0106] The video system of the technical solution of this embodiment includes a sending end, a server end and a receiving end; the server end includes a receiving end determination module, an information determination module and a sending module, the target receiving end is determined by the receiving end determination module, the information determination module obtains the target decoding information of the target receiving end, and determines the target codec information according to the target decoding information; the target codec information is used to describe the codec format information with the largest format that is commonly supported by all target receiving ends; the target codec information is sent to the target receiving end and the sending end through the server end, thereby realizing real-time dynamic switching between different codecs, ensuring the video fluency during the codec switching process, and improving the system compatibility and transmission efficiency.
[0107] Embodiment 5
[0108] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0109] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0110] like Figure 4As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0111] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0112] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as a video codec dynamic adjustment method.
[0113] In some embodiments, the video codec dynamic adjustment method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the video codec dynamic adjustment method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the video codec dynamic adjustment method in any other appropriate manner (e.g., by means of firmware).
[0114] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0115] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0116] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0117] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0118] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0119] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0120] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0121] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for dynamically adjusting a video codec, characterized in that: Applied to the server of a video system, the method comprises: In response to the request information sent by the first receiving end, determining a target receiving end, wherein the target receiving end is determined according to whether the video system has a second receiving end, and the second receiving end is a receiving end other than the first receiving end operated by the video system; Obtain target decoding information of the target receiving end, and determine target codec information according to the target decoding information; the target decoding information is used to describe the maximum decoding format information supported by each of the target receiving ends, and the target codec information is used to describe the maximum codec format information commonly supported by all the target receiving ends; Sending the target codec information to the target receiving end, so that the target receiving end selects a target decoder according to the target codec information, and uses the target decoder to decode the encoded target video stream; The target codec information is sent to the sending end, so that the sending end selects a target encoder according to the target codec information and uses the target encoder to encode the target video stream.
2. The method according to claim 1, characterized in that Determine the target receiving end, including: If the video system has the second receiving end, the target receiving end is the first receiving end and the second receiving end; If the second receiving end does not exist in the video system, the target receiving end is the first receiving end.
3. The method according to claim 1, characterized in that The server includes a codec selection list; the codec selection list is a list in which format information supported by all codecs is sorted from largest to smallest.
4. The method according to claim 3, characterized in that Determining target encoding and decoding information according to the target decoding information includes: All the target decoding information are traversed according to the codec selection list to determine the target codec information.
5. The method according to claim 1, characterized in that: The target receiving end selects a target decoder according to the target encoding and decoding information, and uses the target decoder to decode the encoded target video stream, including: The target receiving end uses a decoder having the same decoding format information as that in the target codec information as a target decoder; After receiving the encoded target video stream, the target receiving end determines that the old data packets in the cache queue cannot form a complete video packet, and then clears the cache queue; When the target decoder of the target receiving end decodes the encoded target video stream, if it receives the video frame data packet of the target video stream encoded by the original encoder, it deletes the video frame data packet.
6. The method according to claim 1, characterized in that The transmitting end selects a target encoder according to the target encoding and decoding information, and uses the target encoder to encode the target video stream, including: The transmitting end selects an encoder having the same encoding format information as that in the target encoding and decoding information as a target encoder; The sending end encodes the first video frame of the target video stream into a key frame, obtains the encoded target video stream, and when the encoded target video stream is packaged and sent to the server, the extended header in RTP is set to the encoding format information of the target encoder.
7. The method according to claim 3, characterized in that The format information in the codec selection list includes H265, VP9, VP8 and H264.
8. A video system, characterized in that: The system includes a sending end, a service end and a receiving end; the service end includes a receiving end determination module, an information determination module and a sending module; The receiving end determination module is used to determine a target receiving end in response to the request information sent by the first receiving end, and the target receiving end is determined according to whether there is a second receiving end in the video system, and the second receiving end is a receiving end other than the first receiving end operated by the video system; The information determination module is used to obtain target decoding information of a target receiving end, and determine target encoding and decoding information according to the target decoding information; The target decoding information is used to describe the maximum decoding format information supported by each of the target receiving ends, and the target coding and decoding information is used to describe the maximum coding and decoding format information commonly supported by all the target receiving ends; The sending module is used to send the target encoding and decoding information to the target receiving end and the sending end; The target receiving end is used to select a target decoder according to the target encoding and decoding information, and use the target decoder to decode the encoded target video stream; The transmitting end is used to select a target encoder according to the target encoding and decoding information, and use the target encoder to encode the target video stream.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the video codec dynamic adjustment method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the video codec dynamic adjustment method according to any one of claims 1 to 7 when executed.