Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how to modify video using pixel array or shader?

Crossposted from this link https://python-forum.io/Thread-How-to-modify-video-using-pixel-array-or-shader

Hello guys I am trying to apply some effects to my video.. what I need is to apply some effects to the realvideo file.. I dont need to display the video.

I am trying to read .mp4 video then apply some effects with out showing GUI.. I just want to save it in my local file.. my codes looks like this.

import numpy as np import cv2

cap = cv2.VideoCapture('test.mp4')

fourcc = cv2.VideoWriter_fourcc(*'MP4V') #mpeg

width = int(cap.get(3)) height = int(cap.get(4)) out = cv2.VideoWriter('output.mp4',fourcc, 20.0, (width,height))

while(cap.isOpened()): ret, frame = cap.read() hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) if ret==True: frame = cv2.flip(frame,1) #0 = upside down , 1 = normal

    #I need some pixel array or shader code here to apply effects to my video.

    out.write(frame)

    #cv2.imshow('frame',frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
else:
    break

Release everything if job is finished

cap.release() out.release() cv2.destroyAllWindows()

how to modify video using pixel array or shader?

Crossposted from this link https://python-forum.io/Thread-How-to-modify-video-using-pixel-array-or-shader

Hello guys I am trying to apply some effects to my video.. what I need is to apply some effects to the realvideo file.. I dont need to display the video.

I am trying to read .mp4 video then apply some effects with out showing GUI.. I just want to save it in my local file.. my codes looks like this.

import numpy as np
import cv2

cv2 cap = cv2.VideoCapture('test.mp4')

cv2.VideoCapture('test.mp4') fourcc = cv2.VideoWriter_fourcc(*'MP4V') #mpeg

#mpeg width = int(cap.get(3)) height = int(cap.get(4)) out = cv2.VideoWriter('output.mp4',fourcc, 20.0, (width,height))

(width,height)) while(cap.isOpened()): ret, frame = cap.read() hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) if ret==True: frame = cv2.flip(frame,1) #0 = upside down , 1 = normal

normal

        #I need some pixel array or shader code here to apply effects to my video.

     out.write(frame)

     #cv2.imshow('frame',frame)
     if cv2.waitKey(1) & 0xFF == ord('q'):
         break
 else:
     break

# Release everything if job is finished

finished cap.release() out.release() cv2.destroyAllWindows()

cv2.destroyAllWindows()