Python Forum
How to modify video using pixel array or shader?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to modify video using pixel array or shader?
#1
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()
Any Help?
Reply
#2
    ret, frame = cap.read()
    if ret==True:
        hsv   = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
        frame = cv2.flip(frame,1) #0 = upside down , 1 = normal
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  modify code to accept 3d array Staph 0 1,429 Jan-01-2020, 08:24 AM
Last Post: Staph
  Button Press When Pixel Color Changes bak989 0 3,666 Apr-22-2018, 04:03 PM
Last Post: bak989
  Change color pixel in an image louloudevinci 2 38,878 Mar-25-2018, 08:27 PM
Last Post: louloudevinci

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020