This is using V4L API, not gstreamer API, so the messages are different.
Be sure the filepath is correct. This works fine for me:
import os
import cv2
print(cv2.__version__)
filepath = "/home/nvidia/Desktop/opencv/opencv/samples/data/Megamind.avi"
if os.system('ls -l '+filepath):
print('Error file not found')
exit()
cap = cv2.VideoCapture('filesrc location={} ! mpeg4videoparse ! omxmpeg4videodec ! nvvidconv ! video/x-raw,format=BGRx ! queue ! videoconvert ! queue ! video/x-raw, format=BGR ! appsink'.format(filepath), cv2.CAP_GSTREAMER)
if not cap.isOpened():
print("Failed to open capture")
exit()
while True:
ret, frame = cap.read()
cv2.imshow('Test', frame)
cv2.waitKey(1)