I converted a movie into array of frames with open-cv python for hiding some text information inside that with LSB steganography. I used LSB steganography to make a new array from all of them and use this array for remake first movie. But when recapture result video to image frames, I lost the data.
I tested that with extract steganography images, then used that was given true results with embedded my message to writing all of them into a video, so I'm sure that my problem is completely related to compression video methods.
I use two ways for write a video.
First way to write a video:
video_name = 'video.avi'
video = cv2.VideoWriter(video_name, 0, 1, (width,height))
for image in images:
video.write(cv2.imread(os.path.join(image_folder, image)))
Second way:
outvid='video.avi'
fourcc = VideoWriter_fourcc(*format)
vid = None
for image in images:
if not os.path.exists(image):
raise FileNotFoundError(image)
img = imread(image)
if vid is None:
if size is None:
size = img.shape[1], img.shape[0]
vid = VideoWriter(outvid, fourcc, float(fps=5), size, is_color)
if size[0] != img.shape[1] and size[1] != img.shape[0]:
img = resize(img, size)
vid.write(img)