Skip to content

ValueError: Parse the argument FAILED #4

@rizwanishaq

Description

@rizwanishaq

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions