python - OpenCV: Without modifications, input video file smaller than output file -


i using opencv in python read video .mp4 file ~300kb in size, 1min , 20sec long. have noticed if read each frame file, , write said frame new file using opencv's functionalities, new video copy ~50mb... can explain how possible , how fix it?

the codec both files same: h.264

below code:

import numpy np import cv2  cap = cv2.videocapture('/users/video.mp4')  # define codec , create videowriter object fourcc = cv2.videowriter_fourcc(*'avc1') out = cv2.videowriter('output.mp4',fourcc, 50.0, (160, 210))  while(cap.isopened()):     ret, frame = cap.read()     if ret==true:         out.write(frame)          if cv2.waitkey(1) & 0xff == ord('q'):             break     else:         break  # release if job finished cap.release() out.release() cv2.destroyallwindows() 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -