UsingNet / nvcodec-python

MIT License
21 stars 5 forks source link

ValueError: Parse the argument FAILED #4

Open rizwanishaq opened 3 years ago

rizwanishaq commented 3 years ago

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!