-
Notifications
You must be signed in to change notification settings - Fork 185
Open
Description
gst-launch-1.0 filesrc location='video2.mp4' ! parsebin ! vah264dec ! "video/x-raw(memory:VAMemory)" ! gvapython module=full.py function=process_frame ! vapostproc ! "video/x-raw(memory:VAMemory), width=320, height=320" ! queue ! gvadetect model=yolov3.xml model-proc=yolov3.json threshold=0.8 device=GPU ! fakesink async=true
This is the pipeline I am using and I want to save each frame using gvapython , but I am getting distorted images after I save it.
here is the python code
import cv2
import numpy as np
import os
from gstgva import VideoFrame
frame_counter = 0
def process_frame(frame):
global frame_counter
# Retrieve video info
video_info = frame.video_info()
width = video_info.width
height = video_info.height
frame_counter += 1
with frame.data() as frame_data:
bgr = cv2.cvtColor(frame_data, cv2.COLOR_YUV2BGR_NV12)
os.makedirs("sent", exist_ok=True)
cv2.imwrite(f"sent/frame_{frame_counter}.jpg", frame_data)
return frame
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
