I am trying to encode videos frames, like
from nvcodec import VideoSource, VideoDecoder, VideoEncoder
import numpy as np
import cv2
import ctypes
if __name__=="__main__":
video_stream = cv2.VideoCapture("00021.mp4")
encFile = open("test.h264", "wb")
encoder = VideoEncoder(224, 224)
while True:
success, frame = video_stream.read()
if not success:
break
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
packets = encoder.encode(frame)
print(packets)
encFile.write(packets)
encFile.close()
when I an runing the code, I am getting following error?
ValueError: Parse the argument FAILED! You should pass ABGR image numpy array by heightwidthchannel!
I am trying to encode videos frames, like from nvcodec import VideoSource, VideoDecoder, VideoEncoder
import numpy as np import cv2 import ctypes
when I an runing the code, I am getting following error? ValueError: Parse the argument FAILED! You should pass ABGR image numpy array by heightwidthchannel!