mp4 file input to detectnet-video

Hi,

I am giving a video file as an input to detectnet-video.py.
It works fine if I give an .avi file which has resolution of 320x240.
But it is not working for the same file which is in .mp4 file format. I am getting the below error,

frame_rgba = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA)

cv2.error: OpenCV(4.2.0-dev) /home/jetbot/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function ‘cvtColor’

Let me know if there is a limitation to use only .avi file?
What is the solution for the above error?

Below is my code.

cam= cv2.VideoCapture(“/home/jetbot/models/research/object_detection/easy.mp4”)
while display.IsOpen():

ret, frame = cam.read()
print('frame:',ret,frame)
frame_rgba = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA)
width = frame.shape[1]
height = frame.shape[0]
img = jetson.utils.cudaFromNumpy(frame_rgba)

    detections = net.Detect(img, width, height, opt.overlay)

Hi,

I found that the .avi file is having Mpeg1 video codec in it. Hence it is working.

Where as .mp4 file is having MPEG4 video codec in it and it is not working.

So far now, I did convert .mp4 to avi with MPEG-1 as video codec and with it is working.

Let me know how to make MPEG4 video codec to work with detecnet code for object detection.

Regards,
Shankar

Hi,
Looks like it does not use hardware decoders on Jetson Nano. Could you please try DeepStream SDK? It is optimal for running deep learning inference on Jetson platforms. You can install the package through SDKManager.

Release announcement:
https://devtalk.nvidia.com/default/topic/1068639/deepstream-sdk/announcing-deepstream-sdk-4-0-2/

Many thanks for this post as I was struggling to find a way to get video files to work in general. All samples I have seen so far had either Camera or Image as inputs.