Error VideoWriter - not writing anything
I want to read video then write to different video. Below is my code but video writer does not save anything. Help pls.
import numpy as np
import cv2
from tqdm import tqdm
inp = "./videos/a"
out = "b"
inpcap = cv2.VideoCapture(inp+".MP4")
outcap = cv2.VideoWriter(out+".MP4", cv2.VideoWriter_fourcc('H','2','6','4'), 30, (int(inpcap.get(3)),int(inpcap.get(4))))
print(inp)
print(out)
print(int(inpcap.get(3)),int(inpcap.get(4)))
i = 1
pbar = tqdm(total = 80000)
while(inpcap.isOpened()):
pbar.update(1)
ret, frame = inpcap.read()
if(ret == False):
break
outcap.write(frame)
inpcap.release()
outcap.release()
hello someone help
Here is tutorial to learn. Learn to read video, display video and save video
@Nbb windows or linux?
@LBerger linux
Add this before release
cv2.waitKey(0)
@LBerger is it working for you ? I am not sure why it isnt saving anything on mine
I removed pbar, pbar.update and it is working for me (windows 10 ). Try to use MJPG instead of H264. If it works it is codec problem
@Nbb. Are you using raspberry pi for linux?