Method, device, apparatus and computer-readable medium for processing video
By selectively sending images or splitting video frames according to image changes in video live broadcast, and creating data packets with audio and timestamps, the problem of wasting bandwidth resources of video live broadcast is solved and the user experience is improved.
Patent Information
- Application Number
- CN201910994382.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-18
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2039-10-18
AI Technical Summary
While ensuring the quality of video, the prior art is difficult to save bandwidth resources, resulting in a decline in user viewing experience when multiple users compete for bandwidth and traffic.
By determining whether the video image changes within the preset time period, if it has not changed, select one or more frames of images to combine audio and timestamp to create data packets; if it changes, divide the video into preset number of frame images to combine audio and time Stick to create a packet, store and send a packet.
It realizes the use of bandwidth resources while ensuring the quality of video, avoids the quality decline caused by excessive compression ratio during live video broadcast, and improves the user's viewing experience.
Smart Images

Figure CN112689158B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and computer-readable medium for processing video. Background Art
[0002] Live video is becoming more and more integrated into our daily lives. With the improvement of camera pixels, high-quality live video is imminent. High-definition video requires greater bandwidth and traffic carrying capacity, but bandwidth and traffic are limited. Multiple users competing for limited bandwidth and traffic will greatly reduce the user's viewing experience.
[0003] Therefore, for live video broadcasts, the only way to meet user needs is to continuously increase the video compression ratio. However, video quality and compression ratio are negatively correlated. The higher the compression ratio, the less likely the video quality will be guaranteed.
[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art: in order to ensure the video quality, more bandwidth resources need to be occupied. Summary of the invention
[0005] In view of this, embodiments of the present invention provide a method, apparatus, device and computer-readable medium for processing a video, which can ensure video quality and save bandwidth resources.
[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for processing a video is provided, comprising:
[0007] Receiving collected video;
[0008] Determining whether an image in the video changes within a preset time period;
[0009] If the image in the video does not change within a preset time period, one or more frames of the image are selected from the video, and combined with the audio and timestamp of the video to create a data packet of the video;
[0010] If the image in the video has changed within a preset time period, the video is divided into a preset number of frames, and a data packet of the video is established by combining the audio and timestamp of the video;
[0011] A data packet storing the video.
[0012] The determining whether the image in the video has changed includes:
[0013] The video is encoded, and encoding results of different image frames of the video are compared to determine whether an image in the video has changed.
[0014] Determining whether the image in the video changes within a preset time period includes:
[0015] Within a time period determined by a preset live broadcast delay, determine whether an image in the video changes.
[0016] After storing the data packet of the video, the method further comprises:
[0017] Receive a request for obtaining the video sent by a client, where the request for the video includes a sequence number of a most recent request for the video by the client;
[0018] According to the sequence number, obtain the data packet corresponding to the next sequence number of the sequence number;
[0019] Send the corresponding next video data packet.
[0020] The step of selecting one or more frames of images from the video comprises:
[0021] One or more frames of images are selected from the video in time sequence.
[0022] The step of dividing the video into a preset number of frame images comprises:
[0023] According to the preset live broadcast delay and human eye video frame rate, the video is divided into a preset number of frame images.
[0024] According to a second aspect of an embodiment of the present invention, there is provided a device for processing a video, comprising:
[0025] A receiving module, used for receiving the collected video;
[0026] A determination module, used to determine whether the image in the video changes within a preset time period;
[0027] A processing module, configured to select one or more frames of images from the video if the image in the video does not change within a preset time period, and to create a data packet of the video in combination with the audio and timestamp of the video;
[0028] If the image in the video has changed within a preset time period, the video is divided into a preset number of frames, and a data packet of the video is established by combining the audio and timestamp of the video;
[0029] The storage module is used to store the data packets of the video.
[0030] The determination module is specifically used to encode the video, compare the encoding results of different image frames of the video, and determine whether the image in the video has changed.
[0031] According to a third aspect of an embodiment of the present invention, there is provided an electronic device for processing a video, comprising:
[0032] one or more processors;
[0033] a storage device for storing one or more programs,
[0034] When the one or more programs are executed by the one or more processors, the one or more processors implement the above method.
[0035] According to a fourth aspect of an embodiment of the present invention, there is provided a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, the method as described above is implemented.
[0036] One embodiment of the above invention has the following advantages or beneficial effects: because the captured video is received; different technical solutions can be executed according to whether the image in the video has changed. If the image in the video has not changed within a preset time period, one or more frames of images are selected from the video, and a video data packet is established in combination with the audio and timestamp of the video; if the image in the video has changed within a preset time period, the video is cut into a preset number of frames of images, and a video data packet is established in combination with the audio and timestamp of the video; the video data packet is stored. It can be seen that regardless of whether the image in the video has changed, all captured videos do not need to be sent. Images can be selectively sent in the captured video, thereby improving video quality while saving bandwidth resources.
[0037] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0039] Figure 1 is a schematic diagram of a scene for processing a video according to an embodiment of the present invention;
[0040] Figure 2 is a schematic diagram of the main flow of a method for processing a video according to an embodiment of the present invention;
[0041] Figure 3 is another schematic diagram of a scene for processing a video according to an embodiment of the present invention;
[0042] Figure 4 is a schematic diagram of a process of requesting a video according to an embodiment of the present invention;
[0043] Figure 5 is a schematic diagram of the main structure of a device for processing video according to an embodiment of the present invention;
[0044] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0045] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0046] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0047] During live video streaming, the bandwidth and traffic are limited, so in order to improve the user's viewing experience, the video compression ratio is constantly increased. However, the increase in compression ratio makes it difficult to guarantee video quality.
[0048] Video live streaming has a wide range of application scenarios, such as unmanned warehouse monitoring, computer room monitoring, etc. In the above application scenarios, the video itself changes little during the monitoring time, or even remains unchanged for a long time, but live streaming is still achieved by compressing the video, which occupies a lot of bandwidth. Therefore, in order to ensure video quality, a lot of bandwidth resources are wasted.
[0049] In order to solve the technical problem of difficulty in ensuring video quality and wasting bandwidth resources, the following technical solution in the embodiment of the present invention can be adopted.
[0050] See also Figure 1 , Figure 1 1 is a schematic diagram of a video processing scenario according to an embodiment of the present invention, which includes a video source, a video server, a computer and a mobile terminal.
[0051] The video source is a device used to capture video. As an example, the video source can be a high-definition camera, a high-definition video camera, or a mobile phone camera. The video source sends the captured video to the video server for processing and storage.
[0052] The video server is coupled to the video source. The video source can send the collected video to the video server via wireless transmission, such as WiFi, or wired transmission, such as optical fiber. It is understandable that the video sent by the video source to the video server is not processed by the video source.
[0053] The video server is used to process and save the video sent by the video source. In actual applications, the video server can process the received video according to actual needs. The video server is coupled with the computer and the mobile terminal.
[0054] The video server can receive a video request sent by a computer or a mobile terminal, and in response to the video request, feed back a corresponding video to the computer or the mobile terminal.
[0055] It should be noted that the video server can be specifically divided into one or more sub-servers to achieve the above functions.
[0056] See also Figure 2 , Figure 2 Schematic diagram of the main flow of the method for processing video according to an embodiment of the present invention. Within a preset time period, based on whether the image in the video changes, the video is processed accordingly and a video data packet is established, thereby saving bandwidth resources while ensuring the video quality. Figure 2 As shown, the specific steps include:
[0057] S201, receiving collected video.
[0058] The video source can send the collected video to the video server. The video server processes the received collected video accordingly. Figure 2 The execution subject of each step may be a video server.
[0059] As an example, a video source may be set in a warehouse to monitor the goods stored in the warehouse. Then, the captured video may be the video in the warehouse. As another example, a video source may be set in a computer room to monitor the equipment in the computer room. Then, the captured video may be the video in the computer room.
[0060] It is understandable that the received collected videos include videos in multiple scenes. After receiving the collected videos, the collected videos may also be stored. As an example, the collected videos are stored according to the time when the collected videos are received. As another example, the collected videos may also be stored according to the time when the videos are collected. Of course, the collected videos may also be stored in other ways.
[0061] S202: Determine whether the image in the video changes within a preset time period.
[0062] A time period can be preset, and within the preset time period, it is determined whether the image in the video has changed. As an example, in a residential surveillance video, the preset time period is from 13:00 to 13:15 at noon. Within the above preset time period, it is determined whether the image in the video has changed to determine whether it is necessary to call security guards to patrol on site.
[0063] In the embodiment of the present invention, an exemplary description may be given by taking the case where the time period is specifically determined by the live broadcast delay as an example.
[0064] During the live video broadcast, due to network or server issues, the video source may not be able to send the video directly to the client. The time between the time the client receives the video and the time the video source uploads the video is called latency.
[0065] In the embodiment of the present invention, the live broadcast delay can be preset according to the actual situation and / or the working state of the device. As an example, the live broadcast delay can be equal to 2 seconds.
[0066] Specifically, a video is composed of multiple frames of images. Within the preset live broadcast delay, different technical solutions can be adopted based on whether each frame of the image changes.
[0067] The following technical solution can be used to determine whether the image in the video has changed.
[0068] In one embodiment of the present invention, the video may be encoded first, and each frame of the video has a corresponding encoding result. By comparing the encoding results of different image frames, it is determined whether the image in the video has changed. Among them, any of the following encoding methods can be used: H.261, H.263, H.264, M-JPEG and MPEG.
[0069] If the encoding results of different image frames are inconsistent, it is determined that the image in the video has changed; if the encoding results of different image frames are consistent, it is determined that the image in the video has not changed.
[0070] See also Figure 3 , Figure 3 This is another schematic diagram of a video processing scenario according to an embodiment of the present invention, which specifically includes: a video source, a video encoding server, a video time server, a video file server and a client.
[0071] The video encoding server can be used to encode the video collected by the video source. And send the encoded video to the video event server. The video event server compares the encoding results of different image frames to determine whether the image in the video has changed. Then, the video data table is stored in the video file server, and the video data packet is sent to the client.
[0072] In one embodiment of the present invention, the video may be split into multiple frames, each frame is converted into a grayscale image, the grayscale image of each frame is subtracted from the grayscale image of the first frame, and whether the image in the video has changed is determined based on whether the subtraction result is zero.
[0073] If the result of subtracting the grayscale image of each frame image from the grayscale image of the first frame image is zero, the image in the video has not changed; if the result of subtracting the grayscale image of each frame image from the grayscale image of the first frame image is not zero, the image in the video has changed.
[0074] Considering that in actual applications, even if the image has not changed, the grayscale image subtraction result of the two frames of images that have not actually changed will not be zero due to the change in the irradiation light. Therefore, the proportion of grayscale image subtraction results being zero can be preset. When the proportion of grayscale image subtraction results of two frames of images in a video that are zero exceeds the preset proportion, it is considered that the image in the video has not changed; when the proportion of grayscale image subtraction results of two frames of images in a video that are zero does not exceed the preset proportion, it is considered that the image in the video has changed.
[0075] In the embodiment of the present invention, other methods may also be used to determine whether the image in the video has changed.
[0076] The video event meter can be used to determine whether the image in the video has changed. Exemplarily, the video event meter is a software based on real-time video image analysis, which can identify moving objects in real-time video. For example, it can be determined whether there are people walking in the video. If a moving object appears in the video, it is determined that the image in the video has changed; if no moving object appears in the video, it is determined that the image in the video has not changed.
[0077] S203: If the image in the video does not change within a preset time period, one or more frames of images are selected from the video, and a data packet of the video is established by combining the audio and timestamp of the video.
[0078] In one embodiment of the present invention, if the image in the video does not change within a preset time period, one or more frames of images may be selected from the video. The purpose of selecting the image is to replace the video.
[0079] If the image in the video does not change within the preset time period, it means that each frame of the video is almost the same. Sending a video means sending multiple frames of images included in the video. If the image in the video does not change, it means that the multiple frames of images sent are the same. Sending the same multiple frames of images through limited bandwidth resources is undoubtedly a waste of bandwidth resources. Then, one or more frames of images can replace the video.
[0080] In one embodiment of the present invention, if the image in the video does not change within a preset time period, one or more frames of images may be selected from the video in chronological order. One frame of image may be selected from the video in chronological order. In another embodiment, multiple frames of image may be selected from the video in chronological order. As an example, the first frame of image of the video and the second frame of image of the video may be selected.
[0081] The video file includes not only multiple frames of images but also audio. After receiving the video, the client will play it in combination with the multiple frames of images and audio in the video. In order to avoid wasting bandwidth resources, one or more frames of images can be selected from the video, combined with the audio and timestamp of the video, to create a data packet of the video.
[0082] As an example, although the image in the video has not changed, one or more frames of images can be selected from the video to replace the video, but the video needs to be played on the client. Then, the video data packet can be established by combining the one or more frames of images selected from the video, the audio and timestamp of the video.
[0083] The timestamp is the correspondence between the audio of the video and the time point. At the time point involved in the timestamp, the audio corresponding to the video is played according to the above time point, and one or more frames of images selected from the video are displayed on the client.
[0084] Compared with the video itself, the data packet of the video only includes one or more frames of images selected from the video, the audio of the video and the timestamp. The data volume of the data packet of the video is much smaller than the data volume of the video itself.
[0085] S204: If the image in the video has changed within a preset time period, the video is divided into a preset number of image frames, and a data packet of the video is created by combining the audio and time stamp of the video.
[0086] If it is determined that the image in the video has changed within a preset time period, the video can be divided into a preset number of frame images, and the preset number of frame images obtained by the above segmentation are combined with the audio and timestamp of the video to create a video data packet.
[0087] In order to reduce the amount of data sent by the video, the video can be segmented into a preset number of frame images, and the preset number of frame images obtained by segmentation are used to replace the video, and the audio and timestamp of the video are combined to create a data packet of the video.
[0088] In one embodiment of the present invention, the video frame rate is used to measure the number of displayed frames. The unit of measurement of the video frame rate is the number of displayed frames per second. Due to the special physiological structure of the human eye, if the frame rate of the video being viewed is higher than 16, it will be considered to be coherent. In other words, when the frame rate of the video is higher than 16, the image being viewed can be considered to be a video.
[0089] In the preset time period, it is determined that the image in the video has changed. In order to save bandwidth resources, it is not necessary to send all the images in the video to the client. Considering the limitation of the human eye video frame rate, the human eye video frame rate is the highest frame rate of the video viewed by the human eye. When the video frame rate is higher than the human eye video frame rate, the human eye can hardly perceive the increase of the video frame rate; when the video frame rate is lower than the human eye video frame rate, the human eye can easily perceive the decrease of the video frame rate.
[0090] As an example, if the video frame rate is set higher than the human eye video frame rate, the human eye will think that the video is clear after watching the video; if the video frame rate is set equal to the human eye video frame rate, the human eye will still think that the video is clear after watching the video, and the video clarity is consistent with the clarity when the video frame rate is higher than the human eye video frame rate. In other words, the human eye cannot perceive the change of the video frame rate when the video frame rate is greater than or equal to the human eye video frame rate.
[0091] When the video frame rate is set to be lower than the human eye video frame rate, the human eye will perceive the video clarity as lowered compared to the case where the video frame rate is equal to the human eye video frame rate. In other words, when the video frame rate is lower than the human eye video frame rate, the human eye can easily perceive the change of the video frame rate.
[0092] Then, in the embodiment of the present invention, the video can be divided into a preset number of frame images according to the preset live broadcast delay and the human eye video frame rate. As an example, a third-party software development kit (SDK) can be called, such as OpenCV, to divide the video into a preset number of frame images according to the preset live broadcast delay and the human eye video frame rate.
[0093] Specifically, the human eye video frame rate can determine the minimum frame image required per second. According to the preset live broadcast delay and the human eye video frame rate, the preset number of segmented videos can be obtained. As an example, the preset number of segmented videos is equal to the product of the preset live broadcast delay and the human eye video frame rate. For example: the preset live broadcast delay is equal to 2 seconds, and the human eye video frame rate is equal to 32 frames / second, then the minimum number of frames of the segmented video is equal to 2*32=64. It can be understood that the video captured within the preset live broadcast delay is divided into 64 frames, so that the minimum bandwidth resources can be occupied while ensuring the clarity of the video.
[0094] Of course, the video collected within the preset live broadcast delay is divided into at least 64 frames, and the video collected within the preset live broadcast delay can also be divided into at least more than 64 frames.
[0095] In one embodiment of the present invention, the video is divided into a preset number of frame images according to a preset live delay and a human eye video frame rate. The video can also be evenly divided into a preset number of frame images based on the preset live delay and a human eye video frame rate for playback by the client.
[0096] As an example, if the preset live delay is 2 seconds and the human eye video frame rate is 32 frames / second, the preset number of split videos is equal to 2*32=64. The captured video is split into 64 frames. The time length can be divided into 64 parts with the preset live delay as the time length. In each time length, select one frame to obtain 64 frames of images.
[0097] The preset number of frame images obtained by segmenting the video are combined with the audio and timestamp of the video to create a video data packet.
[0098] At the time point involved in the timestamp, while playing the audio corresponding to the video according to the above time point, a preset number of frame images obtained by segmenting from the video are displayed on the client.
[0099] Compared with the video itself, the data packet of the video only includes a preset number of frame images obtained by segmenting the video, the audio of the video and a timestamp. The data volume of the data packet of the video is much smaller than the data volume of the video itself.
[0100] S205: Store the video data packet.
[0101] The video server stores video data packets and can send video data packets to other servers or clients for other servers or clients to play the video.
[0102] See also Figure 4 , Figure 4 FIG. 1 is a flow chart of requesting a video according to an embodiment of the present invention. Figure 4 The video server receives the video request from the client, and determines whether there is the latest video to feedback to the client. The specific steps include:
[0103] S401: Receive a video request.
[0104] If the client needs to play a video, it can send a video request to the video server. The client stores one or more videos obtained from the video server. Each video has a corresponding serial number.
[0105] As an example, the serial number of video 1 is A002, and the serial number of video 2 is A003. From the above serial numbers, it can be seen that the acquisition time of video 1 is earlier than the acquisition time of video 2. Video 1 and video 2 can be distinguished by the serial number.
[0106] In the embodiment of the present invention, the client sends a video request to the video server, wherein the video request includes the sequence number of the video requested by the client the most recently. In this way, the video server can determine whether there is a latest video based on the video request.
[0107] S402, judging whether there is a latest video according to the sequence number.
[0108] The video server receives a video request sent by the client and can determine whether there is a latest video based on the sequence number.
[0109] First, the video server searches for a video corresponding to the next sequence number of the sequence number based on the video stored in the server. If the video corresponding to the next sequence number of the sequence number exists, S303 is executed.
[0110] S403: Send corresponding data packets.
[0111] The video server sends a data packet corresponding to the next sequence number of the sequence number to the client. That is, based on the sequence number in the request for sending the video by the client, the video server determines the data packet corresponding to the next sequence number of the sequence number.
[0112] As an example, in the video server, the data packet corresponding to the next sequence number of the sequence number is determined. In this way, the client obtains the latest video by continuously sending video requests.
[0113] S404. Return a null value.
[0114] The video server returns a null value to the client. In the video server, there is no data packet corresponding to the next sequence number, so a null value is returned to the client. The client knows that its own video is already the latest video.
[0115] In the above embodiment, the client sends a video request to the video server, thereby sequentially obtaining a data packet corresponding to the next sequence number of the sequence number, thereby realizing the live broadcast of the high-definition video.
[0116] Figure 5 is a schematic diagram of the main structure of an apparatus for processing a video according to an embodiment of the present invention. The apparatus for processing a video can implement a method for processing a video, such as Figure 5 As shown, the device for processing video specifically includes:
[0117] The receiving module 501 is used to receive the collected video.
[0118] The determination module 502 is used to determine whether the image in the video has changed within a preset time period.
[0119] The storage module 503 is used to select one or more frames of images from the video and create a data packet of the video in combination with the audio and timestamp of the video if the image in the video does not change within a preset time period;
[0120] If the image in the video has changed within a preset time period, the video is segmented into a preset number of frames, and the video data packet is created by combining the audio and timestamp of the video.
[0121] The storage module 504 is used to store video data packets.
[0122] In one embodiment of the present invention, the determination module 502 is specifically configured to encode the video, compare encoding results of different image frames of the video, and determine whether the image in the video has changed.
[0123] In one embodiment of the present invention, the determination module 502 is specifically used to determine whether the image in the video changes within a time period determined by a preset live broadcast delay.
[0124] In one embodiment of the present invention, the processing module 503 is further configured to receive a request for obtaining a video sent by a client, where the video request includes a sequence number of a video requested most recently by the client;
[0125] According to the sequence number, obtain the data packet corresponding to the next sequence number of the sequence number;
[0126] The storage module 504 is also used to store corresponding data packets.
[0127] In one embodiment of the present invention, the processing module 503 is specifically configured to select one or more image frames from the video in time sequence.
[0128] In one embodiment of the present invention, the processing module 503 is specifically used to divide the video into a preset number of frame images according to the preset live broadcast delay and human eye video frame rate.
[0129] Figure 6 An exemplary system architecture 600 is shown to which the method for processing a video or the apparatus for processing a video according to the embodiments of the present invention can be applied.
[0130] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, 603, network 604 and server 606. Network 604 is used to provide a medium for communication links between terminal devices 601, 602, 603 and server 606. Network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0131] The user can use the terminal devices 601, 602, 603 to interact with the server 606 through the network 604 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 601, 602, 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0132] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.
[0133] The server 606 may be a server that provides various services, such as a backend management server (for example only) that supports shopping websites browsed by users using the terminal devices 601, 602, and 603. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - for example only) to the terminal device.
[0134] It should be noted that the method for processing a video provided in the embodiment of the present invention is generally executed by the server 606 , and accordingly, the apparatus for processing a video is generally disposed in the server 606 .
[0135] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0136] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0137] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0138] The following components are connected to the I / O interface 705: an input section 707 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.
[0139] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.
[0140] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, 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 above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0141] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0142] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be provided in a processor. For example, they may be described as follows: a processor includes a sending unit, an acquisition unit, a determination unit, and a first processing unit. The names of these units do not, in some cases, constitute limitations on the units themselves. For example, the sending unit may also be described as a "unit that sends a request for obtaining an image to a connected server."
[0143] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:
[0144] Receiving collected video;
[0145] Determining whether an image in the video changes within a preset time period;
[0146] If the image in the video does not change within a preset time period, one or more frames of the image are selected from the video, and combined with the audio and timestamp of the video to create a data packet of the video;
[0147] If the image in the video has changed within a preset time period, the video is divided into a preset number of frames, and a data packet of the video is established by combining the audio and timestamp of the video;
[0148] A data packet storing the video.
[0149] According to the technical solution of the embodiment of the present invention, since the captured video is received, different technical solutions can be executed according to whether the image in the video has changed. If the image in the video has not changed within a preset time period, one or more frames of images are selected from the video, and a data packet of the video is established in combination with the audio and timestamp of the video; if the image in the video has changed within a preset time period, the video is cut into a preset number of frames of images, and a data packet of the video is established in combination with the audio and timestamp of the video; the data packet of the video is stored. It can be seen that regardless of whether the image in the video has changed, all captured videos do not need to be sent. Images can be selectively sent in the captured video, so that the video quality can be guaranteed while saving bandwidth resources.
[0150] 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 may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for processing a video, characterized in that: The execution subject is the video server, including: Receiving collected video; Determining whether an image in the video changes within a preset time period; If the image in the video does not change within a preset time period, one or more frames of the image are selected from the video, and combined with the audio and timestamp of the video to create a data packet of the video; If the image in the video has changed within a preset time period, the video is divided into a preset number of frames, and a data packet of the video is established by combining the audio and timestamp of the video; A data packet storing the video; The step of dividing the video into a preset number of frame images comprises: According to the preset live broadcast delay and human eye video frame rate, the video is evenly divided into a preset number of frame images; The video is split into multiple frames, and each frame is converted into a grayscale image. When the ratio of the grayscale image subtraction results of two frames in the video to zero exceeds the preset ratio, the image in the video has not changed; when the ratio of the grayscale image subtraction results of two frames in the video to zero does not exceed the preset ratio, the image in the video has changed.
2. The method for processing a video according to claim 1, characterized in that: The determining whether the image in the video has changed includes: The video is encoded, and encoding results of different image frames of the video are compared to determine whether an image in the video has changed.
3. The method for processing video according to claim 1, characterized in that: Determining whether the image in the video changes within a preset time period includes: Within a time period determined by a preset live broadcast delay, determine whether an image in the video changes.
4. The method for processing video according to claim 1, characterized in that: After storing the data packet of the video, the method further comprises: Receive a request for obtaining the video sent by a client, where the request for the video includes a sequence number of a most recent request for the video by the client; According to the sequence number, obtain the data packet corresponding to the next sequence number of the sequence number; The corresponding data packet is sent.
5. The method for processing video according to claim 1, characterized in that: The step of selecting one or more frames of images from the video comprises: One or more frames of images are selected from the video in time sequence.
6. A device for processing video, characterized in that: The execution subject is the video server, including: A receiving module, used for receiving the collected video; A determination module, used to determine whether the image in the video has changed within a preset time period; and split the video into multiple frames of images, convert each frame of the image into a grayscale image, and when the ratio of the grayscale image subtraction results of two frames of images in the video being zero exceeds a preset ratio, the image in the video has not changed; when the ratio of the grayscale image subtraction results of two frames of images in the video being zero does not exceed a preset ratio, the image in the video has changed; A processing module, configured to select one or more frames of images from the video if the image in the video does not change within a preset time period, and to create a data packet of the video in combination with the audio and timestamp of the video; If the image in the video has changed within a preset time period, the video is divided into a preset number of frame images, and a data packet of the video is established in combination with the audio and timestamp of the video; and the video is evenly divided into a preset number of frame images according to a preset live broadcast delay and a human eye video frame rate; The storage module is used to store the data packets of the video.
7. The apparatus for processing video according to claim 6, characterized in that: The determination module is specifically used to encode the video, compare the encoding results of different image frames of the video, and determine whether the image in the video has changed.
8. An electronic device for processing video, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.
9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Video processing method and device
CN106559631A
Video data processing method and device and storage medium
CN110324721A
