Video processing method and device, electronic equipment and storage medium

By decoding the target video data packet in the video stream and obtaining the frame ending symbol for frame formation, the video transmission delay problem caused by the FFmpeg frame disassembly method is solved, and more efficient video transmission timeliness is achieved.

CN119835433APending Publication Date: 2025-04-15GREAT WALL MOTOR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411928257.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

In the current stream pulling solution of IP cameras, FFmpeg's frame disassembly method results in a delay of one frame, affecting the real-time nature of video transmission.

Method used

By decoding the target video data packet in the video stream, a frame ending character is obtained, and the original video data is framed based on the frame ending character is used to obtain the frame video data of the target frame, and avoid waiting for the start code of the next frame.

Benefits of technology

It realizes improving the timeliness of video transmission in live broadcast and other scenarios, reducing video delay, and meeting the high demand for real-time streaming.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119835433A_ABST
    Figure CN119835433A_ABST
Patent Text Reader

Abstract

The invention provides a video processing method and device, electronic equipment and a storage medium, the method is applied to the field of computers, and the method comprises the following steps: decoding a target video data packet in a video stream to obtain decoded original video data, and if a frame terminator is obtained in the original video data, sending the decoded original video data to the video stream; and performing framing operation on the original video data based on the frame terminator to obtain frame video data of the target frame. By adopting the mode, the processing of the current frame can be completed without waiting to analyze the start code of the next frame, and the timeliness of video processing can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of video processing, and in particular to a video processing method, device, electronic device and storage medium. Background Art

[0002] In modern society, with the popularity of IP (Internet Protocol) cameras and live broadcasts, the real-time performance of video streaming is becoming increasingly important.

[0003] At present, some common IP camera streaming solutions are through the FFmpeg video framework. FFmpeg's frame splitting method is based on the frame start code to divide each frame of the video stream, that is, FFmpeg detects the start code of the next frame to mark the end of the current frame, that is, finds the start mark position of the next frame to split the video stream. Therefore, the end of the current frame needs to wait for the information of the next frame, which causes a delay of one frame. Summary of the invention

[0004] This application provides a video processing method, device, vehicle and storage medium, aiming to load plug-in resources. The technical solution is as follows:

[0005] In a first aspect, a video processing method is provided, the method comprising:

[0006] Decoding the target video data packet in the video stream to obtain decoded original video data;

[0007] When a frame end mark is obtained from the original video data, a frame grouping operation is performed on the original video data based on the frame end mark to obtain frame video data of a target frame.

[0008] In the above technical solution, a video processing method is proposed, which decodes the target video data packet to obtain the decompressed original video data. The target video data packet can be the data packet currently transmitted in the video stream. If the frame end symbol is obtained in the original video data, it is determined that a complete frame of data can be generated, and the original video data is framed to obtain the frame video data of the target frame. In this way, there is no need to wait for the start code of the next frame to be parsed, which can improve the timeliness of video transmission in scenarios such as live broadcast.

[0009] In combination with the first aspect, in some possible implementations, when a frame terminator is obtained from the original video data, a framing operation is performed on the original video data based on the frame terminator to obtain frame video data of a target frame, including: when a frame terminator is obtained from the original video data, a preset value of the flag is replaced based on the frame terminator to obtain an updated flag; the preset value is used to indicate to continue parsing the current frame video data; the frame terminator is used to indicate to start parsing the next frame video data; and a framing operation is performed on the original video data based on the updated flag to obtain frame video data of the target frame.

[0010] In the above technical solution, a specific use of the frame terminator is specifically proposed. When the frame terminator is obtained from the original video data, the preset value of the flag is replaced by the frame terminator. After the flag is updated, it can be determined that a complete frame is currently read, the currently obtained video data is framed, and the next frame of video data can be parsed. The flag is used to indicate whether to execute the acquisition of the next frame of video data during framing. If the flag is the initial preset value, it indicates that the frame terminator has not been obtained yet, that is, the end position of a frame has not been reached, and the video data needs to continue to be parsed. If the flag is the obtained frame terminator, the currently parsed video data can be framed at this time to obtain the target frame data.

[0011] In combination with the first aspect, in some possible implementations, the method also includes: when the flag bit in the original video data is a preset value, determining the next video data packet of the target video data packet in the video stream as the target video data packet, and proceeding to execute the step of decoding the target video data packet to obtain the decoded original video data until the frame video data of the target frame is obtained.

[0012] In the above technical solution, a specific implementation method is proposed to determine whether to execute the acquisition of the next frame of data according to the flag bit. If the flag bit is the initial preset value, it indicates that the frame end symbol has not been obtained yet, that is, the position of the end of a frame has not been reached, and the video data needs to be further parsed.

[0013] In combination with the first aspect, in some possible implementations, the method further includes: determining whether a preset end character string exists in the original video data; if so, determining the end character string as the frame end mark.

[0014] In the above technical solution, a specific implementation scheme for obtaining a frame end character is specifically proposed. A preset end character string is searched in the parsed original video data to indicate the end of a frame. If an end character string is obtained, it is determined as a frame end character to update the flag.

[0015] In combination with the first aspect, in some possible implementations, the method further includes: determining that the frame end symbol is a start code of a next frame of the target frame.

[0016] In the above technical scheme, a scheme is specifically proposed to use the end mark of the current frame as the start code of the next frame. Usually, the start reading of a frame of data needs to be determined based on the start code. In this scheme, in order to improve the execution speed, after obtaining the end mark of the current frame, the reading of the next frame of video data can be started.

[0017] In combination with the first aspect, in some possible implementations, the target video data packet in the video stream is decoded to obtain decoded original video data, including: determining the encoding format of the video stream; decoding the target video data packet based on a decoder corresponding to the encoding format to obtain decoded original video data.

[0018] In the above technical solution, a specific implementation method of decoding is specifically proposed. By obtaining the encoding format, a decoder is found according to the encoding format, so as to accurately decode the target video data packet based on the encoder.

[0019] In combination with the first aspect, in some possible implementations, when a frame terminator is obtained from the original video data, a framing operation is performed on the original video data based on the frame terminator to obtain frame video data of a target frame, and further includes: transmitting the frame video data of the target frame to a playback terminal so that the playback terminal can play the frame video data of the target frame.

[0020] In the above technical solution, a playback solution is proposed after the target frame video data is generated. The frame video data of the target frame is transmitted to the playback terminal, and it is ensured that the data can be smoothly presented on the playback terminal, so that the playback terminal can smoothly play the frame video data of the target frame, ensure the continuity of the video content and the picture quality, and provide users with a smooth viewing experience.

[0021] In a second aspect, an embodiment of the present specification provides a video processing device, including:

[0022] A decoding unit, used for decoding a target video data packet in a video stream to obtain decoded original video data;

[0023] The determining unit is used for, when a frame end mark is obtained from the original video data, performing a framing operation on the original video data based on the frame end mark to obtain frame video data of a target frame.

[0024] In a third aspect, an embodiment of the present specification provides an electronic device, the electronic device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the steps of the above method are implemented when the computer program is executed by the processor.

[0025] In a fourth aspect, an embodiment of the present specification provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the steps of the above method are implemented. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 is a scene schematic diagram of a video processing method provided in an embodiment of this specification;

[0027] Figure 2 is a flowchart of a video processing method provided by an embodiment of this specification;

[0028] Figure 3 is a flowchart of a video processing method provided by an embodiment of this specification;

[0029] Figure 4 is a structural schematic diagram of a video processing device provided in an embodiment of this specification;

[0030] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION

[0031] The following will be combined with the accompanying drawings to clearly and thoroughly describe the technical solutions in this application. In the description of the embodiments of this specification, unless otherwise specified, " / " means or, for example, A / B can mean A or B: "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of this specification, "multiple" means two or more than two.

[0032] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.

[0033] Figure 1 It is a scene schematic diagram of a video processing method provided in an embodiment of this specification.

[0034] In the related art, the server can process the video stream collected by the video acquisition end through a multimedia processing tool, and send it to the playback terminal for playback. Exemplarily, the video acquisition end can be an IP camera, a digital camera that can transmit and control data through the Internet or a local area network (LAN). It converts the video signal into a digital signal and transmits and remotely accesses it through an IP network (such as Ethernet, Wi-Fi, etc.). The server can perform video decoding operations based on FFmpeg. The start code (for example, 0x000001 or 0x00000001) in the video data is checked to identify the beginning of a new NAL unit, so that the video stream is divided into multiple separate frames. When FFmpeg finds the start code of the next NAL unit, it thinks that the current frame has ended and is ready to parse the next frame. Since FFmpeg judges the end of the current frame by the start code of the next frame, this means that it needs to wait until the start code of the next frame is parsed before it can determine the end time of the current frame, resulting in decoding the current frame.

[0035] Based on the above situation, the embodiment of this specification proposes a video processing method. By parsing the encoded video packet, the frame end symbol of the current frame is read therefrom, which is directly used as the basis for determining the end of the current frame without parsing the start symbol of the next frame, thereby achieving real-time streaming and improving the timeliness of video playback.

[0036] The video processing method provided in this specification is described in detail below in conjunction with specific embodiments.

[0037] Figure 2 FIG. 1 is a flow chart of a video processing method provided in an embodiment of this specification. Figure 2 As shown, the method of the embodiment of this specification may include the following steps S101-S102.

[0038] S101, decoding a target video data packet in a video stream to obtain decoded original video data;

[0039] In one embodiment, the video stream is a continuous data stream that can be played or downloaded in real time. For example, the video stream captured by the vehicle-mounted camera can be transmitted to the central control screen in real time through the network, and the viewer can watch it while the data is being transmitted. The data volume of the video file is very large, and directly transmitting or storing the video file will take up a lot of network bandwidth and storage space. In order to effectively transmit, the video stream is usually compressed and encoded, and the video data can be compressed to a smaller volume. Common video encoding formats include H.264, HEVC (H.265), VP8, VP9, ​​etc. Audio and video data are generally encoded into streams together for transmission.

[0040] A video packet (AVpacket) is a basic data unit that encapsulates compressed data (such as audio and video). It contains multiple types of media data, such as video frames, audio frames, subtitle data, etc. Each packet represents the audio and video encoding data within a time period, usually a fragment in the video or audio encoding stream, and contains complete compressed data. The target video packet can be the current video packet in the video stream, or it can be the first packet in the video stream, depending on actual needs. "Frame offset" usually refers to the offset at the time or byte level, which is used to identify the position of a specific frame in the media stream. Therefore, FFmpeg can be used to obtain the timestamp of AVPacket as the frame offset, and the video packet corresponding to the required frame offset is selected as the target video packet.

[0041] Afterwards, based on the FFmpeg framework, the parse_packet method can be called to decode the packet into the decoded original video data.

[0042] In one embodiment, when a playback terminal (such as a vehicle display screen) has a need to watch a video in real time, it is necessary to obtain data related to the live broadcast from the server, and therefore needs to send a live data acquisition request to the server. Usually, the playback terminal can trigger the live data acquisition request through the control interface in the relevant client, and send the live data acquisition request to the server. The server obtains the video stream captured by the camera and decodes it.

[0043] S102: When a frame terminator is obtained from the original video data, a frame grouping operation is performed on the original video data based on the frame terminator to obtain frame video data of a target frame.

[0044] It is understandable that in H.264 encoding, a video frame is sometimes divided into multiple slices, which can be transmitted through different data packets. ff_combine_frame is a key function in FFmpeg. The received slices are cached inside the ff_combine_frame function until all slices arrive. When all slices arrive, ff_combine_frame performs a merge operation. It is understandable that in the related art, when ff_combine_frame determines whether the data of the current frame has been received, it is determined based on whether the start code of the next frame is obtained. In this solution, it is possible to identify whether there is a frame end mark in the decoded original video data. If there is, the framing operation is performed through ff_combine_frame to obtain the video data of the current frame, that is, the frame video data of the target frame. It is understandable that the original video data may be the last slice data of the target frame, and the frame offset of the target frame needs to be obtained, and the cached original video data corresponding to the frame offset to the frame end mark is used as the frame video data of the target frame.

[0045] Generally speaking, the frame end mark is stored in a specific bit of a byte in the data packet data, and this specific bit is used to identify whether the video frame ends. If the specific bit value that meets the requirements is obtained in the video packet data, it is determined that the frame end mark is obtained.

[0046] In the embodiments of the present specification, the target video data packet is obtained by decoding, and the frame end mark is obtained from the decoded original video data. The frame end mark is used as the basis for determining the end of the current frame without parsing to obtain the start mark of the next frame. The integration of the current frame data can be completed and the pulling of the next frame data can be started, thereby reducing video delay and meeting the demand for streaming with higher real-time requirements.

[0047] Figure 3 FIG. 1 is a flow chart of a video processing method provided in an embodiment of this specification. Figure 3 As shown, the method of the embodiment of this specification may include the following steps S101-S102.

[0048] S201, determining the encoding format of the video stream;

[0049] In one embodiment, since the transmitted video stream may have different encoding formats, in order to accurately and quickly decompress the video data packets in the video stream, it is necessary to determine the encoding format of the video stream (also called video codec format or video compression format). Exemplarily, the -i parameter of ffmpeg can be used to view the detailed information of the video file, including the encoding format.

[0050] S202, decoding the target video data packet based on a decoder corresponding to the encoding format to obtain decoded original video data;

[0051] In one embodiment, a corresponding decoder is found according to the encoding format, and the target video data packet is decoded according to the decoder to obtain decoded original video data. For example, if the encoding format is h264, the corresponding decoder is the H.264 decoder (for example, libx264 in FFmpeg, or a decoder supported by hardware).

[0052] S203, when a frame end character is obtained from the original video data, replacing a preset value of a flag bit based on the frame end character to obtain an updated flag bit;

[0053] In one embodiment, during the video data processing, the state of a specific flag is adjusted by identifying the frame end mark, that is, the flag is changed from a preset value to a frame end mark. The flag needs to be obtained when each frame is processed, and the initial state of the flag is a preset value. The preset value is used to indicate to continue parsing the current frame of video data; the frame end mark is used to indicate to start parsing the next frame of video data. According to the different states of the flag, the function can choose to perform a framing operation and start parsing the next frame of data, or can continue to parse the video data packet.

[0054] Optionally, in one embodiment, the video processing method further includes:

[0055] Determine whether a preset end character string exists in the original video data;

[0056] If so, the end character string is determined as the frame end character.

[0057] Specifically, the frame end character is a preset end string stored in the video data. The frame end character is found by analyzing the array in the original video data and determining whether there is a preset end string therein. In Java, isFrameEnd=buf[1]&0x80==0x80 can be used to determine.

[0058] S204, performing a frame grouping operation on the original video data based on the updated flag bit to obtain frame video data of a target frame;

[0059] Specifically, when performing a framing operation, the flag bit will be judged. If the value of the flag bit is not a preset value but a frame end character, it is determined that the current frame (target frame) ends, and the framing operation can be performed to obtain the frame video data of the target frame.

[0060] It should be noted that in the existing parse_packet method, there is a while loop body, which is used to update the current frame flag according to the start code of the next frame, that is, as the end mark of the current frame. The method provided in the embodiment of this specification can be used to remove the loop body and release the applied memory, thereby reducing memory and CPU usage.

[0061] S205, when the flag bit in the original video data is a preset value, determining the next video data packet of the target video data packet in the video stream as the target video data packet, and switching to the step of decoding the target video data packet to obtain decoded original video data until the frame video data of the target frame is obtained;

[0062] In one embodiment, if the flag is an initial preset value, it indicates that the frame end mark has not been obtained yet, that is, the end position of a frame has not been reached, and the video data needs to be parsed continuously without performing the framing operation. The original video data currently parsed can be cached, and the framing operation can be performed again after the frame end mark is obtained.

[0063] Specifically, the flag bit (mark_flag) is mainly used for a judgment when ff_combine_frame is used to combine frames. Returning the preset value -1 indicates that the processing will continue, otherwise the processing of this packet is over. This judgment is made after executing a system operation such as parse_packet av_parser_parse2 ff_combine_frame, and then judging whether to start the next frame. The specific code is as follows:

[0064] int ff_combine_frame(ParseContext*pc,int next,const uint8_t**buf,int*buf_size)

[0065] { .

[0067] if(!mark_flag){

[0068] return -1; / / Return -1, indicating that processing needs to continue

[0069] }

[0070] / / End, start next frame

[0071] }.

[0072] S206, transmitting the frame video data of the target frame to the playback terminal, so that the playback terminal plays the frame video data of the target frame;

[0073] In one embodiment, after generating the target frame video data, the frame video data of the target frame is transmitted to the playback terminal, and it is ensured that the data can be smoothly presented on the playback terminal, so that the playback terminal can smoothly play the frame video data of the target frame, ensuring the continuity of the video content and the picture quality, and providing users with a smooth viewing experience.

[0074] S207: Determine that the frame end character is a start code of a next frame of the target frame.

[0075] In one embodiment, in order to continuously process the video stream, the currently acquired frame end character is used as the start code of the next frame of the target frame. The start code is used to represent the start position of the frame, thereby realizing the rapid analysis of the next frame of video data.

[0076] In an embodiment of the present specification, by determining the encoding format of the video stream, the target video data packet is decoded based on the decoder corresponding to the encoding format to obtain decoded original video data, when a frame terminator is obtained from the original video data, the preset value of the flag is replaced based on the frame terminator, and a framing operation is performed on the original video data based on the updated flag to obtain frame video data of the target frame, when the flag in the original video data is a preset value, the next video data packet of the target video data packet in the video stream is determined as the target video data packet, and the step of decoding the target video data packet to obtain the decoded original video data is executed until the frame video data of the target frame is obtained, and the frame video data of the target frame is transmitted to a playback terminal so that the playback terminal can play the frame video data of the target frame, and the frame terminator is determined to be the start code of the next frame of the target frame. By obtaining the frame end mark and updating the flag, after the video data packet is parsed, the previously saved flag is directly used as the end mark, and based on the flag, it is determined whether to start the parsing process of the next frame. The offset length of the next frame start code can be removed, reducing the amount of recorded data and achieving efficient video stream processing.

[0077] The following will be combined with the attached Figure 4 , the video processing device provided in the embodiment of this specification is introduced in detail. It should be noted that the attached Figure 4 The video processing device in the embodiment of the present invention is used to execute the video processing device in the embodiment of the present invention. Figure 1-Figure 3 For the convenience of explanation, only the part related to the embodiment of this specification is shown. For the specific technical details not disclosed, please refer to this specification. Figure 1-Figure 3 The embodiment shown.

[0078] See also Figure 4, which shows a schematic diagram of the structure of a video processing device provided by an exemplary embodiment of this specification. The video processing device can be implemented as all or part of the device through software, hardware or a combination of both. The device 1 includes:

[0079] The decoding unit 11 is used to decode the target video data packet in the video stream to obtain decoded original video data;

[0080] The determination unit 12 is configured to, when a frame end mark is obtained from the original video data, perform a framing operation on the original video data based on the frame end mark to obtain frame video data of a target frame.

[0081] Optionally, the determination unit 12 is specifically used for: when a frame end mark is obtained from the original video data, replacing the preset value of the flag bit based on the frame end mark to obtain an updated flag bit; the preset value is used to indicate to continue parsing the current frame video data; the frame end mark is used to indicate to start parsing the next frame video data; based on the updated flag bit, performing a framing operation on the original video data to obtain frame video data of the target frame.

[0082] Optionally, the determination unit 12 is specifically used to: when the flag bit in the original video data is a preset value, determine the next video data packet of the target video data packet in the video stream as the target video data packet, and proceed to execute the step of decoding the target video data packet to obtain the decoded original video data, until the frame video data of the target frame is obtained.

[0083] Optionally, the determination unit 12 is specifically used to: determine whether there is a preset end character string in the original video data; if so, determine the end character string as the frame end mark.

[0084] Optionally, the determination unit 12 is further used to: determine that the frame end symbol is a start code of a next frame of the target frame.

[0085] Optionally, the decoding unit 11 is specifically used to: determine the encoding format of the video stream; and decode the target video data packet based on a decoder corresponding to the encoding format to obtain decoded original video data.

[0086] Optionally, the determination unit 12 is further configured to: transmit the frame video data of the target frame to a playback terminal, so that the playback terminal plays the frame video data of the target frame.

[0087] It should be noted that, when the video processing device provided in the above embodiment executes the video processing method, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the video processing device provided in the above embodiment and the video processing method embodiment belong to the same concept, and the implementation process thereof is detailed in the method embodiment, which will not be repeated here.

[0088] The serial numbers of the embodiments of the present specification are for description only and do not represent the advantages and disadvantages of the embodiments. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0089] The embodiment of the present specification also provides a computer storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the above-mentioned Figure 1-Figure 3 The video processing method of the embodiment shown in the figure can be found in the specific execution process. Figure 1-Figure 3 The specific description of the illustrated embodiment will not be repeated here.

[0090] Please refer to Figure 5 , which shows a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of this specification. The electronic device in this specification may include one or more of the following components: a processor 110, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 110, the memory 120, the input device 130, and the output device 140 may be connected via the bus 150.

[0091] The processor 110 may include one or more processing cores. The processor 110 uses various interfaces and lines to connect various parts of the entire electronic device, and executes various functions and processes data of the terminal 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 120, and calling data stored in the memory 120. Optionally, the processor 110 can be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor 110 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user pages, and applications; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 110, but may be implemented separately through a communication chip.

[0092] The memory 120 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 120 includes a non-transitory computer-readable medium (Non-Transitory Computer-Readable Storage Medium). The memory 120 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The operating system may be an Android system, including a system deeply developed based on the Android system, an IOS system developed by Apple, including a system deeply developed based on the IOS system or other systems.

[0093] The memory 120 can be divided into an operating system space and a user space. The operating system runs in the operating system space, and native and third-party applications run in the user space. In order to ensure that different third-party applications can achieve good operating results, the operating system allocates corresponding system resources to different third-party applications. However, the requirements for system resources in different application scenarios in the same third-party application are also different. For example, in the local processing scenario, the third-party application has higher requirements for disk reading speed; in the animation rendering scenario, the third-party application has higher requirements for GPU performance. The operating system and third-party applications are independent of each other, and the operating system often cannot perceive the current application scenario of the third-party application in a timely manner, resulting in the operating system being unable to perform targeted system resource adaptation according to the specific application scenario of the third-party application.

[0094] In order for the operating system to distinguish the specific application scenarios of third-party applications, it is necessary to open up data communication between third-party applications and the operating system so that the operating system can obtain the current scenario information of third-party applications at any time, and then perform targeted system resource adaptation based on the current scenario.

[0095] The input device 130 is used to receive input commands or data, and includes but is not limited to a keyboard, a mouse, a camera, a microphone, or a touch device. The output device 140 is used to output commands or data, and includes but is not limited to a display device and a speaker. In one example, the input device 130 and the output device 140 can be combined, and the input device 130 and the output device 140 are touch screen displays.

[0096] The touch display screen can be designed as a full screen, a curved screen or a special-shaped screen. The touch display screen can also be designed as a combination of a full screen and a curved screen, or a combination of a special-shaped screen and a curved screen, which is not limited in the embodiments of this specification.

[0097] In addition, those skilled in the art can understand that the structure of the electronic device shown in the above drawings does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown, or combine certain components, or arrange the components differently. For example, the electronic device also includes components such as a radio frequency circuit, an input unit, a sensor, an audio circuit, a WiFi module, a power supply, and a Bluetooth module, which will not be described in detail here.

[0098] exist Figure 5 In the electronic device shown, the processor 110 may be used to call a computer application stored in the memory 120 and specifically perform the following operations:

[0099] Decoding the target video data packet in the video stream to obtain decoded original video data;

[0100] When a frame end mark is obtained from the original video data, a frame grouping operation is performed on the original video data based on the frame end mark to obtain frame video data of a target frame.

[0101] In one embodiment, when the processor 110 obtains a frame end mark from the original video data, and performs a framing operation on the original video data based on the frame end mark to obtain frame video data of a target frame, the processor 110 specifically performs the following operations:

[0102] When a frame end character is obtained from the original video data, a preset value of a flag bit is replaced based on the frame end character to obtain an updated flag bit; the preset value is used to indicate to continue parsing the current frame of video data; the frame end character is used to indicate to start parsing the next frame of video data;

[0103] A frame grouping operation is performed on the original video data based on the updated flag bit to obtain frame video data of a target frame.

[0104] In one embodiment, the processor 110 may further perform the following operations:

[0105] When the flag bit in the original video data is a preset value, the next video data packet of the target video data packet in the video stream is determined as the target video data packet, and the step of decoding the target video data packet is executed to obtain the decoded original video data until the frame video data of the target frame is obtained.

[0106] In one embodiment, the processor 110 may further perform the following operations:

[0107] Determining whether a preset end character string exists in the original video data;

[0108] If so, the end character string is determined as the frame end character.

[0109] In one embodiment, the processor 110 may further perform the following operations:

[0110] The frame end mark is determined to be a start code of a next frame of the target frame.

[0111] In one embodiment, when the processor 110 decodes the target video data packet in the video stream to obtain the decoded original video data, the processor 110 specifically performs the following operations:

[0112] Determining a coding format of the video stream;

[0113] The target video data packet is decoded based on a decoder corresponding to the encoding format to obtain decoded original video data.

[0114] In one embodiment, after the processor 110 performs a framing operation on the original video data based on the frame end mark to obtain the frame video data of the target frame when a frame end mark is obtained from the original video data, the processor 110 further performs the following operations:

[0115] The frame video data of the target frame is transmitted to a playback terminal so that the playback terminal plays the frame video data of the target frame.

[0116] In the embodiment of the present specification, the target video data packet is decoded to obtain the decoded original video data. If the frame end symbol is obtained in the original video data, it is determined that a complete frame of data can be generated, and the original video data is framed to obtain the frame video data of the target frame. In this way, there is no need to wait for the start code of the next frame to be parsed, which can improve the timeliness of video processing in scenarios such as live broadcasting.

[0117] Further, by determining the encoding format of the video stream, the target video data packet is decoded based on the decoder corresponding to the encoding format to obtain the decoded original video data, when the frame terminator is obtained from the original video data, the preset value of the flag bit is replaced based on the frame terminator, and the frame grouping operation is performed on the original video data based on the updated flag bit to obtain the frame video data of the target frame, when the flag bit in the original video data is the preset value, the next video data packet of the target video data packet in the video stream is determined as the target video data packet, and the step of decoding the target video data packet is performed to obtain the decoded original video data until the frame video data of the target frame is obtained, the frame video data of the target frame is transmitted to the playback terminal, so that the playback terminal can play the frame video data of the target frame, and the frame terminator is determined to be the start code of the next frame of the target frame. By obtaining the frame terminator and updating the flag bit, after the video data packet is parsed, the previously saved flag bit is directly used as the terminator, and the parsing process of the next frame is determined based on the flag bit, so that the offset length of the next frame start code can be removed, the amount of recorded data is reduced, and efficient video stream processing is achieved.

[0118] In addition, an embodiment of the present specification provides a computer program product, which includes a computer program. When the computer program is executed by a processor of an electronic device, the processor can at least implement the above-mentioned Figures 1 to 3 The video processing method provided in the illustrated embodiment.

[0119] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the above-mentioned storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0120] The above disclosure is only the preferred embodiment of this specification, which certainly cannot be used to limit the scope of rights of this specification. Therefore, equivalent changes made according to the claims of this specification are still within the scope covered by this specification.

Claims

1. A video processing method, characterized in that: The method comprises: Decoding the target video data packet in the video stream to obtain decoded original video data; When a frame end mark is obtained from the original video data, a frame grouping operation is performed on the original video data based on the frame end mark to obtain frame video data of a target frame.

2. The method according to claim 1, characterized in that When a frame terminator is obtained from the original video data, a frame grouping operation is performed on the original video data based on the frame terminator to obtain frame video data of a target frame, including: When a frame end character is obtained from the original video data, a preset value of a flag bit is replaced based on the frame end character to obtain an updated flag bit; the preset value is used to indicate to continue parsing the current frame of video data; the frame end character is used to indicate to start parsing the next frame of video data; A frame grouping operation is performed on the original video data based on the updated flag bit to obtain frame video data of a target frame.

3. The method according to claim 2, characterized in that The method further comprises: When the flag bit in the original video data is a preset value, the next video data packet of the target video data packet in the video stream is determined as the target video data packet, and the step of decoding the target video data packet is executed to obtain the decoded original video data until the frame video data of the target frame is obtained.

4. The method according to claim 1, characterized in that The method further comprises: Determining whether a preset end character string exists in the original video data; If so, the end character string is determined as the frame end character.

5. The method according to claim 1, characterized in that The method further comprises: The frame end mark is determined to be a start code of a next frame of the target frame.

6. The method according to claim 1, characterized in that The step of decoding the target video data packet in the video stream to obtain decoded original video data includes: Determining a coding format of the video stream; The target video data packet is decoded based on a decoder corresponding to the encoding format to obtain decoded original video data.

7. The method according to claim 1, characterized in that When a frame terminator is obtained from the original video data, after performing a framing operation on the original video data based on the frame terminator to obtain frame video data of a target frame, the method further includes: The frame video data of the target frame is transmitted to a playback terminal so that the playback terminal plays the frame video data of the target frame.

8. A video processing device, characterized in that: The device comprises: A decoding unit, used for decoding a target video data packet in a video stream to obtain decoded original video data; The determining unit is used to perform a framing operation on the original video data based on the frame end mark when a frame end mark is obtained from the original video data, so as to obtain frame video data of a target frame.

9. An electronic device, characterized in that: The electronic device comprises: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the 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 a computer program, and when the computer program is executed, the method according to any one of claims 1 to 7 is implemented.