When I am using OpenCV library to convert a single image to video and trying to extract a frame from the video, then both the frames and input are different as my project needs a lot of precision a single change in a pixel will change my project
import cv2
# Input image file
input_image = 'output.png'
# Output video file name
output_file = 'output_video.mp4'
# Frame rate (fps) of the output video
frame_rate = 60.0
# Read the input image
image = cv2.imread(input_image)
# Get the image dimensions
height, width, channels = image.shape
# Define the video writer object
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
video_writer = cv2.VideoWriter(output_file, fourcc, frame_rate, (width, height))
# Repeat the image to create multiple frames
for _ in range(int(frame_rate)):
video_writer.write(image)
# Release the video writer and close the output file
video_writer.release()
print("Video generation completed.")
This is my code snippet please help me with this my complete project relies on it