有没有办法将加密的视频帧写入python3中的视频数组

我正在将视频分成帧。然后,我将加密第一帧。在对第一帧进行加密之后,我想将该加密的帧写回到视频阵列,然后将该视频阵列转换为视频。

def encrypt_frames(arr,key_encrypt,iv_encrypt):
    cipher_text=np.array([])
    cipher = AES.new(key_encrypt,AES.MODE_CBC,iv_encrypt)
    cipher_text=cipher.encrypt(pad(arr,AES.block_size))
    return(cipher_text)    

def main():
   img=np.array([])
   pathIn= 'G:/murari/phd/impl/encrypt_decrypt_impl/data/'
   frames=[fr for fr in os.listdir(pathIn) if 
   os.path.isfile(os.path.join(pathIn,fr))]
   frames.sort(key=lambda y:int(y[5:-4]))
   for j in range(len(frames)):
         frame_name=pathIn+frames[j]
         print(frame_name)
   image=cv2.imread(pathIn+frames[0])

   vid_arr_bytes=image.tobytes()
   key=get_random_bytes(16)
   iv=get_random_bytes(16)
   input_for_decrypt=encrypt_frames(vid_arr_bytes,key,iv)
   img=np.frombuffer(input_for_decrypt,dtype=np.uint8) 
   cv2.imwrite('frame0.jpg',img)
   pathIn1= 'G:/murari/phd/impl/encrypt_decrypt_impl/data1/'
   pathOut = 'G:/murari/phd/impl/encrypt_decrypt_impl/data1/video.avi'
   fps = 25.0
   convert_frames_to_video(pathIn,pathOut,fps)
   decipher=decrypt_video_array(input_for_decrypt,iv)
speedisk 回答:有没有办法将加密的视频帧写入python3中的视频数组

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3169547.html

大家都在问