import cv2
import numpy as np
from matplotlib import pyplot as plt
from IPython.display import display
from PIL import Image
cap = cv2.VideoCapture("filesrc location=street.h264 ! h264parse ! vaapih264dec ! videoconvert ! video/x-raw,format=NV12 ! appsink")
ret, vaapi = cap.read()
cap.release()
rgb_vaapi = cv2.cvtColor(vaapi, cv2.COLOR_YUV2RGB_NV12)
display(Image.fromarray(rgb_vaapi))

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

cap = cv2.VideoCapture("filesrc location=street.h264 ! h264parse ! mfxh264dec ! videoconvert ! video/x-raw,format=NV12 ! appsink")
ret, mfx = cap.read()
cap.release()
rgb_mfx = cv2.cvtColor(mfx, cv2.COLOR_YUV2RGB_NV12)
display(Image.fromarray(rgb_mfx))

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

cap = cv2.VideoCapture("filesrc location=street.h264 ! h264parse ! avdec_h264 ! videoconvert ! video/x-raw,format=NV12 ! appsink")
ret, av = cap.read()
cap.release()
rgb_av = cv2.cvtColor(av, cv2.COLOR_YUV2RGB_NV12)
display(Image.fromarray(rgb_av))

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →