import cv2
import numpy as np

# Load your original video
cap = cv2.VideoCapture('c2.mp4')

# Get the properties of the video
fps = cap.get(cv2.CAP_PROP_FPS)
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))

# Open the writer
fourcc = cv2.VideoWriter_fourcc(*'mp4v') 
out = cv2.VideoWriter('c2_out.mp4', fourcc, fps, (width, height))

# Write original video frames to the new video
while(cap.isOpened()):
    ret, frame = cap.read()
    if ret == True:
        out.write(frame)
    else:
        break

# Load your image
img = cv2.imread('c2_tp.png')

# Resize your image to match the video
img_resized = cv2.resize(img, (width, height))

# Write the resized image as frames for the next 3 seconds
for _ in range(int(3 * fps)):
    out.write(img_resized)

# Release everything
cap.release()
out.release()
cv2.destroyAllWindows()
