WO2022257612A1 - 视频处理方法及装置、电子设备及存储介质 - Google Patents

视频处理方法及装置、电子设备及存储介质 Download PDF

Info

Publication number
WO2022257612A1
WO2022257612A1 PCT/CN2022/087718 CN2022087718W WO2022257612A1 WO 2022257612 A1 WO2022257612 A1 WO 2022257612A1 CN 2022087718 W CN2022087718 W CN 2022087718W WO 2022257612 A1 WO2022257612 A1 WO 2022257612A1
Authority
WO
WIPO (PCT)
Prior art keywords
frame
video
encrypted
information
frames
Prior art date
Application number
PCT/CN2022/087718
Other languages
English (en)
French (fr)
Inventor
池源
Original Assignee
北京快乐茄信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京快乐茄信息技术有限公司 filed Critical 北京快乐茄信息技术有限公司
Publication of WO2022257612A1 publication Critical patent/WO2022257612A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs
    • H04N21/2347Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs involving video stream encryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/4405Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving video stream decryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/4408Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving video stream encryption, e.g. re-encrypting a decrypted video stream for redistribution in a home network

Definitions

  • the present disclosure relates to but not limited to the technical field of video, and in particular relates to a video processing method and device, electronic equipment, and a storage medium.
  • Video encryption is to protect video data to prevent the original data of the video from being stolen and to ensure that unauthorized people cannot watch it at will. Video encryption has become a common way to effectively protect video copyright.
  • Video encryption methods There are also many video encryption methods, and some video encryption methods have high encryption complexity or a large amount of encryption calculation. Although some encryption methods are simple to encrypt but low in security.
  • Embodiments of the present disclosure provide a video processing method and device, electronic equipment, and a storage medium.
  • the first aspect of the embodiments of the present disclosure provides a video processing method, which is executed by the sending end, and the method includes:
  • the second aspect of the embodiments of the present disclosure provides a video processing method, which is executed by the receiving end, and the method includes:
  • a third aspect of an embodiment of the present disclosure provides a video processing device, the device comprising:
  • An extraction module configured to extract at least one frame to be encrypted from the first video to be transmitted
  • a generating module configured to generate an encryption key according to the frame information of the frame to be encrypted
  • An encryption module configured to encrypt the frame to be encrypted by using the encryption key to generate an encrypted frame
  • a replacement module configured to replace the frame to be encrypted in the first video with an encrypted frame to obtain a second video
  • the sending module is configured to respectively send the second video and the encrypted information to the receiving end, wherein the encrypted information is used for the receiving end to decrypt the second video to restore the first video .
  • a fourth aspect of an embodiment of the present disclosure provides a video processing device, the device comprising:
  • the receiving module is configured to receive the second video; receive encrypted information;
  • a third determination module configured to determine the encrypted frame contained in the second video
  • the decryption module is configured to obtain an encryption key according to the encrypted information, and decrypt the encrypted frame to obtain a decrypted frame; the encrypted key is generated according to frame information when the encrypted frame is not encrypted;
  • a restoration module configured to replace the encrypted frame in the second video with the decrypted frame to obtain the first video.
  • a fifth aspect of an embodiment of the present disclosure provides an electronic device, including:
  • memory for storing processor-executable instructions
  • the processor is configured to execute the video processing method provided in any technical solution of the aforementioned first aspect.
  • the sixth aspect of the embodiments of the present disclosure provides a non-transitory computer-readable storage medium, wherein computer-executable instructions are stored in the computer-readable storage medium, and when the computer-executable instructions are executed by a processor, the aforementioned first
  • the video processing method provided by any technical solution of the aspect.
  • the encryption of the first video is encrypted according to the encryption key generated from the extracted frame information of the frame to be encrypted; since the frame information of different frames is different, multiple frames to be encrypted of a video use different encryption key, even if one encryption key is leaked, the encryption effect of other video frames will not be affected. security issues.
  • the encryption key is related to the frame information of the sampled video frame, it is difficult to decipher a single encryption key, which improves the security of video encryption again.
  • Fig. 1 is a schematic flowchart of a video processing method shown in an embodiment of the present disclosure.
  • Fig. 2 is a schematic diagram of a video frame shown in an embodiment of the present disclosure.
  • Fig. 3 is a schematic flowchart of a video processing method shown in an embodiment of the present disclosure.
  • Fig. 4 is a schematic flowchart of a video processing method shown in an embodiment of the present disclosure.
  • Fig. 5 is a schematic flowchart of a video processing method shown in an embodiment of the present disclosure.
  • Fig. 6 is a schematic flowchart of a video processing method shown in an embodiment of the present disclosure.
  • Fig. 7 is a schematic structural diagram of a video processing device according to an embodiment of the present disclosure.
  • Fig. 8 is a schematic structural diagram of a video processing device shown in an embodiment of the present disclosure.
  • Fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
  • an embodiment of the present disclosure provides a video processing method, which is applied to a sending end, and the method includes:
  • S120 Generate an encryption key according to the frame information of the frame to be encrypted
  • S130 Encrypt the frame to be encrypted by using the encryption key to generate an encrypted frame
  • S150 Send the second video and the encrypted information to a receiving end respectively, where the encrypted information is used for the receiving end to decrypt the second video to restore the first video.
  • the sending end may be the end that sends the video to the receiving end, or may be the source end of the video, for example, it may be a video server or a video recording terminal.
  • the first video to be transmitted may be: the video requested by the receiving end, or the video determined by the sending end to be sent to the receiving end based on a user instruction.
  • one or more frames to be encrypted will be extracted from the first video. If multiple frames to be encrypted are extracted, the multiple frames to be encrypted are scattered in different positions of the first video. In this way, The information security problem of the second video caused by directly skipping the frames in the second video caused by a plurality of frames to be encrypted at adjacent positions is reduced.
  • the position of the frame to be encrypted in the first video will be marked, such as the frame number. In this way, it is convenient to replace the video frame according to the formed mark after the encrypted frame is generated.
  • an encryption key is generated according to the frame information of the frame to be encrypted.
  • the encryption key is generated according to the image content of the frame to be encrypted, so the encryption key depends on the frame information of the frame to be encrypted.
  • the frame information includes but not limited to: frame content and frame attributes.
  • the frame content may include: pixel values of pixels included in the frame to be encrypted.
  • Frame attributes include but are not limited to: frame number, frame resolution, frame encoding method and/or frame type, etc.
  • the encryption keys of different frames to be encrypted are also different. Even if the encryption keys of some encrypted frames are leaked and the encryption keys of other frames are not leaked, the first video cannot be completely encrypted.
  • the encryption key generated in this way improves the security of video encryption.
  • the encryption algorithm used may be any encryption algorithm in the related art.
  • the encryption algorithm may include: symmetric encryption and/or asymmetric encryption algorithm and the like.
  • the encrypted frame can be generated, and then the encrypted frame is replaced by the frame to be encrypted in the first video, and then the second video including the unencrypted frame and the encrypted frame is formed.
  • This second video is intercepted by other illegal devices during transmission, and cannot be played because an encrypted frame inconsistent with the encryption key is inserted in the second video, which improves the security of the second video. In this way, even if an encrypted frame is decrypted, other encrypted frames may not be successfully decrypted because the encryption keys of different encrypted frames are different, thereby improving the security of the video during transmission.
  • the receiving end will receive the second video and the encrypted information respectively.
  • the sending end will send the second video and the encrypted information separately.
  • the sending end may send the second video and the encrypted information respectively through different information transmissions of the same connection.
  • the second video and the encrypted information are sent in different ways, for example, the second video can be directly sent from the sender to the sender, and the encryption key can be stored on a server by the sender, and the sender only
  • the authorization information is sent to the receiving end, and the receiving end requests the encrypted information from the server based on the authorization information.
  • the server After receiving the authorization information, the server performs information verification, and sends the encrypted information of the second video to the receiving end after passing the verification.
  • the second video and the encrypted information will be sent to the receiving end respectively. information.
  • the encrypted information can be used by the receiving end to decrypt the second video, so as to restore the first video that can be played normally.
  • the encryption information may at least include: the encryption key.
  • the encryption information may further include: a storage location of the encryption key.
  • the encrypted information may further include: authorization information for obtaining the encrypted information, and the like.
  • the generation of the second video can be performed in advance, for example, S110 to S140 are performed in advance, and after receiving the video request of the first video, the encrypted second video and encrypted information are directly sent to The receiver, in this way, can respond to video requests in a timely manner.
  • the generation of the second video may be temporarily generated when a video request of the first video is received.
  • the video request is: requesting the request information of the first video from the sending end.
  • the generating the encryption key according to the frame information of the frame to be encrypted includes:
  • the encryption key of each frame to be encrypted it may be generated based on a preset algorithm.
  • pixel values of the sampled pixels are obtained by sampling the pixel values, and an encryption key is generated based on these pixel values.
  • the encryption key is generated by sequentially combining the pixel values of the sampled pixels according to the sampling order.
  • the pixel values of the sampled pixels are sorted, and the sorted pixel values are down-sampled again according to the sampling method to obtain the encryption key with a shortened key length again.
  • the sampling method here includes but not limited to: random sampling.
  • the sampling method includes, but is not limited to: random undersampling, random oversampling, cluster center-based sampling and/or group sampling, and the like.
  • the similarity value of the frame to be encrypted is used as an input of the message digest algorithm to obtain an output, and the output can be the aforementioned encryption key.
  • generating the encryption key according to the frame information of the nth frame to be encrypted may also include:
  • the statistical values include but not limited to: mean value of pixel values, variance of pixel values, mean square deviation of pixel values, etc.;
  • the encryption key is generated based on a combination of one or more of the statistical characteristics.
  • the encryption key is jointly generated according to the frame number and frame content in the frame information of the frame to be encrypted.
  • the first part of the encryption key is generated according to the frame number
  • the second part is generated according to the frame content
  • the first part and the second part are combined to obtain the encryption key.
  • the generation process of the first part and the second part it may be based on random sampling or an information summary algorithm.
  • the extracting at least one frame to be encrypted from the first video to be transmitted includes:
  • At least one frame to be encrypted whose information entropy satisfies a preset condition is extracted from the first video to be transmitted.
  • various sampling strategies may be used to extract frames to be encrypted from the first video.
  • the sampling strategy for frames to be encrypted can be divided into: a first sampling strategy and a second sampling strategy.
  • the first sampling strategy may include: a random sampling strategy, so that one or more frames to be encrypted may be randomly selected from the first video.
  • extracting at least one frame to be encrypted from the first video according to the first sampling strategy may include:
  • At least one frame to be encrypted is extracted with the first video as a unit to be sampled
  • the first video is divided into a plurality of sampling units, and at least one frame to be encrypted is extracted from each of the units to be sampled according to a random sampling algorithm.
  • a video frame with a small information entropy (that is, a large amount of information) is extracted from the first video as the frame to be encrypted, so that the information is ensured A large number of frames are encrypted, even if the second video is intercepted during transmission, the encrypted frame cannot be directly skipped for playback.
  • the extracting at least one frame to be encrypted whose information entropy satisfies a preset condition from the first video to be transmitted according to the second sampling strategy includes:
  • one or more video frames with the smallest information are extracted from each unit to be sampled as the frame to be encrypted;
  • one or more video frames whose information entropy is ranked before the preset position in the sorting from small to large are extracted as the frame to be encrypted;
  • one or more video frames whose information entropy is less than or equal to an information entropy threshold are extracted as the frames to be encrypted.
  • the extracting at least one frame to be encrypted whose information entropy satisfies a preset condition from the first video to be transmitted according to the second sampling strategy includes:
  • one or more video frames with the smallest information entropy are extracted from the unit to be sampled of the first video as the frame to be encrypted;
  • one or more video frames whose information entropy is sorted from large to small at preset positions are extracted from the units to be sampled of the first video as the frames to be encrypted.
  • the preset position may be at least: a position after the middle position from the largest to the smallest.
  • extracting at least one frame to be encrypted whose information entropy satisfies a preset condition from the first video to be transmitted includes at least one of the following:
  • an I frame is extracted from a Group of Picture (Group of Picture, GOP) to be sampled in the first video to be transmitted as the frame to be encrypted; wherein one GOP comprising: an I frame and at least one B frame dependent on said I frame and/or at least one P frame dependent on said I frame;
  • GOP Group of Picture
  • a predetermined frame is extracted from the shot to be sampled from the first video as the frame to be encrypted, wherein the predetermined frame includes: the first frame of the shot to be sampled and/or or tail frame;
  • the second sampling strategy is a sampling strategy based on motion analysis, extracting video frames whose optical flow movement times meet preset conditions from the first video are the frames to be encrypted;
  • the video frames of the first video are clustered based on the similarity of frame information to obtain a cluster cluster including at least one video frame, and from the to-be-sampled
  • the video frame with the smallest information entropy extracted in the clustering cluster is the frame to be encrypted
  • the second sampling strategy is a group-based sampling strategy
  • the first video is divided into multiple groups according to the playback order, and the video frame with the smallest information entropy is extracted from the group to be sampled as the frame to be encrypted ;
  • one said grouping includes: a plurality of video frames played continuously in the time domain;
  • the frequency distribution of the frequency of the first video is obtained, and the video frame containing the preset frequency component is extracted from the first video according to the frequency distribution as The frame to be encrypted.
  • Multiple video frames located in the same GOP are consecutively distributed video frames in the first video.
  • the frames in a GOP will be divided into: I frames containing macroblocks.
  • a GOP includes an I frame, and the remaining frames can be B frames or P frames. Both B frames and P frames are dependent on I frames.
  • B frames and P frames are dependent on I frames.
  • differential coding can be performed using I frames as a reference to improve the coding rate and coding efficiency.
  • the I frame is the frame with the smallest information entropy and the largest amount of information.
  • the I frame of each GOP or part of the GOP can be extracted according to the second sampling strategy as frames to be added, so that each of the second video Or the I frames of some GOPs are all encrypted. After the I frames are not decrypted, the entire second video cannot be decrypted and played correctly, thus ensuring the security of the method provided by the embodiments of the present disclosure.
  • a unit to be sampled is: GOP.
  • the first video can be divided into multiple shots according to the continuity of shooting. For example, video frames between two adjacent cutting points in the first video belong to the same shot.
  • At least one frame to be encrypted whose information entropy satisfies a preset condition is extracted from each shot or at least part of the shots.
  • the first frame and/or the last frame of a shot may be used as the frame to be encrypted.
  • the extracted frame to be encrypted is the first frame and/or the last frame of a shot, it is also ensured that the amount of information of the extracted frame to be encrypted is large enough, thereby further improving security.
  • the second sampling strategy may also be a sampling strategy for motion analysis.
  • the sampling strategy based on motion analysis here may be: first perform motion analysis of the object in the video frame, and then sample the frame to be encrypted based on the analysis result, so as to ensure that the amount of information of the sampled frame to be encrypted is large enough.
  • the motion analysis includes but not limited to: optical flow method.
  • the number of optical flow movements can be determined by the optical flow method. The more the number of optical flow movements between two adjacent video frames, the greater the change in the motion of the object in the video frame, and the greater the change in the image content of the video frame. is large, so the content changes between two adjacent video frames are large, and the information increment of the next video frame is large, so this frame can be selected as the frame to be encrypted.
  • clustering can also be performed according to the frame information of the video frames, so that the clustering operation is performed to obtain clusters, a plurality of video frames of a cluster have similarity, and then from multiple clusters or each One or more video frames with the smallest information entropy are extracted from a cluster as the frame to be encrypted.
  • the unit to be sampled may be: a group composed of multiple video frames played sequentially in the time domain.
  • the first video includes M frames, and the M frames are divided into groups containing N frames according to the playback sequence.
  • the contents of a group may or may not be related. But all video frames in this group are distributed continuously. In this way, usually any two packets except the last packet contain the same number of video frames.
  • the second sampling strategy is stratified-based sampling strategy.
  • high-frequency information and low-frequency information can be layers of information.
  • the detail information of a general image can be converted into high-frequency information
  • the contour information can be converted into low-frequency information.
  • the information content of a video frame is sufficiently rich (that is, the information entropy is small enough), it will contain low-frequency information and high-frequency information, and the preset frequency component may be a high-frequency component.
  • a video frame containing high-frequency components and low-frequency information is extracted as the frame to be encrypted.
  • the method also includes:
  • S100 Determine the number of sampling frames of the frame to be encrypted according to the video parameters and the resource usage status information of the sending end.
  • the video parameters may be used to determine the resources required to encrypt a video frame.
  • the resource usage status information of the sending end can be used to determine the resources currently available for video frame encryption at the sending end.
  • the number of sampling frames of the frame to be encrypted will be jointly determined according to the video parameters and the resource usage status information, so as to reduce the Caton phenomenon, large delay in video transmission and unnecessary encryption.
  • the video parameters include at least one of the following:
  • the total number of I frames of the first video is the total number of I frames of the first video.
  • the video frame interval here may be the interval between two I frames.
  • the video parameters may also include:
  • the total number of frames of the first video is the total number of frames of the first video.
  • the image resolution of a single video frame of a video is higher, the amount of data of a single video frame is larger.
  • the data volume of a single video frame of a high-definition 4K video is larger than the data volume of a single video frame of a normal-definition video.
  • the data volume VS of a single video frame picture width*picture height*M bytes.
  • the picture width here can be: the number of pixels contained in the direction of the video width; the picture height can be: the number of pixels contained in the direction of the video height.
  • the number of M bytes may be: the number of bytes for encoding one pixel. For example, if the pixel value of a pixel is encoded by 8 bytes, then the M is 8.
  • the resource usage status information includes at least one of the following:
  • the processor information can be any information describing the processor, and can be used to determine the processing resources that the current sender can use to encrypt video frames.
  • the information of the processor indicates but is not limited to at least one of the following:
  • the number of cores of the processor is the number of cores of the processor.
  • the type of processor, the number of cores, and the bit width reflect the processing rate of the processor itself. Generally, the higher the processing rate of the processor itself, the faster the encryption of video frames can be completed even if there are fewer remaining resources.
  • the load rate of the processor here can be: a central processing unit (Central Processing Unit, CPU), a microcontroller (Micro programmed Control Unit, MCU) or an image processing unit (graphics processing unit, GPU) for encryption processing or Application Processor (Application Processor, AP) and other load rates. If the load rate of the current processor is higher, it means that the remaining processing resources of the processor are less, and the resources available for encryption key generation and encryption processing of the frame to be encrypted are less.
  • CPU Central Processing Unit
  • MCU Micro programmed Control Unit
  • GPU graphics processing unit
  • Application Processor Application Processor
  • the memory resources in a device are also limited. If a large amount of memory resources are currently occupied, the memory used for encryption will be reduced. If a large number of frames need to be encrypted at this time, it will inevitably cause the sending end itself to freeze and the receiving end's video Receive delays and other issues.
  • the remaining power of a device determines the remaining standby time of the device. If the remaining power is greater, it means that the standby time of the device is longer and more frames are encrypted. It is unlikely that the device will run out of power soon.
  • the number of sampling frames includes:
  • the larger value of the first value and the second value wherein the first value is: the product of the available memory capacity and the first parameter, and the ratio of the data volume of a single video frame; wherein, the The first parameter is a positive number less than 1; the second value is: the ratio of the total number of I frames to the second parameter; the second parameter is a positive number greater than 1.
  • the first parameter may be any ratio between 0 and 1, for example, 0.2, 0.3, or 0.4.
  • the second parameter can be any positive integer greater than or equal to 2.
  • the second parameter may be 2.
  • the number of sampling frames when the remaining power is less than a first threshold, the number of sampling frames is positively correlated with the remaining power; or, when the load rate is greater than a second threshold, the number of sampling frames is related to the Negative correlation with load rate.
  • the first threshold may be 50% or 70%.
  • the second threshold may be 30% or 40% or the like.
  • the first threshold and the second threshold may be predetermined historical or empirical values.
  • the reference factor of remaining power may be ignored, and the number of sampling frames may be determined based on other reference factors.
  • the remaining power needs to be considered when considering the number of sampling frames. For example, if the remaining power is greater than 50%, the value of the second parameter is fixed; if the remaining power is less than 50%, the smaller the remaining power, the greater the value of the second parameter. 50% here is the first threshold.
  • the method also includes:
  • the number of threads allocate threads for performing the first video encryption, wherein, when the number of threads is greater than or equal to 2, multiple threads perform parallel sampling and/or encryption of the frames to be encrypted.
  • the number of available threads at the sending end is larger, it means that the resource idle rate of the sending end is higher, and the number of threads that can be allocated for sampling and/or performing encryption of frames to be encrypted is larger.
  • the number of threads allocated to the encryption of the first video is greater than 1, multiple threads can sample and encrypt in parallel, thereby increasing the encryption rate of the first video.
  • the sending the second video and the encrypted information to the receiving end includes:
  • Different types of connections can be established between the sending end and the receiving end.
  • the sending end and the receiving end can send the second video and encrypted information through different connections, so that illegal devices will not obtain the second video and encrypted information at the same time. information.
  • the long-term connection is not disconnected for a long time after it is established. For example, the long-term connection will detect whether the long-term connection maintains the connection state through the transmission of the heartbeat data packet. If it is determined that the long connection is disconnected through the sending of the heartbeat data packet, then the long connection is rebuilt.
  • a short connection is a communication connection established when each data packet is sent and received.
  • a short connection is mostly used for frequent point-to-point communication.
  • the encryption information includes: the encryption key. If the encrypted information carries an encryption key, the receiving end can know the encryption key of the first video after successfully receiving the encrypted information.
  • the sending end and the receiving end can also negotiate based on the encrypted information, or can be determined in a way that both the sending end and the receiving end know. For example, if the sending end and the receiving end negotiate in advance to extract a frame encryption every preset frame, then the sending end does not need to inform the receiving end which frames are encrypted through encryption information at this time.
  • the arrangement order of two adjacent encryption keys in the encryption information is consistent with the arrangement order of the encrypted frames in the second video.
  • the nth encryption key is the encryption key of the nth encrypted frame in the second video.
  • multiple encryption keys in the encrypted information are arranged according to a preset mapping relationship. After receiving the encrypted information, the receiving end needs to obtain the encryption key corresponding to the encrypted frame according to the preset mapping relationship.
  • the encryption keys of any two adjacent encrypted frames are separated by m encryption keys in the encrypted information.
  • the encryption key for decrypting the first encrypted frame is the first encryption key in the encrypted information
  • the encryption key for decrypting the second encrypted frame may be the m+2th encryption key.
  • the encryption key for encrypting the xth encryption frame is the pth encryption key in the encrypted information
  • the encryption key for the x+1th encrypted frame can be: the p+m+1th encryption key in the encrypted information or The p-m-1th encryption key. If p+m+1 is greater than the total number of keys in the encrypted information, the encryption key of the x+1th encrypted frame must be the p-m-1th encryption key. If p-m-1 is less than 0, the encryption key of the x+1th encrypted frame is the p+m+1th encryption key.
  • the frame header of the encrypted frame carries an encryption identifier; wherein, the encryption identifier is used for the receiving end to determine the encrypted frame in the second video.
  • a start code (start code) is inserted between two adjacent frames for dividing two adjacent video frames, and each video frame includes a header and a data unit.
  • the header can be one byte.
  • a data unit may carry raw data corresponding to a video frame.
  • the second video includes encrypted frames and unencrypted frames
  • the encryption identifier in the header may indicate whether the data unit of the corresponding frame is encrypted. For example, there is a bit in the header of each video, and this bit is 1 to indicate that the data unit of this frame is encrypted (this frame is an encrypted frame), and this bit is 0 to indicate that the data unit of this frame is not encrypted (this frame is a non-encrypted frame). encrypted frame or become an unencrypted frame).
  • the receiving end decrypts, it can determine the encrypted frame according to the header of each video frame.
  • the encryption information includes: a frame identifier of the encrypted frame, wherein the frame identifier is used for the receiving end to determine the encrypted frame in the second video.
  • the frame identifier of the encrypted frame is carried in the encrypted information.
  • the receiving end will know both the encrypted frame and the encrypted identifier after receiving the encrypted information.
  • the frame identification may include but not limited to: frame numbers of video frames.
  • an embodiment of the present disclosure provides a video processing method, which is applied to a receiving end, and the method includes:
  • S220 Receive encrypted information
  • S240 Obtain an encryption key according to the encrypted information, and decrypt the encrypted frame to obtain a decrypted frame; the encryption key is generated according to the unencrypted frame information of the encrypted frame;
  • S250 Use the decrypted frame to replace the encrypted frame in the second video to obtain a first video.
  • the video processing method provided by the embodiments of the present disclosure is applied to the receiving end, and the video received by the receiving end from the sending end is a second video including both encrypted frames and non-encrypted frames.
  • the receiving end may send a request for the first video to the sending end, so that the sending end sends the second video to the receiving end based on the request sent by the receiving end.
  • the receiving end will receive the second video.
  • the second video includes encrypted frames and non-encrypted frames.
  • the encryption key of the encrypted frame is generated based on the frame information of the corresponding encrypted frame.
  • the receiving of the second video and the encrypted information is independent of each other, so the receiving of the encrypted information and the second video may not be in a certain sequence.
  • the second video and the encrypted information are received separately, for example, one is received through point-to-point transmission, and the other is received through server forwarding.
  • the second video and the encrypted information are received over different types of connections.
  • Determine the position of the encrypted frame included in the second video for example, determine the position of the encrypted frame in the second video.
  • the corresponding frame is decrypted with the encryption key determined according to the encrypted information.
  • the frame After decryption, the frame is decrypted, the decrypted frame is restored to the original frame, and the decrypted frame is inserted into the position of the corresponding encrypted frame, and the second video is restored to the first video.
  • the first video at this time may be an unencrypted video that is played directly.
  • the encryption key corresponding to the encryption of the video frame is generated according to the frame information of the frame. Therefore, the encryption keys of different frames to be encrypted are different, so that even if the encryption key of a frame to be encrypted is leaked, it has no significant impact on the decryption of the entire second video, thereby improving the security of the second video.
  • the encryption information includes: the encryption key.
  • the encryption key can be obtained.
  • the encrypted information may be information related to obtaining the encrypted key, and the related information includes but not limited to: a storage address, so that the encrypted key can be read from the stored address.
  • the relevant information may further include: storage address and authorization information.
  • the receiving end After receiving the encrypted information, the receiving end initiates a reading request based on the storage address, and the reading request carries the storage address and authorization information, and the authorization information is used for the server storing the encryption key to determine whether the requesting end has a reading request. If there is a read permission, it will be returned according to the encryption key stored at the storage address. In this way, the receiving end can obtain the encryption key according to the relevant information.
  • the S230 may include:
  • the encrypted frame contained in the second video is determined according to the encryption identifier carried in the frame header of the encrypted frame in the second video.
  • the encrypted information also carries a frame identifier of the encrypted frame, for example, the frame identifier includes but not limited to a frame number. According to the frame identifier, the receiving end will simply determine the encrypted frame from the second video.
  • the frame header of the encrypted frame contained in the second video carries a frame identifier, so that when the receiving end receives the second video, it can know which video frames in the second video are by decoding the frame header. Encrypted frames, which are unencrypted frames.
  • the sending end and the receiving end can also agree in advance which frames to encrypt, for example, agreeing that each preset frame in the second video is doped with an encrypted frame.
  • the receiving end receives After the second video, encrypted frames may be extracted from the second video at equal intervals.
  • the S210 may include: receiving the second video over a short connection;
  • the S220 may include: receiving the encrypted information on a persistent connection.
  • the short connection and the long connection are different connection modes, and the second video and encrypted information are not only received separately, but also received in different types of connections, so as to ensure the transmission of the second video and encrypted information again
  • the degree of isolation ensures the security of the video.
  • video encryption mainly includes online video encryption and offline video encryption:
  • Online video encryption refers to video websites, apps, applets and other online video platforms that encrypt videos.
  • the advantage is that the mobile phone or computer can directly open and watch through the corresponding program, but the disadvantage is that the encryption strength is relatively low.
  • Offline video encryption refers to the copyright protection of videos recorded by oneself through encryption software.
  • the general process is to encrypt the video with an encryption tool, then send it to the user, activate and watch it through an activation code or key, and bind it to a specific device for playback.
  • the advantage is that the encryption security is much higher, and the disadvantage is that the key security is insufficient. In reality, it is not the encryption algorithm that is cracked, but the key is artificially leaked. Since the key is almost not related to the video content, but related to the product platform, the hacker can use the obtained key to crack the key of a category or related products, so that he can directly watch all encrypted videos. For video platforms or video property rights companies, key leaks will cause huge losses.
  • the encryption key is directly generated from the key frame data of the video content.
  • the key frame includes but not limited to: I frame.
  • Decryption process The receiving end gets the encryption key, decrypts the encrypted video and restores the original video.
  • the technical solutions provided by the embodiments of the present disclosure have the characteristics of high security.
  • the encryption key and the encrypted video form a complete original video, and the encrypted video is theoretically difficult to crack without the encryption key. There is no correlation between the content of different videos. Even if the encryption key is leaked, hackers cannot deduce the encryption key of other videos based on the encryption key of one video, so as to crack other encrypted videos. Even if the encryption algorithm used when encrypting the video is cracked, the key cannot be cracked.
  • the solution is to dynamically adjust based on the performance and current status of different devices, and select appropriate video content samples as the data for key production, which can be adapted to most mobile devices.
  • An application program (Application, App) at the mobile terminal reads the video to be encrypted and obtains parameters of the video.
  • the video parameters may include: video size, encoding format, frame rate and/or duration, etc.
  • Obtain information about hardware computing resources of the current mobile device including CPU information, memory information, and/or power information.
  • the CPU information may include: CPU model and/or CPU utilization.
  • the memory information may include: remaining ratio of RAM and/or ROM.
  • the power information may include: remaining power and/or estimated remaining standby time.
  • the computing resources of the current mobile phone combined with the relevant parameters of the video, select the key frame extraction method and sampling strategy when the key is generated.
  • shot-based method Specifically, the source video file is divided according to the change of the shot according to a certain technical means, and then the first and last two frames are selected as key frames in each shot of the video.
  • the method based on motion analysis. Analyze the optical flow of object movement in the video shot, and select the video frame with the least number of optical flow movements in the video shot as the extracted key frame each time.
  • the video frame is divided into several clusters through clustering, and after this process, the corresponding frame is selected as the key frame in each cluster.
  • Common sampling strategies include: random sampling, random undersampling and oversampling, cluster center-based sampling, group sampling, stratified sampling, etc.
  • the specific implementation strategy will select a sampling strategy based on video-related parameters and mobile phone performance parameters, as follows:
  • Video frame rate FPS number of frames displayed per second
  • Total video I frames total video duration * FPS/GOP
  • the total number of samples N MAX (the current maximum memory capacity *0.2/VS of the mobile device, the total I frame number of video/2)
  • the maximum number of samples at a time ⁇ the current maximum number of threads that can be allocated by the mobile device * 0.5
  • For the read-in video perform a key frame extraction operation, mark the position of the key frame in the entire video, and select the key frame from it according to the sampling strategy to generate a key. At the same time, mark the position corresponding to the keyframe as selected.
  • Figure 5 is an example illustrating that the sending end is a mobile end, and the encryption key generation method applied to the mobile end may include:
  • the mobile terminal calculates the number of video sampling frames N;
  • the key frame is extracted from the video, and the encryption key is generated according to the sampling strategy.
  • the encryption key is generated by using the sampling result of the pixel value of the key frame based on the sampling strategy; the video frame is encrypted with the encryption key, and the encrypted frame is replaced with an unencrypted key frame to obtain the aforementioned second video.
  • Figure 6 is an example illustrating that the sending end is a mobile end, and the video processing method applied to the mobile end may include:
  • the mobile terminal reads the original video and obtains video parameters
  • an appropriate key frame extraction strategy (exemplarily, the strategy can be the aforementioned first sampling strategy and the second sampling strategy) and a sampling strategy, the sampling strategy can be used to sample the pixel value of the key frame, based on the sampled pixel value can be generate an encryption key;
  • an embodiment of the present disclosure provides a video processing device, and the device includes:
  • the extraction module 110 is configured to extract at least one frame to be encrypted from the first video to be transmitted;
  • the generating module 120 is configured to generate an encryption key according to the frame information of the frame to be encrypted
  • the encryption module 130 is configured to use the encryption key to encrypt the frame to be encrypted to generate an encrypted frame
  • the replacement module 140 is configured to replace the frame to be encrypted in the first video with an encrypted frame to obtain a second video;
  • the sending module 150 is configured to respectively send the second video and the encrypted information to the receiving end, wherein the encrypted information is used for the receiving end to decrypt the second video to restore the first video.
  • the video processing device may be included in the sending end.
  • the extraction module 110, the generation module 120, the encryption module 130, the replacement module 140 and the sending module 150 can all be program modules; after the program modules are executed by the processor, they can Determine the frame to be encrypted, generate an encryption key, encrypt to obtain the encrypted frame, and form a second video by replacing the encrypted frame with the unencrypted frame.
  • the extraction module 110, the generation module 120, the encryption module 130, the replacement module 140, and the sending module 150 can all be hardware and software modules; the hardware and software modules include but not Limited to: programmable arrays; said programmable arrays include but are not limited to complex programmable arrays or field programmable arrays.
  • the extraction module 110, the generation module 120, the encryption module 130, the replacement module 140, and the sending module 150 can all be a combination of hardware and software; It may be a pure hardware module; the pure hardware module includes but not limited to: application specific integrated circuit.
  • it is specifically used to extract pixel values of preset pixels from the nth frame to be encrypted to generate the encryption key of the nth frame to be encrypted; wherein, the n is a natural number.
  • the extraction module 110 is configured to randomly extract at least one frame to be encrypted from the first video to be transmitted according to the first sampling strategy; At least one frame to be encrypted whose information entropy meets a preset condition is extracted from the first video.
  • the extraction module 110 is configured to, according to the second sampling strategy, extract one or more video frames with the smallest information entropy from the units to be sampled in the first video as the to-be-encrypted frame; or, according to the second sampling strategy, extract one or more video frames whose information entropy is sorted in descending order from the unit to be sampled in the first video as the frame to be encrypted.
  • the extraction module 110 is configured to perform at least one of the following:
  • an I frame is extracted from the group of pictures GOP to be sampled in the first video as the frame to be encrypted; wherein, one GOP includes: one I frame and depends on the at least one B frame of an I frame and/or at least one P frame dependent on said I frame;
  • a predetermined frame is extracted from the shot to be sampled from the first video as the frame to be encrypted, wherein the predetermined frame includes: the first frame of the shot to be sampled and/or or tail frame;
  • the second sampling strategy is a sampling strategy based on motion analysis, extracting video frames whose optical flow movement times meet preset conditions from the first video are the frames to be encrypted;
  • the video frames of the first video are clustered based on the similarity of frame information to obtain a cluster cluster including at least one video frame, and from the to-be-sampled
  • the video frame with the smallest information entropy extracted in the clustering cluster is the frame to be encrypted
  • the second sampling strategy is a group-based sampling strategy
  • the first video is divided into multiple groups according to the playback order, and the video frame with the smallest information entropy is extracted from the group to be sampled as the frame to be encrypted ;
  • one said grouping includes: a plurality of video frames played continuously in the time domain;
  • the frequency distribution of the frequency of the first video is obtained, and the video frame containing the preset frequency component is extracted from the first video according to the frequency distribution as The frame to be encrypted.
  • the device also includes:
  • the first determining module is configured to determine the sampling frame number of the frame to be encrypted according to the video parameters and the resource usage status information of the sending end.
  • the video parameters include at least one of the following:
  • the resource usage status information includes at least one of the following:
  • the number of sampling frames includes:
  • the larger value of the first value and the second value wherein the first value is: the product of the available memory capacity and the first parameter, and the ratio of the data volume of a single video frame; wherein, the The first parameter is a positive number less than 1; the second value is: the ratio of the total number of I frames to the second parameter; the second parameter is a positive number greater than 1.
  • the number of sampling frames is positively correlated with the remaining power
  • the information of the processor includes: a load rate; when the load rate is greater than a second threshold, the number of sampling frames is negatively correlated with the load rate.
  • the device also includes:
  • the second determination module is configured to determine the number of threads used for the first video encryption according to the number of available threads at the sending end;
  • An allocation module configured to allocate threads for performing encryption of the first video according to the number of threads, wherein, when the number of threads is greater than or equal to 2, multiple threads perform parallel sampling and summing of the frames to be encrypted / or encryption.
  • the sending module 150 is configured to send the encrypted information to the receiving end through a long connection; send the second video to the receiving end through a short connection.
  • the encryption information includes: the encryption key
  • the frame header of the encrypted frame carries an encryption identifier; wherein, the encryption identifier is used for the receiving end to determine the encrypted frame in the second video;
  • the encrypted information includes: a frame identifier of an encrypted frame, wherein the frame identifier is used for the receiving end.
  • an embodiment of the present disclosure provides a video processing device, and the device includes:
  • the receiving module 210 is configured to receive the second video; receive encrypted information;
  • the third determination module 220 is configured to determine the encrypted frame contained in the second video
  • the decryption module 230 is configured to obtain an encryption key according to the encrypted information, and decrypt the encrypted frame to obtain a decrypted frame; the encrypted key is generated according to frame information when the encrypted frame is not encrypted;
  • the restore module 240 is configured to replace the encrypted frame in the second video with the decrypted frame to obtain the first video.
  • the receiving module 210, the third determining module 220, the decrypting module 230, and the restoring module 240 may be program modules; the program module receives the second video after being executed by the processor. , encrypt the information and successfully decode the second video to restore the first video.
  • the receiving module 210, the third determination module 220, the decryption module 230, and the restoration module 240 can all be hardware-software modules; the hardware-software module includes but is not limited to: Programmable array; said programmable array includes but not limited to complex programmable array or field programmable array.
  • the receiving module 210, the third determining module 220, the decrypting module 230 and the restoring module 240 can all be software and hardware modules; the software and hardware modules can also be pure hardware module; the pure hardware module includes but not limited to: application specific integrated circuit.
  • the encryption information includes: the encryption key
  • the third determining module 220 is configured to determine the encrypted frame contained in the second video according to the frame identifier included in the encrypted information; or, according to the encrypted identifier carried in the frame header of the encrypted frame in the second video , determining the encrypted frame included in the second video.
  • the receiving module 210 is configured to receive the second video over a short connection; and receive the encrypted information over a long connection.
  • An embodiment of the present disclosure provides an electronic device, including:
  • memory for storing processor-executable instructions
  • the processor is configured to execute the video processing method provided by any of the aforementioned technical solutions by executing the computer-executable instructions stored in the memory.
  • the processor may include various types of storage media, which are non-transitory computer storage media, and can continue to memorize and store information thereon after the mobile terminal is powered off.
  • the processor may be connected to the memory through a bus, etc., for reading the executable program stored on the memory, for example, at least one of the methods shown in any one of FIG. 1 , FIG. 3 to FIG. 6 .
  • Fig. 9 is a block diagram of an electronic device 800 according to an exemplary embodiment.
  • the electronic device 800 may be a mobile phone, a mobile computer, and the like.
  • the electronic device may be the aforementioned sending end and/or receiving end.
  • electronic device 800 may include one or more of the following components: processing component 802, memory 804, power supply component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814 , and the communication component 816.
  • the processing component 802 generally controls the overall operations of the electronic device 800, such as those associated with display, telephone calls, data communications, camera operations, and recording operations.
  • the processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802 .
  • the memory 804 is configured to store various types of data to support operations at the device 800 . Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, pictures, videos, and the like.
  • the memory 804 can be implemented by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read-only memory
  • EPROM erasable Programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Magnetic Memory Flash Memory
  • Magnetic or Optical Disk Magnetic Disk
  • the power supply component 806 provides power to various components of the electronic device 800 .
  • Power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for electronic device 800 .
  • the multimedia component 808 includes a screen providing an output interface between the electronic device 800 and the user.
  • the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user.
  • the touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense a boundary of a touch or a swipe action, but also detect duration and pressure associated with the touch or swipe operation.
  • the multimedia component 808 includes a front camera and/or a rear camera. When the device 800 is in an operating state, such as a shooting state or a video state, the front camera and/or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capability.
  • the audio component 810 is configured to output and/or input audio signals.
  • the audio component 810 includes a microphone (MIC), which is configured to receive an external audio signal when the electronic device 800 is in an operating state, such as a calling state, a recording state, and a speech recognition state. Received audio signals may be further stored in memory 804 or sent via communication component 816 .
  • the audio component 810 also includes a speaker for outputting audio signals.
  • the I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which may be a keyboard, a click wheel, a button, and the like. These buttons may include, but are not limited to: a home button, volume buttons, start button, and lock button.
  • Sensor assembly 814 includes one or more sensors for providing status assessments of various aspects of electronic device 800 .
  • the sensor component 814 can detect the open/closed state of the device 800, the relative positioning of components, such as the display and the keypad of the electronic device 800, and the sensor component 814 can also detect the position of the electronic device 800 or a component of the electronic device 800 changes, the presence or absence of user contact with the electronic device 800 , the orientation or acceleration/deceleration of the electronic device 800 and the temperature change of the electronic device 800 .
  • Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact.
  • Sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
  • the sensor component 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor.
  • the communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices.
  • the electronic device 800 can access a wireless network based on communication standards, such as Wi-Fi, 2G or 3G, or a combination thereof.
  • the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication.
  • the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID Radio Frequency Identification
  • IrDA Infrared Data Association
  • UWB Ultra Wide Band
  • Bluetooth Bluetooth
  • electronic device 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable A programmable gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation for performing the methods described above.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable A programmable gate array
  • controller microcontroller, microprocessor or other electronic component implementation for performing the methods described above.
  • non-transitory computer-readable storage medium including instructions, such as the memory 804 including instructions, which can be executed by the processor 820 of the electronic device 800 to complete the above method.
  • the non-transitory computer readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.
  • An embodiment of the present disclosure provides a non-transitory computer-readable storage medium.
  • the mobile terminal can execute the prompt method for image acquisition provided by any of the foregoing embodiments, and can execute At least one of the methods as shown in any one of Fig. 1 , Fig. 3 to Fig. 6 .

Abstract

本公开实施例是关于一种视频处理方法及装置、电子设备及存储介质。由发送端执行的视频处理方法可包括:从待传输的第一视频中抽取至少一个待加密帧(S110);根据待加密帧的帧信息,生成加密密钥(S120);利用加密密钥加密待加密帧,生成加密帧(S130);利用加密帧替换第一视频中待加密帧,得到第二视频(S140);向接收端分别发送第二视频及加密信息,其中,加密信息,用于供接收端解密第二视频以还原出第一视频(S150)。

Description

视频处理方法及装置、电子设备及存储介质
本公开要求申请号202110649162.8且申请日为2021年06月10日的中国申请的优先权;优先权涉及的中国申请的所有内容均为本公开的内容。
技术领域
本公开涉及视频技术领域但不限于视频技术领域,尤其涉及一种视频处理方法及装置、电子设备及存储介质。
背景技术
视频加密是对视频数据进行保护,以防止视频的原始数据被窃取,保证未经授权的人无法随意观看,视频加密已经成为有效保护视频版权的常用途径。
视频加密的方式也有很多种,有的视频加密方式的加密复杂度高或加密计算量大。有的加密方式虽然加密简便但是安全性低。
但是不管哪种加密方式,一旦加密密钥泄露会导致视频十分容易的被窃取。
发明内容
本公开实施例提供一种视频处理方法及装置、电子设备及存储介质。
本公开实施例第一方面提供一种视频处理方法,由发送端执行,所述方法包括:
从待传输的第一视频中抽取至少一个待加密帧;
根据所述待加密帧的帧信息,生成加密密钥;
利用所述加密密钥加密所述待加密帧,生成加密帧;
利用加密帧替换所述第一视频中待加密帧,得到第二视频;
向接收端分别发送所述第二视频及所述加密信息,其中,所述加密信息,用于供所述接收端解密所述第二视频以还原出所述第一视频。
本公开实施例第二方面提供一种视频处理方法,由接收端执行,所述方法包括:
接收第二视频;
接收加密信息;
确定所述第二视频包含的加密帧;
根据所述加密信息得到加密密钥,解密所述加密帧得到解密帧;所述加密密钥是根据所述加密帧未加密时的帧信息生成的;
利用所述解密帧替换所述第二视频中的所述加密帧,得到第一视频。
本公开实施例第三方面提供一种视频处理装置,所述装置包括:
抽取模块,被配置为从待传输的第一视频中抽取至少一个待加密帧;
生成模块,被配置为根据所述待加密帧的帧信息,生成加密密钥;
加密模块,被配置为利用所述加密密钥加密所述待加密帧,生成加密帧;
替换模块,被配置为利用加密帧替换所述第一视频中待加密帧,得到第二视频;
发送模块,被配置为向接收端分别发送所述第二视频及所述加密信息,其中,所述加密信息,用于供所述接收端解密所述第二视频以还原出所述第一视频。
本公开实施例第四方面提供一种视频处理装置,所述装置包括:
接收模块,被配置为接收第二视频;接收加密信息;
第三确定模块,被配置为确定所述第二视频包含的加密帧;
解密模块,被配置为根据所述加密信息得到加密密钥,解密所述加密帧得到解密帧;所述加密密钥是根据所述加密帧未加密时的帧信息生成的;
还原模块,配置为利用所述解密帧替换所述第二视频中的所述加密帧,得到第一视频。
本公开实施例第五方面提供一种电子设备,包括:
用于存储处理器可执行指令的存储器;
处理器,与所述存储器连接;
其中,所述处理器被配置为执行如前述第一方面任意技术方案提供的视频处理方法。
本公开实施例第六方面提供一种非临时性计算机可读存储介质,其中,所述计算机可读存储介质中存储有计算机可执行指令,该计算机可执行指令被处理器执行时实现前述第一方面任意技术方案提供的视频处理方法。
本公开实施例中,第一视频的加密是根据抽取的待加密帧的帧信息生成的加密密钥进行加密的;由于不同帧的帧信息不同,故而一个视频的多个待加密帧使用不同加密密钥,即便一个加密密钥泄露,其他视频帧的加密效果也不会受到影响,若一个视频的加密密钥泄露,其他视频的加密安全性也不受影响,从而减少了加密密钥泄露导致的安全性问题。另外,由于加密密钥是与被抽样视频帧的帧信息相关的,单个加密密钥的破解难度大,再次提升了视频加密的安全性。
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本发明的实施例,并与说明书一起用于解释本发明的原理。
图1是本公开实施例示出的一种视频处理方法的流程示意图。
图2是本公开实施例示出的一种视频帧的示意图。
图3是本公开实施例示出的一种视频处理方法的流程示意图。
图4是本公开实施例示出的一种视频处理方法的流程示意图。
图5是本公开实施例示出的一种视频处理方法的流程示意图。
图6是本公开实施例示出的一种视频处理方法的流程示意图。
图7是本公开实施例示出的一种视频处理装置的结构示意图。
图8是本公开实施例示出的一种视频处理装置的结构示意图。
图9是本公开实施例示出的一种电子设备的结构示意图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本发明相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本发明的一些方面相一致的装置和方法的例子。
如图1所示,本公开实施例提供一种视频处理方法,应用于发送端中,所述方法包括:
S110:从待传输的第一视频中抽取至少一个待加密帧;
S120:根据所述待加密帧的帧信息,生成加密密钥;
S130:利用所述加密密钥加密所述待加密帧,生成加密帧;
S140:利用加密帧替换所述第一视频中待加密帧,得到第二视频;
S150:向接收端分别发送所述第二视频及所述加密信息,其中,所述加密信息,用于供所述接收端解密所述第二视频以还原出所述第一视频。
本公开实施例中所述发送端可为向接收端发送视频的一端,可为视频的源端,例如,可为视频服务器或者视频录制终端等。
此处的待传输的第一视频可为:接收端请求的视频,或者,发送端基于用户指令确定发送给接收端的视频。
在本公开实施例中会从第一视频中抽取一个或多个待加密帧,若抽取的待加密帧为多个时,这多个待加密帧分散在第一视频的不同位置上,如此,减少多个待加密帧位于相邻位置上,直接跳过第二视频中这些帧导致的第二视频信息安全问题。
在本公开实施例中,若抽取出了待加密的待加密帧之后,会标记待加密帧在第一视频中的位置,例如帧编号。如此,方便在生成加密帧之后按照形成的标记进行视频帧替换。
在一些实施例中,抽取出待加密帧之后,会根据待加密帧自身的帧信息,生成加密密钥。
例如,根据待加密帧的图像内容,生成加密密钥,因此该加密密钥取决于该待加密帧自身的帧信息。该帧信息包括但不限于:帧内容和帧属性。该帧内容可包括:待加密帧所包含像素的像素值。帧属性包括但不限于:帧编号、帧分辨率、帧编码方式和/或帧类型等。
由于不同待加密帧的帧信息不同,因此不同的待加密帧的加密密钥也不同,即便部分加密帧的加密密钥泄露,其他帧的加密密钥没有泄露,则第一视频就不可能完全被还原出来的,因而采用这 种方式生成的加密密钥提升了视频加密的安全性。
在生成加密密钥加对待加密帧进行加密,采用的加密算法可以为相关技术中任意加密算法,示例性地,该加密算法可包括:对称加密和/或非对称加密算法等。
对待加密帧加密之后,可以生成加密帧,然后将加密帧替换掉第一视频中的待加密帧,然后就形成了包含未加密帧和加密帧的第二视频。这种第二视频在传输过程中被其他非法设备截获了,也因为第二视频中插入与加密密钥不统一的加密帧而无法播放,提升了第二视频的安全性。如此,即便某个加密帧被解密了,因为不同加密帧的加密密钥不同,其他加密帧也未必能够成功解密,从而提升了视频在传输过程中的安全性。
在本公开实施例中,接收端将分别接收到第二视频和加密信息。示例性地,发送端将分开发送所述第二视频和所述加密信息。
示例性地,发送端可以通过同一个连接的不同次的信息传输来分别发送所述第二视频和加密信息。又示例性地,第二视频和加密信息的发送方式不同,例如,第二视频可以由发送端直接发送给发送端,而加密密钥则可以由发送端存储到一个服务器上,发送端仅是将授权信息发送给接收端,接收端基于授权信息向服务器请求所述加密信息。服务器接收到授权信息进行信息验证,如通过验证之后,将第二视频的加密信息发送给接收端。
总之,在本公开实施例中,为了减少第二视频和加密信息一同发送,在暴力破解下形成的安全性低的问题,在S150中将分别向接收端发送所述第二视频和所述加密信息。
所述加密信息可用于接收端解密所述第二视频,从而还原出能够正常播放的第一视频。示例性地,所述加密信息可至少包括:所述加密密钥。
又示例性地,所述加密信息还可包括:所述加密密钥的存储位置。在一些实施例中,所述加密信息还可包括:获取所述加密信息的授权信息等。
在一个实施例中,所述第二视频的生成可以预先执行的,例如,事先执行S110至S140,在接收到第一视频的视频请求之后,直接将加密好的第二视频和加密信息发送给接收端,如此,可以及时的响应视频请求。
在另一个实施例中,所述第二视频的生成可以是在接收到第一视频的视频请求临时生成的。
视频请求为:向发送端请求所述第一视频的请求信息。
在一些实施例中,所述根据所述待加密帧的帧信息,生成加密密钥,包括:
从第n个待加密帧抽取预设个像素的像素值,生成所述第n个待加密帧的所述加密密钥;其中,所述n为自然数。
在生成各个待加密帧的加密密钥时,可以基于预设算法生成。
在本公开实施例中,通过像素值的采样,得到被采样像素的像素值,基于这些像素值生成加密密钥。
示例性地,将被采样的多个像素的像素值按照抽样顺序依次组合后,生成加密密钥。
在一些实施例中,将被采样像素的像素值排序,按照采样方式再次对排序后的像素值进行降采 样,得到密钥长度再次缩短的所述加密密钥。
此处地采样方式包括但不限于:随机采样。
该采样方式包括但不限于:随机欠采样、随机过采样、基于聚类中心的采样和/或分组采样等。
又示例性地,以待加密帧的相似值作为消息摘要算法的输入得到输出,该输出即可为前述的加密密钥。
如此,由于第一视频中不同帧的图像内容不同,或者像素值不同或者像素值分布不同,因此不同待加密帧的加密密钥不同。
在另一些实施例中,根据第n个待加密帧的帧信息生成加密密钥还可包括:
根据所述第n个待加密帧的信息帧的像素值的统计特征,该统计值包括但不限于:像素值的均值、像素值的方差、像素值的均方差等;
根据统计特征中的一个或多个的组合,生成所述加密密钥。
在还有一些实施例中,根据待加密帧的帧信息中的帧编号和帧内容,共同生成所述加密密钥。示例性地,根据帧编号生成加密密钥的第一部分,根据帧内容生成第二部分,组合第一部分和第二部分得到所述加密密钥。第一部分和第二部分的生成过程中,可以基于随机抽样或者信息摘要算法等。
总之,基于待加密帧的帧信息生成加密密钥的方式有多种,具体实现不局限于上述举例。
在一些实施例中,所述从待传输的第一视频中抽取至少一个待加密帧,包括:
按照第一抽样策略,从待传输的所述第一视频中随机抽取至少一个待加密帧;
或者,
按照第二抽样策略,从待传输的所述第一视频中抽取信息熵满足预设条件的至少一个待加密帧。
在本公开实施例中,可以通过各种抽样策略从第一视频中抽取待加密帧。
在本公开实施例中,进行待加密帧的抽样策略可分为:第一抽样策略和第二抽样策略。此处地,第一抽样策略可包括:随机抽样策略,从而可以从第一视频中随机抽取一个或多个待加密帧。
示例性,按照第一抽样策略从第一视频中抽取至少一个待加密帧可包括:
按照随机抽样算法,以第一视频为一个待抽样单位抽取至少一个待加密帧;
或者,
将所述第一视频划分为多个抽样单位,按照随机抽样算法从每一个所述待抽样单位中抽取至少一个待加密帧。
为了再次提升加密安全性,在本公开实施例中会按照第二抽样策略,从第一视频中抽取信息熵较小(即信息量大)的视频帧作为所述待加密帧,如此,确保信息量的帧被加密,即便在传输过程第二视频被截获,也不能直接跳过加密帧播放。
示例性地,所述按照第二抽样策略,从待传输的所述第一视频中抽取信息熵满足预设条件的至少一个待加密帧,包括:
按照第二抽样策略,抽取信息熵最小的一个或多个视频帧作为所述待加密帧;
按照第二抽样策略,从每一个待抽样单位中抽取信息最小的一个或多个视频帧作为所述待加密帧;
按照第二抽样策略,抽取信息熵在从小到大排序中排序排名预设位置之前的一个或读个视频帧作为所述待加密帧;
按照第二抽样策略,抽取信息熵小于或等于信息熵阈值的一个或多个视频帧作为所述待加密帧。
以上仅是对抽样策略的举例说明,具体实现时不局限于上述举例。
在一个实施例中,所述按照第二抽样策略,从待传输的所述第一视频中抽取信息熵满足预设条件的至少一个待加密帧,包括:
按照所述第二抽样策略,从所述第一视频的待抽样单位中抽取信息熵最小的一个或多个视频帧作为所述待加密帧;
或者,
按照所述第二抽样策略,从所述第一视频的待抽样单位中抽取信息熵从大到小排序在预设位置的一个或多个视频帧作为所述待加密帧。
此处预设位置可至少为:从大到小的中间位置以后的位置。
在一些实施例中,所述按照第二抽样策略,从待传输的所述第一视频中抽取信息熵满足预设条件的至少一个待加密帧,包括以下至少之一:
在所述第二抽样策略为I帧抽样策略,从待传输的所述第一视频中待抽样画面组(Group of Picture,GOP)抽取I帧为所述待加密帧;其中,一个所述GOP包括:一个I帧和依赖所述I帧的至少一个B帧和/或依赖所述I帧的至少一个P帧;
在所述第二抽样策略为镜头抽样策略,从所述第一视频中从待抽样镜头中抽取预定帧作为所述待加密帧,其中,所述预定帧包括:待抽样镜头的首帧和/或尾帧;
在所述第二抽样策略为基于运动分析的抽样策略时,从所述第一视频中抽取光流移动次数满足预设条件的视频帧为所述待加密帧;
在所述第二抽样策略为基于聚类结果的抽样策略时,将所述第一视频的视频帧进行基于帧信息相似度的聚类得到包括至少一个视频帧的聚类簇,并从待抽样的所述聚类簇中抽取信息熵最小的视频帧为所述待加密帧;
在所述第二抽样策略为基于分组的抽样策略时,将所述第一视频按照播放顺序分为多个分组,从待抽样所述分组中抽取信息熵最小的视频帧作为所述待加密帧;其中,一个所述分组包括:多个在时域上连续播放的视频帧;
在所述第二抽样策略为基于分层的抽样策略时,获取所述第一视频在频率的频率分布,根据所述频率分布从所述第一视频中抽取包含预设频率分量的视频帧为所述待加密帧。
位于同一个画面组内的多个视频帧是第一视频中连续分布的视频帧,根据MPEG、WEBM等等编码方式,会将一个GOP中的帧分为:包含宏块的I帧。一般一个GOP包括一个I帧,剩余的帧可为B帧或者P帧。B帧和P帧都是依赖的I帧,针对B帧和P帧编码时,都可以以I帧为参考进行 差分编码,提升编码速率和编码效率。
在一个GOP中I帧即为信息熵最小即信息量最大的帧。
若将第一视频按照帧内容之间的关联性划分为了多个GOP,可以按照第二抽样策略抽抽取每一个GOP或部分GOP的I帧作为待加帧,如此,第二视频中的每个或部分GOP的I帧都是加密的,在没有解密出I帧之后,整个第二视频都无法正确解密和播放,因此确保了本公开实施例提供的方法的安全性。在这种抽样方式中,一个待抽样单位为:GOP。
在一些实施例中,所述第一视频可以根据拍摄的连续性划分为多个镜头。例如,第一视频中相邻两个剪接点之间的视频帧属于同一个镜头。
在本公开实施例中,根据第二抽样策略,从每一个镜头或至少部分镜头中抽取信息熵满足预设条件的至少一个待加密帧。
当拍摄的内容出现比较大变化时,摄像头的镜头视场会出现变化,而需要将两个镜头拍摄的视频帧剪接到一起,从而所述剪接点的出现,表明图像内容出现了比较大的变化,位于剪接点附近的视频帧的信息量比其他帧的信息大,或者,位于剪接点附近的视频帧的信息量的增量比其他帧的信息量的增量大。故为了简化抽样,在本公开实施例中,可以将一个镜头的首帧和/或尾帧作为待加密帧。且由于抽取的待加密帧为一个镜头的首帧和/或尾帧,故也保证了被抽取的待加密帧的信息量足够大,从而再次提升的安全性。
在一些实施例中,第二抽样策略还可以为运动分析的抽样策略。此处的基于运动分析的抽样策略可为:先进行视频帧内拍摄对象的运动分析,基于分析得到的结果进行待加密帧的抽样,从而确保抽样的待加密帧的信息量足够大。
该运动分析包括但不限于:光流法。通过光流法可以确定出光流移动次数,在相邻两个视频帧之间光流移动次数越多,则说明视频帧中的拍摄对象的运动变化越大,则说明视频帧的图像内容变化越大,因此在相邻两个视频帧之间的内容变化大,则在后的一个视频帧的信息增量大,因此可以选择该帧作为待加密帧。
在一些实施例中,还可以根据视频帧的帧信息进行聚类,如此将聚类操作得到聚类簇,一个聚类簇的多个视频帧具有相似性,然后从多个聚类簇或者每一个聚类簇中抽取一个或多个信息熵最小的视频帧作为所述待加密帧。
在一些实施例中,待抽样单位可以为:在时域上顺序播放的多个视频帧组成的分组。例如,第一视频包括M个帧,将M个帧按照播放顺序划分为包含N个帧的分组。一个分组之间的内容可以具有关联性,也可以不具有关联性。但是这个分组内的所有视频帧是连续分布。采用这种方式,通常除最后一个分组以外任意两个分组包含的视频帧的帧数相同。
在一些实施例中,若所述第二抽样策略为基于分层的抽样策略。
还可以将视频帧的视频数据映射到频域,如此视频帧中的不同信息会分布在频域的不同位置上,如此,视频帧的帧内容就将按照频率高低分配高频信息和低频信息,高频信息对应的频率,高于低频信息对应的频率。如此,高频信息和低频信息可以信息的层。例如,一般图像的细节信息可转换 为高频信息,轮廓信息可以转换为低频信息。而一个视频帧的信息内容足够丰富(即信息熵够小),则将包含低频信息和高频信息,所述预设频率分量可为高频分量。将包含高频分量和低频信息所在的视频帧抽取出来作为所述待加密帧。
在一些实施例中,如图3所示,所述方法还包括:
S100:根据视频参数和所述发送端的资源使用状况信息,确定所述待加密帧的抽样帧数。
所述视频参数,可以用于确定加密一个视频帧所需要消耗的资源。
所述发送端的资源使用状况信息,可用于确定发送端当前可用于进行视频帧加密的资源。
在本公开实施例中,因此在本公开实施例中,会根据所述视频参数和所述资源使用状况信息,共同确定出待加密帧的抽样帧数,减少抽样帧数过大导致的发送端的卡顿现象和视频传输延时大及不必要加密的现象。
在一些实施例中,所述视频参数,包括以下至少之一:
根据所述第一视频的单个视频帧的数据量;
第一视频的I帧总数。
I帧总数,可以是根据视频总时长、视频帧率(Frames Per Second,FPS)和视频帧帧间隔(GOP)确定的。例如,I帧总数=视频总时长*FPS/GOP。
此处的视频帧间隔可为两个I帧之间的间隔。
可以理解地,一个视频的I帧总数越大,则同样出于安全性考虑,则需要考虑抽取更多的待加密帧。
在另一个实施例中,所述视频参数还可包括:
所述第一视频的总帧数。
若一个视频的单个视频帧的图像分辨率越高,则单个视频帧的数据量就越多。通常情况下,高清4K视频的单个视频帧的数据量,比普清视频的单个视频帧的数据量大。
示例性地,单个视频帧的数据量VS=画面宽度*画面高度*M个字节数。此处的画面宽度可为:视频宽所在方向上包含的像素个数;画面高度可为:视频高所在方向上包含的像素个数。M个字节数可为:编码一个像素的字节个数。例如,一个像素的像素值由8个字节编码,则该M为8。
一般情况下第一视频的总帧数越多,出于安全性考虑则需要抽取更多的待加密帧。
所述资源使用状况信息包括以下至少之一:
处理器的信息;
可用内存容量;
剩余电量。
所述处理器的信息可为描述所述处理器的任意信息,可用于确定当前发送端可以用于加密视频帧的处理资源。
示例性地,所述处理器的信息指示但不限于以下至少之一:
处理器的类型;
处理器的核数;
处理器的位宽;
处理器的负载率。
处理器的类型、核数和位宽反应的是该处理器自身的处理速率,一般情况下处理器自身的处理速率越高,即便剩余资源较少依然可以快速完成视频帧的加密。
此处的处理器的负载率可为:进行加密处理的中央处理器(Central Processing Unit,CPU)、微程序控制器(Micro programmed Control Unit,MCU)或者图像处理器(graphics processing unit,GPU)或者应用处理器(Application Processor,AP)等负载率。若当前处理器的负载率越高,则说明处理器的剩余处理资源越少,可用于待加密帧的加密密钥生成和加密处理的资源就越少。
一个设备内的内存资源也是有限的,若当前大量的内存资源被占用,则用于加密的内存就减少了,若此时需要加密大量的帧,则必然导致发送端自身卡顿和接收端的视频接收延时大等问题。
一个设备的剩余电量决定了该设备的剩余待机时长,若剩余电量越大,则说明设备的待机时长越长,加密更多的帧,不会是的设备很快就出现电量耗尽的现象。
在一些实施例中,所述抽样帧数,包括:
第一取值和第二取值中的较大值,其中,所述第一取值为:所述可用内存容量与第一参数的乘积,与单个视频帧的数据量的比值;其中,所述第一参数为小于1的正数;所述第二取值为:所述I帧总数与第二参数的比值;所述第二参数为大于1的正数。
所述第一参数可为0到1之间的任意比值,例如,0.2、0.3或者0.4等。
所述第二参数可为任意大于或等于2的正整数。示例性地,所述第二参数可为2。
示例性地,所述采样帧数=MAX(发送端可用资源*第一参数/单个视频帧的数据量,I帧总数/第二参数)。若第一参数为0.2,第二参数为2;则采样帧数==MAX(发送端可用资源*0.2/单个视频帧的数据量,I帧总数/2)。
采用这种方式,即便在发送端的资源空闲比较多时,抽取帧数越大,则被加密的第一视频的安全性越高,而在发送端的资源比较紧张时,也确保了抽样帧数不小于I帧总数与第二参数之间的比值,确保了第二视频的基本安全性。
可以理解地,在所述剩余电量小于第一阈值时,所述抽样帧数与所述剩余电量的正相关;或者,在所述负载率大于第二阈值时,所述抽样帧数与所述负载率的负相关。
示例性地,所述第一阈值可为50%或者70%。
所述第二阈值可为30%或40%等。
所述第一阈值和第二阈值可为预先确定的历史值或者经验值。
在一些实施例中,若所述发送端的设备为有线设备或者当前正在充电,则可以忽略剩余电量这一参考因素,基于其他参考因素确定抽样帧数。
可以理解地,若发送端的设备为移动设备,例如,未处于充电状态的移动设备时,在考虑抽样帧数时需要考虑剩余电量。示例性地,若剩余电量大于50%时,前述第二参数的取值固定,若剩余 电量小于50%,则剩余电量越小则所述第二参数的取值可越大。此处的50%即为所述第一阈值。
在一些实施例中,所述方法还包括:
根据所述发送端的可用线程数量,确定用于所述第一视频加密的线程数量;
根据所述线程数量,分配进行所述第一视频加密的线程,其中,当所述线程数量大于或等于2时,多个所述线程进行所述待加密帧的并行抽样和/或加密。
若发送端的可用线程数越多,则说明发送端的资源空闲率越高,可以分配用于待加密帧的抽样和/或执行加密的线程数就越多。
在本公开实施例中,分配给第一视频加密的线程数大于1,则多个线程可以并行抽样和加密,从而提升第一视频的加密速率。
在一些实施例中,所述向接收端分别发送所述第二视频及所述加密信息,包括:
通过长连接向所述接收端发送所述加密信息;
通过短连接向所述接收端发送所述第二视频。
发送端和接收端之间可以建立不同类型的连接,例如,发送端和接收端可以通过不同过的连接分别发送第二视频和加密信息,如此非法设备不会一次性同时获得第二视频和加密信息。
长连接建立之后长时间不断开,示例性地,长连接会通过心跳数据包的传输检测长连接是否维持连接状态。若通过心跳数据包的发送,确定出长连接断开,则重建该长连接。
短连接是每一数据包收发时才建立的通信连接,通常短连接多用于频繁的点对点通信。
通过长连接和短连接分别传输加密信息和所述第二视频,能够再次提升所述第一视频的安全性。
在一些实施例中,所述加密信息包括:所述加密密钥。若加密信息携带有加密密钥,则接收端成功接收到加密信息之后,就能够知晓第一视频的加密密钥。
但是接收端如何知晓发送的加密了哪些帧,发送端和接收端同样可以基于加密信息进行协商,也可以按照发送端和接收端都知晓的方式确定。例如,发送端和接收端预先协商好每隔预设帧就抽取一个帧加密,则此时发送端不用通过加密信息告知接收端哪些帧加密了。
示例性地,若第二视频包含多个加密密钥时,所述加密信息中相邻两个加密密钥的排列顺序,与加密帧在第二视频中的排列顺序是一致的。第n个加密密钥为第二视频中第n个加密帧的加密密钥。
又示例性地,为了再次提升安全性,加密信息中的多个加密密钥按照预设映射关系排列,接收端接收到加密信息之后需要根据预设映射关系获取对应加密帧的加密密钥。
例如,任意相邻两个加密帧的加密密钥,在加密信息中相隔有m个加密密钥。此时,假设解密第一个加密帧的加密密钥为加密信息中的第1个加密密钥,则解密第二加密帧的加密密钥可为第m+2个加密密钥。加密第x个加密帧的加密密钥为加密信息中第p个加密密钥,则第x+1个加密帧的加密密钥可为:加密信息中第p+m+1个加密密钥或第p-m-1个加密密钥。若p+m+1大于加密信息中密钥总个数,则必然地第x+1个加密帧的加密密钥为第p-m-1个加密密钥。若p-m-1小于0,则第x+1个加密帧的加密密钥为第p+m+1个加密密钥。
通过这种方式,即便某一个非法设备获取了加密信息和第二视频,但是不知道上述映射关系,也是无法成功解密第二视频的或者解密第二视频的难度大等。
在本公开实施例中,所述加密帧的帧头携带有加密标识;其中,所述加密标识,用于供所述接收端确定所述第二视频中的加密帧。
在对第二视频编码时,相邻两帧之间会插入起始码(start code)用于分割相邻两个视频帧,每一个视频帧包括一个头部(header)和数据单元。头部可为一个字节。数据单元可携带对应视频帧的原始数据。
在本公开实施例中,第二视频中包含加密帧和未加密帧,可以通过该头部内加密标识指示对应帧的数据单元是否加密。例如,每一个视频的头部内有一个比特,该比特为1指示该帧的数据单元加密了(该帧为加密帧),该比特为0指示该帧的数据单元未加密(该帧为非加密帧或成为未加密帧)。
如此,接收端在解密时,可以根据各个视频帧的头部,确定出加密帧。
在一些实施例中,第二视频自身的头部不进行任何改进,如此若仅仅是接收到第二视频是无法区分出哪些是加密帧,哪些是未加密帧的。此时,所述加密信息包括:加密帧的帧标识,其中,所述帧标识,用于供所述接收端确定第二视频中的加密帧。
此时加密帧的帧标识携带加密信息中。如此,接收端接收到加密信息将会同时知晓加密帧和加密标识。示例性地,帧标识可包括但不限于:视频帧的帧编号。
如图4所示,本公开实施例提供一种视频处理方法,应用于接收端中,所述方法包括:
S210:接收第二视频;
S220:接收加密信息;
S230:确定所述第二视频包含的加密帧;
S240:根据所述加密信息得到加密密钥,解密所述加密帧得到解密帧;所述加密密钥是根据所述加密帧未加密时的帧信息生成的;
S250:利用所述解密帧替换所述第二视频中的所述加密帧,得到第一视频。
本公开实施例提供过的视频处理方法,应用于接收端中,该接收端从发送端接收的视频为同时包含加密帧和非加密帧的第二视频。
例如,接收端可以向发送端发送第一视频的请求,如此,发送端基于接收端发送的请求,向接收端发送第二视频。如此,接收端将接收第二视频。第二视频中包含加密帧和非加密帧。且加密帧的加密密钥是基于对应加密帧的帧信息生成的。在本公开实施例中,第二视频和加密信息的接收是相互独立的,因此加密信息和第二视频之间的接收可以没有一定的先后顺序。
在本公开实施例中,第二视频和加密信息为分别接收的,例如,一个通过点对点传输方式接收,另一个是经过服务器转发的方式接收的。再例如,第二视频和加密信息是通过不同类型的连接接收的。
确定第二视频包含的加密帧所在位置,例如,确定第二视频中加密帧的位置。
确定出加密帧之后,将根据加密信息确定的加密密钥去解密对应的帧。
解密之后就解密帧,解密帧就被还原的原始帧,并将解密帧插入到对应的加密帧所在位置,就将第二视频恢复成第一视频。
此时的第一视频可为直接播放的未加密视频。
本公开实施例中,对应视频帧加密使用的加密密钥是根据该帧的帧信息生成的。因此,不同待加密帧的加密密钥不同,从而即便一个待加密帧的加密密钥泄露,对整个第二视频的解密而言也没有什么重大的影响,从而提升了第二视频的安全性。
在一些实施例中,所述加密信息包括:所述加密密钥。
如此,在接收到所述加密信息之后,就能够获取到所述加密密钥。
在一些实施例中,所述加密信息可为获取所述加密密钥的相关信息,该相关信息包括但不限于:存储地址,如此可以到该存储地址去读取加密密钥。
在另一些实施例中个,该相关信息还可包括:存储地址和授权信息。接收端接收到该加密信息之后,基于该存储地址发起阅读请求,该阅读请求携带有该存储地址和授权信息,该授权信息用于供存储有该加密密钥的服务器确定该请求端是否具有读取权限,若有读取权限则根据该存储地址处存储的加密密钥返回。如此,接收端可以根据该相关信息获取到所述加密密钥。
所述S230可包括:
根据所述加密信息包含的帧标识,确定所述第二视频包含的加密帧;
或者,
根据所述第二视频中加密帧的帧头携带的加密标识,确定所述第二视频包含的所述加密帧。
在一些实施例中,所述加密信息还携带有加密帧的帧标识,示例性地该帧标识包括但不限于帧编号。根据该帧标识,接收端将简便的从第二视频中确定出加密帧。
在另一些实施例中,所述第二视频包含的加密帧的帧头携带有帧标识,如此,接收端接收到第二视频,可以通过解码帧头就能够知晓第二视频中哪些视频帧是加密帧,哪些是未加密帧。
在一些实施例中,发送端和接收端还可以预先约定加密哪些帧,例如,约定第二视频中每个预设个帧中掺杂一个加密帧,采用这种方式时,接收端在接收到第二视频之后,可以等间隔的从第二视频中抽取出加密帧。
总之,接收端知晓第二视频中加密帧的方式有多种,不局限于任意一种。
在一些实施例中,所述S210可包括:在短连接上接收所述第二视频;
所述S220可包括:在长连接上接收所述加密信息。
在本公开实施例中,短连接和长连接是不同的连接方式,所述第二视频和加密信息不仅分开接收,而且是分不同类型的连接接收,从而再次保证第二视频和加密信息传输的隔离度,确保了视频的安全性。
以下结合上述任意实施例提供一个具体示例:
在相关技术中,视频加密主要包括在线视频加密和离线视频加密:
在线视频加密,指的是有视频网站、APP、小程序等在线播放视频平台,对视频进行加密。优 点是手机或者电脑可以通过相应程序直接打开观看,缺点是加密强度比较低。
离线视频加密,指的是对自己录制的视频,通过加密软件对视频进行版权保护。一般流程是通过加密工具将视频进行加密,然后发给用户,通过激活码或者密钥激活观看,绑定特定设备播放。优点是加密安全性高了很多,缺点是密钥安全性不足,在现实情况下,并不是加密算法被破解,而是密钥被人为泄露了。由于密钥和视频内容几乎是没有关联的,而是跟产品平台相关,黑客可以通过已获得的密钥,破解出一类或者相关产品的密钥,从而能直接观看到所有加密过的视频。这对视频平台或者视频产权公司来言,密钥泄露会造成巨大的损失。
针对离线视频加密这种方式,一旦密钥泄露,对视频产权和视频APP公司来说,危害特别大。究其原因是,常见的加密算法通常由随机数或者其他与视频内容不相关的数据所所产生,从而导致密钥和视频本身内容本来没有太多的关联度。
针对离线视频加密的问题,提出了一种基于视频内容关联的离线视频加密策略。即使密钥发生了泄露,黑客也不能破解出其他或者相关产品的密钥,从而给视频APP公司造成重大损失。
加密密钥直接由视频内容的关键帧数据所产生。该关键帧包括但不限于:I帧。
加密流程:
(a)根据移动端设备的硬件计算资源和视频参数,选择合适的关键帧提取和采样策略;
(b)对原始视频进行按照特定关键帧抽取操作;
(c)将抽取出来的关键帧按照特定采样算法进行编码成加密密钥;
(d)对原始视频进行关键帧剔除并完成加密操作;
(e)将加密后的加密帧插入到对应关键帧的位置,得到包含加密帧的视频。
解密流程:接收端拿到加密密钥,对加密视频进行解密还原出原始视频。
本公开实施例提供的技术方案,具有安全性高的特点。加密密钥和加密后视频两者组成了完整的原始视频,加密后的视频,在没有加密密钥的情况下,理论上是很难被破解的。不同视频之间内容是没有关联的。即使加密密钥被泄露了,黑客也无法基于一个视频的加密密钥推测出其他视频的加密密钥,从而破解其他加密的视频。即使对视频加密时采用的加密算法本身被破解了,也无法对密钥进行破解。
适应性强:的方案是基于不同设备的性能和当前状态进行动态调整,选择合适的视频内容样本作为密钥生产的资料,可以适配绝大多数的移动端设备。
移动端的应用程序(Application,App)读入待加密视频,并获取视频的参数。该视频参数可包括:视频大小、编码格式、帧率和/或时长等。
获取当前手机设备的硬件计算资源相关信息,包括CPU信息、内存信息和/或电量信息等。
该CPU信息可包括:CPU型号和/或CPU利用率。该内存信息可包括:RAM和/或ROM的剩余率。该电量信息可包括:剩余电量和/或估算的剩余待机时长。
根据当前手机的计算资源情况,结合视频的相关参数,选择密钥产生时,关键帧抽取方式及采样策略。
以下提供几种关键帧抽取的方式:包括:
(a).直接使用H.264编码的I帧,I帧能独立恢复成图像,B帧和P帧需要借助于前后帧进行街按摩。
(b).基于镜头的方式,具体为先按照某种技术手段把源视频文件按照镜头变化分割,然后在视频每个镜头中选择首、尾两帧作为关键帧。
(c).基于运动分析的方法.在视频镜头中分析物体运动的光流量,每次选择视频镜头中光流移动次数最少的视频帧作为提取到的关键帧。
(d).基于视频聚类的方法,通过聚类把视频帧划分为若干个簇,这一过程结束后在每个簇中选取相应的帧作为关键帧。
常见的采样策略方式,包括:随机采样、随机欠采样和过采样、基于聚类中心的采样、分组采样、分层采样等。
具体实现的策略,会基于视频相关参数和手机性能参数选择采样策略,具体如下:
单个视频帧大小VS=视频宽度*视频高度*8字节数
视频帧率FPS=每秒显示的帧数
视频帧间间隔GOP=两个I帧之间的间隔
视频总I帧数=视频总时长*FPS/GOP
采样总数N=MAX(手机设备的当前最大可分配内存容量*0.2/VS,视频总I帧数/2)
采样支持的线程数:
一次最大采样数<=手机设备的当前最大可分配线程数*0.5
抽样策略:
使用蓄水池抽样方法,当知道需要抽样的N的值时使用一个超大随机数对N取余数,那么该位置的对象就是所求的对象,选中的概率是1/N。
对读入的视频,进行关键帧抽取操作,标记整个视频中关键帧的位置,并且按照采样策略,从中选取关键帧,生成密钥。与此同时,并将关键帧相对应的位置标记为已选状态。
对已选状态的帧号,进行帧替换操作。示例性地,将加密帧替换未加密的原始帧,得到加密后的视频。
图5是发送端为移动端为例进行举例说明,应用于移动端中的加密密钥生成方法可包括:
移动端计算视频抽样帧数N;
基于伪随机函数rand()%N确定待抽样帧在视频中的位置;
根据确定的位置,对视频进行关键帧抽取,按照采样策略生成加密密钥。
利用对关键帧的像素值基于采样策略的采样结果,生成所述加密密钥;利用该加密密钥加密该视频帧,将加密帧替换到未加密的关键帧,就得到前述的第二视频。
图6是发送端为移动端为例进行举例说明,应用于移动端中的视频处理方法可包括:
移动端(App)读取原始视频,并且获取视频参数;
获取移动端油腻感计算资源的相关信息;
选择合适的关键帧抽取策略(示例性地该策略可为前述第一抽样策略和第二抽样策略)及采样策略,该采样策略可以用于采样关键帧的像素值,基于采样的像素值就可以生成加密密钥;
对原视频进行关键帧替换好,完成视频加密操作。
如图7所示,本公开实施例提供一种视频处理装置,所述装置包括:
抽取模块110,被配置为从待传输的第一视频中抽取至少一个待加密帧;
生成模块120,被配置为根据所述待加密帧的帧信息,生成加密密钥;
加密模块130,被配置为利用所述加密密钥加密所述待加密帧,生成加密帧;
替换模块140,被配置为利用加密帧替换所述第一视频中待加密帧,得到第二视频;
发送模块150,被配置为向接收端分别发送所述第二视频及所述加密信息,其中,所述加密信息,用于供所述接收端解密所述第二视频以还原出所述第一视频。
该视频处理装置可包含在发送端中。
在一些实施例中,所述抽取模块110、所述生成模块120、所述加密模块130、所述替换模块140和发送模块150均可为程序模块;所述程序模块被处理器执行之后,能够确定待加密帧、生成加密密钥、加密得到加密帧并通过加密帧和未加密帧的替换形成第二视频。
在一些实施例中,所述抽取模块110、所述生成模块120、所述加密模块130、所述替换模块140和发送模块150均可为软硬结合模块;所述软硬结合模块包括但不限于:可编程阵列;所述可编程阵列包括但不限于复杂可编程阵列或者现场可编程阵列。
在还有一些实施例中,所述抽取模块110、所述生成模块120、所述加密模块130、所述替换模块140和发送模块150均可为软硬结合模块;所述软硬结合模块还可为纯硬件模块;所述纯硬件模块包括但不限于:专用集成电路。
在一些实施例中,具体用于从第n个待加密帧抽取预设个像素的像素值,生成所述第n个待加密帧的所述加密密钥;其中,所述n为自然数。
在一些实施例中,所述抽取模块110,被配置为按照第一抽样策略,从待传输的所述第一视频中随机抽取至少一个待加密帧;或者,按照第二抽样策略,从待传输的所述第一视频中抽取信息熵满足预设条件的至少一个待加密帧。
在一些实施例中,所述抽取模块110,被配置为按照所述第二抽样策略,从所述第一视频的待抽样单位中抽取信息熵最小的一个或多个视频帧作为所述待加密帧;或者,按照所述第二抽样策略,从所述第一视频的待抽样单位中抽取信息熵从大到小排序在预设位置的一个或多个视频帧作为所述待加密帧。
在一些实施例中,所述抽取模块110,被配置为执行以下至少之一:
在所述第二抽样策略为I帧抽样策略,从所述第一视频中待抽样画面组GOP抽取I帧为所述待加密帧;其中,一个所述GOP包括:一个I帧和依赖所述I帧的至少一个B帧和/或依赖所述I帧的至少一个P帧;
在所述第二抽样策略为镜头抽样策略,从所述第一视频中从待抽样镜头中抽取预定帧作为所述待加密帧,其中,所述预定帧包括:待抽样镜头的首帧和/或尾帧;
在所述第二抽样策略为基于运动分析的抽样策略时,从所述第一视频中抽取光流移动次数满足预设条件的视频帧为所述待加密帧;
在所述第二抽样策略为基于聚类结果的抽样策略时,将所述第一视频的视频帧进行基于帧信息相似度的聚类得到包括至少一个视频帧的聚类簇,并从待抽样的所述聚类簇中抽取信息熵最小的视频帧为所述待加密帧;
在所述第二抽样策略为基于分组的抽样策略时,将所述第一视频按照播放顺序分为多个分组,从待抽样所述分组中抽取信息熵最小的视频帧作为所述待加密帧;其中,一个所述分组包括:多个在时域上连续播放的视频帧;
在所述第二抽样策略为基于分层的抽样策略时,获取所述第一视频在频率的频率分布,根据所述频率分布从所述第一视频中抽取包含预设频率分量的视频帧为所述待加密帧。
在一些实施例中,所述装置还包括:
第一确定模块,被配置为根据视频参数和所述发送端的资源使用状况信息,确定所述待加密帧的抽样帧数。
在一些实施例中,所述视频参数,包括以下至少之一:
根据所述第一视频的单个视频帧的数据量;
所述第一视频的I帧总数;
和/或,
所述资源使用状况信息包括以下至少之一:
处理器的信息;
可用内存容量;
剩余电量。
在一些实施例中,所述抽样帧数,包括:
第一取值和第二取值中的较大值,其中,所述第一取值为:所述可用内存容量与第一参数的乘积,与单个视频帧的数据量的比值;其中,所述第一参数为小于1的正数;所述第二取值为:所述I帧总数与第二参数的比值;所述第二参数为大于1的正数。
在一些实施例中,在所述剩余电量小于第一阈值时,所述抽样帧数与所述剩余电量的正相关;
或者,
所述处理器的信息包括:负载率;在所述负载率大于第二阈值时,所述抽样帧数与所述负载率的负相关。
在一些实施例中,所述装置还包括:
第二确定模块,被配置为根据所述发送端的可用线程数量,确定用于所述第一视频加密的线程数量;
分配模块,用于根据所述线程数量,分配进行所述第一视频加密的线程,其中,当所述线程数量大于或等于2时,多个所述线程进行所述待加密帧的并行抽样和/或加密。
在一些实施例中,所述发送模块150,被配置为通过长连接向所述接收端发送所述加密信息;通过短连接向所述接收端发送所述第二视频。
在一些实施例中,所述加密信息包括:所述加密密钥;
所述加密帧的帧头携带有加密标识;其中,所述加密标识,用于供所述接收端确定所述第二视频中的加密帧;
或者,
所述加密信息包括:加密帧的帧标识,其中,所述帧标识,用于供所述接收端。
如图8所示,本公开实施例提供一种视频处理装置,所述装置包括:
接收模块210,被配置为接收第二视频;接收加密信息;
第三确定模块220,被配置为确定所述第二视频包含的加密帧;
解密模块230,被配置为根据所述加密信息得到加密密钥,解密所述加密帧得到解密帧;所述加密密钥是根据所述加密帧未加密时的帧信息生成的;
还原模块240,被配置为利用所述解密帧替换所述第二视频中的所述加密帧,得到第一视频。
在一些实施例中,所述接收模块210、所述第三确定模块220、所述解密模块230及所述还原模块240可为程序模块;所述程序模块被处理器执行之后接收到第二视频、加密信息并成功解码第二视频还原得到第一视频。
在一些实施例中,所述接收模块210、所述第三确定模块220、所述解密模块230及所述还原模块240均可为软硬结合模块;所述软硬结合模块包括但不限于:可编程阵列;所述可编程阵列包括但不限于复杂可编程阵列或者现场可编程阵列。
在一些实施例中,所述接收模块210、所述第三确定模块220、所述解密模块230及所述还原模块240均可为软硬结合模块;所述软硬结合模块还可为纯硬件模块;所述纯硬件模块包括但不限于:专用集成电路。
在一些实施例中,所述加密信息包括:所述加密密钥;
所述第三确定模块220,被配置为根据所述加密信息包含的帧标识,确定所述第二视频包含的加密帧;或者,根据所述第二视频中加密帧的帧头携带的加密标识,确定所述第二视频包含的所述加密帧。
在一些实施例中,所述接收模块210,被配置为在短连接上接收所述第二视频;在长连接上接收所述加密信息。
本公开实施例提供一种电子设备,包括:
用于存储处理器可执行指令的存储器;
处理器,分别存储器连接;
其中,处理器被配置为通过执行存储在所述存储器上的计算机可执行指令,能够执行前述任意 技术方案提供的视频处理方法。
处理器可包括各种类型的存储介质,该存储介质为非临时性计算机存储介质,在移动终端掉电之后能够继续记忆存储其上的信息。
所述处理器可以通过总线等与存储器连接,用于读取存储器上存储的可执行程序,例如,如图1、图3至图6任一所示的方法的至少其中之一。
图9是根据一示例性实施例示出的一种电子设备800的框图。例如,电子设备800可以是移动电话,移动电脑等。该电子设备可为前述的发送端和/或接收端。
参照图9,电子设备800可以包括以下一个或多个组件:处理组件802,存储器804,电源组件806,多媒体组件808,音频组件810,输入/输出(I/O)的接口812,传感器组件814,以及通信组件816。
处理组件802通常控制电子设备800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。
存储器804被配置为存储各种类型的数据以支持在设备800的操作。这些数据的示例包括用于在电子设备800上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。
电源组件806为电子设备800的各种组件提供电力。电力组件806可以包括电源管理系统,一个或多个电源,及其他与为电子设备800生成、管理和分配电力相关联的组件。
多媒体组件808包括在电子设备800和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件808包括一个前置摄像头和/或后置摄像头。当设备800处于操作状态,如拍摄状态或视频状态时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。
音频组件810被配置为输出和/或输入音频信号。例如,音频组件810包括一个麦克风(MIC),当电子设备800处于操作状态,如呼叫状态、记录状态和语音识别状态时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器804或经由通信组件816发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。
I/O接口812为处理组件802和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。
传感器组件814包括一个或多个传感器,用于为电子设备800提供各个方面的状态评估。例如,传感器组件814可以检测到设备800的打开/关闭状态,组件的相对定位,例如组件为电子设备800的显示器和小键盘,传感器组件814还可以检测电子设备800或电子设备800一个组件的位置改变,用户与电子设备800接触的存在或不存在,电子设备800方位或加速/减速和电子设备800的温度变化。传感器组件814可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件814还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件814还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。
通信组件816被配置为便于电子设备800和其他设备之间有线或无线方式的通信。电子设备800可以接入基于通信标准的无线网络,如Wi-Fi,2G或3G,或它们的组合。在一个示例性实施例中,通信组件816经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,通信组件816还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。
在示例性实施例中,电子设备800可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。
在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器804,上述指令可由电子设备800的处理器820执行以完成上述方法。例如,非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。
本公开实施例提供一种非临时性计算机可读存储介质,当存储介质中的指令由移动终端的处理器执行时,使得移动终端能够执行前述任意实施例提供的图像采集的提示方法,能够执行如如图1、图3至图6任一所示方法的至少其中之一。
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本发明的其它实施方案。本申请旨在涵盖本发明的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本发明的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本发明的真正范围和精神由下面的权利要求指出。
应当理解的是,本发明并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本发明的范围仅由所附的权利要求来限制。

Claims (25)

  1. 一种视频处理方法,由发送端执行,所述方法包括:
    从待传输的第一视频中抽取至少一个待加密帧;
    根据所述待加密帧的帧信息,生成加密密钥;
    利用所述加密密钥加密所述待加密帧,生成加密帧;
    利用加密帧替换所述第一视频中待加密帧,得到第二视频;
    向接收端分别发送所述第二视频及所述加密信息,其中,所述加密信息,用于供所述接收端解密所述第二视频以还原出所述第一视频。
  2. 根据权利要求1所述的方法,所述根据所述待加密帧的帧信息,生成加密密钥,包括:
    从第n个待加密帧抽取预设个像素的像素值,生成所述第n个待加密帧的所述加密密钥;其中,所述n为自然数。
  3. 根据权利要求1所述的方法,其中,所述从待传输的第一视频中抽取至少一个待加密帧,包括:
    按照第一抽样策略,从待传输的所述第一视频中随机抽取至少一个待加密帧;
    或者,
    按照第二抽样策略,从待传输的所述第一视频中抽取信息熵满足预设条件的至少一个待加密帧。
  4. 根据权利要求3所述的方法,其中,所述按照第二抽样策略,从待传输的所述第一视频中抽取信息熵满足预设条件的至少一个待加密帧,包括:
    按照所述第二抽样策略,从所述第一视频的待抽样单位中抽取信息熵最小的一个或多个视频帧作为所述待加密帧;
    或者,
    按照所述第二抽样策略,从所述第一视频的待抽样单位中抽取信息熵从大到小排序在预设位置的一个或多个视频帧作为所述待加密帧。
  5. 根据权利要求3所述的方法,其中,所述按照第二抽样策略,从待传输的所述第一视频中抽取信息熵满足预设条件的至少一个待加密帧,包括以下至少之一:
    在所述第二抽样策略为I帧抽样策略,从所述第一视频中待抽样画面组GOP抽取I帧为所述待加密帧;其中,一个所述GOP包括:一个I帧和依赖所述I帧的至少一个B帧和/或依赖所述I帧的至少一个P帧;
    在所述第二抽样策略为镜头抽样策略,从所述第一视频中从待抽样镜头中抽取预定帧作为所述待加密帧,其中,所述预定帧包括:待抽样镜头的首帧和/或尾帧;
    在所述第二抽样策略为基于运动分析的抽样策略时,从所述第一视频中抽取光流移动次数满足预设条件的视频帧为所述待加密帧;
    在所述第二抽样策略为基于聚类结果的抽样策略时,将所述第一视频的视频帧进行基于帧信息 相似度的聚类得到包括至少一个视频帧的聚类簇,并从待抽样的所述聚类簇中抽取信息熵最小的视频帧为所述待加密帧;
    在所述第二抽样策略为基于分组的抽样策略时,将所述第一视频按照播放顺序分为多个分组,从待抽样所述分组中抽取信息熵最小的视频帧作为所述待加密帧;其中,一个所述分组包括:多个在时域上连续播放的视频帧;
    在所述第二抽样策略为基于分层的抽样策略时,获取所述第一视频在频率的频率分布,根据所述频率分布从所述第一视频中抽取包含预设频率分量的视频帧为所述待加密帧。
  6. 根据权利要求1至5任一项所述的方法,其中,所述方法还包括:
    根据视频参数和所述发送端的资源使用状况信息,确定所述待加密帧的抽样帧数。
  7. 根据权利要求6所述的方法,其中,所述视频参数,包括以下至少之一:
    根据所述第一视频的单个视频帧的数据量;
    所述第一视频的I帧总数;
    和/或,
    所述资源使用状况信息包括以下至少之一:
    处理器的信息;
    可用内存容量;
    剩余电量。
  8. 根据权利要求7所述的方法,其中,所述抽样帧数,包括:
    第一取值和第二取值中的较大值,其中,所述第一取值为:所述可用内存容量与第一参数的乘积,与单个视频帧的数据量的比值;其中,所述第一参数为小于1的正数;所述第二取值为:所述I帧总数与第二参数的比值;所述第二参数为大于1的正数。
  9. 根据权利要求7所述的方法,其中,
    在所述剩余电量小于第一阈值时,所述抽样帧数与所述剩余电量的正相关;
    或者,
    所述处理器的信息包括:负载率;在所述负载率大于第二阈值时,所述抽样帧数与所述负载率的负相关。
  10. 根据权利要求1至5任一项所述的方法,其中,所述方法还包括:
    根据所述发送端的可用线程数量,确定用于所述第一视频加密的线程数量;
    根据所述线程数量,分配进行所述第一视频加密的线程,其中,当所述线程数量大于或等于2时,多个所述线程进行所述待加密帧的并行抽样和/或加密。
  11. 根据权利要求1至5任一项所述的方法,其中,所述向接收端分别发送所述第二视频及所述加密信息,包括:
    通过长连接向所述接收端发送所述加密信息;
    通过短连接向所述接收端发送所述第二视频。
  12. 根据权利要求1至5任一项所述的方法,其中,所述加密信息包括:所述加密密钥;
    所述加密帧的帧头携带有加密标识;其中,所述加密标识,用于供所述接收端确定所述第二视频中的加密帧;
    或者,
    所述加密信息包括:加密帧的帧标识,其中,所述帧标识,用于供所述接收端。
  13. 一种视频处理方法,其中,由接收端执行,所述方法包括:
    接收第二视频;
    接收加密信息;
    确定所述第二视频包含的加密帧;
    根据所述加密信息得到加密密钥,解密所述加密帧得到解密帧;所述加密密钥是根据所述加密帧未加密时的帧信息生成的;
    利用所述解密帧替换所述第二视频中的所述加密帧,得到第一视频。
  14. 根据权利要求13所述的方法,其中,所述加密信息包括:所述加密密钥;
    所述确定所述第二视频包含的加密帧,包括:
    根据所述加密信息包含的帧标识,确定所述第二视频包含的加密帧;
    或者,
    根据所述第二视频中加密帧的帧头携带的加密标识,确定所述第二视频包含的所述加密帧。
  15. 根据权利要求13所述的方法,其中,所述接收第二视频,包括:
    在短连接上接收所述第二视频;
    所述接收加密信息,包括:
    在长连接上接收所述加密信息。
  16. 一种视频处理装置,其中,所述装置包括:
    抽取模块,被配置为从待传输的第一视频中抽取至少一个待加密帧;
    生成模块,被配置为根据所述待加密帧的帧信息,生成加密密钥;
    加密模块,被配置为利用所述加密密钥加密所述待加密帧,生成加密帧;
    替换模块,被配置为利用加密帧替换所述第一视频中待加密帧,得到第二视频;
    发送模块,被配置为向接收端分别发送所述第二视频及所述加密信息,其中,所述加密信息,用于供所述接收端解密所述第二视频以还原出所述第一视频。
  17. 根据权利要求16所述的装置,所述生成模块,被配置为从第n个待加密帧抽取预设个像素的像素值,生成所述第n个待加密帧的所述加密密钥;其中,所述n为自然数。
  18. 根据权利要求16所述的装置,其中,所述抽取模块,被配置为按照第一抽样策略,从待传输的所述第一视频中随机抽取至少一个待加密帧;或者,按照第二抽样策略,从待传输的所述第一视频中抽取信息熵满足预设条件的至少一个待加密帧。
  19. 根据权利要求16至18任一项所述的装置,其中,所述装置还包括:
    第一确定模块,被配置为根据视频参数和所述发送端的资源使用状况信息,确定所述待加密帧的抽样帧数。
  20. 根据权利要求16至18任一项所述的装置,其中,所述装置还包括:
    第二确定模块,被配置为根据所述发送端的可用线程数量,确定用于所述第一视频加密的线程数量;
    分配模块,被配置为根据所述线程数量,分配进行所述第一视频加密的线程,其中,当所述线程数量大于或等于2时,多个所述线程进行所述待加密帧的并行抽样和/或加密。
  21. 根据权利要求16至18任一项所述的装置,其中,所述发送模块,被配置为通过长连接向所述接收端发送所述加密信息;通过短连接向所述接收端发送所述第二视频。
  22. 一种视频处理装置,其中,所述装置包括:
    接收模块,被配置为接收第二视频;接收加密信息;
    第三确定模块,被配置为确定所述第二视频包含的加密帧;
    解密模块,被配置为根据所述加密信息得到加密密钥,解密所述加密帧得到解密帧;所述加密密钥是根据所述加密帧未加密时的帧信息生成的;
    还原模块,被配置为利用所述解密帧替换所述第二视频中的所述加密帧,得到第一视频。
  23. 根据权利要求22所述的装置,其中,所述加密信息包括:所述加密密钥;
    所述第三确定模块,被配置为根据所述加密信息包含的帧标识,确定所述第二视频包含的加密帧;或者,根据所述第二视频中加密帧的帧头携带的加密标识,确定所述第二视频包含的所述加密帧。
  24. 一种电子设备,其中,包括:
    用于存储处理器可执行指令的存储器;
    处理器,与所述存储器连接;
    其中,所述处理器被配置为执行如权利要求1至12或者13至15中任一项提供的图像采集的提示方法。
  25. 一种非临时性计算机可读存储介质,其中,所述计算机可读存储介质中存储有计算机可执行指令,该计算机可执行指令被处理器执行时实现权利要求1至12或者13至15中任一项提供的图像采集的提示方法。
PCT/CN2022/087718 2021-06-10 2022-04-19 视频处理方法及装置、电子设备及存储介质 WO2022257612A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110649162.8 2021-06-10
CN202110649162.8A CN113422984B (zh) 2021-06-10 2021-06-10 视频处理方法及装置、电子设备及存储介质

Publications (1)

Publication Number Publication Date
WO2022257612A1 true WO2022257612A1 (zh) 2022-12-15

Family

ID=77788272

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/087718 WO2022257612A1 (zh) 2021-06-10 2022-04-19 视频处理方法及装置、电子设备及存储介质

Country Status (2)

Country Link
CN (1) CN113422984B (zh)
WO (1) WO2022257612A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113422984B (zh) * 2021-06-10 2022-10-14 北京快乐茄信息技术有限公司 视频处理方法及装置、电子设备及存储介质
CN115119016A (zh) * 2022-06-29 2022-09-27 王雨佳 一种信息数据加密算法
CN115119199B (zh) * 2022-08-30 2022-12-02 国网湖北省电力有限公司技术培训中心 基于星链无人机组的信息传递方法及设备

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160142746A1 (en) * 2014-11-14 2016-05-19 Thales Avionics, Inc. Method of encrypting, streaming, and displaying video content using selective encryption
US20180014041A1 (en) * 2016-07-07 2018-01-11 Time Warner Cable Enterprises Llc Apparatus and methods for presentation of key frames in encrypted content
CN109635586A (zh) * 2018-12-13 2019-04-16 苏州科达科技股份有限公司 媒体文件加密密钥管理方法、系统、设备及存储介质
CN110557680A (zh) * 2019-07-30 2019-12-10 视联动力信息技术股份有限公司 一种音视频数据帧传输方法和系统
CN111031353A (zh) * 2019-12-11 2020-04-17 上海乐相科技有限公司 一种视频加密方法及装置
CN111461953A (zh) * 2020-03-30 2020-07-28 三维通信股份有限公司 图像加密方法、图像解密方法和图像传输系统
CN112003859A (zh) * 2020-08-21 2020-11-27 江苏徐工工程机械研究院有限公司 数据的加密方法、装置和解密方法、装置
CN112218161A (zh) * 2019-07-09 2021-01-12 中国移动通信有限公司研究院 一种视频加密方法、装置及设备
CN113422984A (zh) * 2021-06-10 2021-09-21 北京快乐茄信息技术有限公司 视频处理方法及装置、电子设备及存储介质

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040174998A1 (en) * 2003-03-05 2004-09-09 Xsides Corporation System and method for data encryption
CN111953656B (zh) * 2020-07-09 2024-03-19 视联动力信息技术股份有限公司 监控视频加密传输方法、装置、设备及介质

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160142746A1 (en) * 2014-11-14 2016-05-19 Thales Avionics, Inc. Method of encrypting, streaming, and displaying video content using selective encryption
US20180014041A1 (en) * 2016-07-07 2018-01-11 Time Warner Cable Enterprises Llc Apparatus and methods for presentation of key frames in encrypted content
CN109635586A (zh) * 2018-12-13 2019-04-16 苏州科达科技股份有限公司 媒体文件加密密钥管理方法、系统、设备及存储介质
CN112218161A (zh) * 2019-07-09 2021-01-12 中国移动通信有限公司研究院 一种视频加密方法、装置及设备
CN110557680A (zh) * 2019-07-30 2019-12-10 视联动力信息技术股份有限公司 一种音视频数据帧传输方法和系统
CN111031353A (zh) * 2019-12-11 2020-04-17 上海乐相科技有限公司 一种视频加密方法及装置
CN111461953A (zh) * 2020-03-30 2020-07-28 三维通信股份有限公司 图像加密方法、图像解密方法和图像传输系统
CN112003859A (zh) * 2020-08-21 2020-11-27 江苏徐工工程机械研究院有限公司 数据的加密方法、装置和解密方法、装置
CN113422984A (zh) * 2021-06-10 2021-09-21 北京快乐茄信息技术有限公司 视频处理方法及装置、电子设备及存储介质

Also Published As

Publication number Publication date
CN113422984B (zh) 2022-10-14
CN113422984A (zh) 2021-09-21

Similar Documents

Publication Publication Date Title
WO2022257612A1 (zh) 视频处理方法及装置、电子设备及存储介质
CN108989848B (zh) 一种视频资源文件的获取方法和管理系统
US10019591B1 (en) Low-latency media sharing
US9237008B2 (en) Encryption device, encryption method, and encryption program
EP2908547B1 (en) Information-processing device, information-processing system, information-processing program, and moving image data transmission/reception method adapting the frame rate of moving image data based on frame similarity
US20110170687A1 (en) Content decoding apparatus, content decoding method and integrated circuit
CN115146285A (zh) 一种文件加密、解密方法及装置
US20130251149A1 (en) Method and system for wireless transmission of content
CN110024395A (zh) 图像数据处理、传输的方法以及控制终端
CN104966525A (zh) 文件加密、解密方法和装置
US20130219177A1 (en) Secure data processing device and method
KR20140129178A (ko) 비보호 전송 서비스를 이용한 보호 콘텐츠 전송의 실현
EP3002953A1 (en) Image processing apparatus and control method thereof
US20200037005A1 (en) Video resource file acquisition method and management system
CN115208863B (zh) 码流加密和解密方法及相关装置、设备、系统和介质
CN108449600B (zh) 电影数据的传输方法及装置
CN113014956B (zh) 视频播放方法以及装置
CN113051592A (zh) 文件加密方法、装置、电子设备及存储介质
CN115701017A (zh) 一种图像处理方法及装置
US10939173B2 (en) Systems and methods for encrypting video
CN111414639B (zh) 文件加密和解密方法、装置及设备
CN114286130A (zh) 视频加密方法、视频处理方法、装置及电子设备
GB2507764A (en) Recording and playback using a review buffer for different content segments
CN109905762B (zh) 图像处理装置及其控制方法
CN109933960A (zh) 服务调用控制方法、服务调用方法、装置及终端

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22819215

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE