Hi
@Moderator
I want a utility to video to tflite server.
To test the Tflite models.
For transfering video frames, irefereed modal-pipe examples.
But for reading video files. it seems there are 2 posible methods.
using ffmpeg and opencv.
first i tried to find ffmpeg on voxl2, it is not installed so i tried to compile 'voxl-ffmpeg' as per readme for qrb5165.
But it was getting failed.
then i amd tring opencv to read "mp4" format video.
I am getting error in reading mp4 file using python and opencv.
but same code working on my ubuntu perfectly.
Can help me find the issue.
please find the code and error below.
Thank you.
on voxl2, i am getting below error.
voxl2:~/tests$ python3 video-test2.py
gbm_create_device(156): Info: backend name is: msm_drm
[ WARN:0@3.094] global /opt/code/opencv/modules/videoio/src/cap_gstreamer.cpp (1374) open OpenCV | GStreamer warning: unable to query duration of stream
(python3:18838): GStreamer-CRITICAL **: 13:10:33.515: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed
(python3:18838): GStreamer-CRITICAL **: 13:10:33.515: gst_structure_get_int: assertion 'structure != NULL' failed
[ WARN:0@3.095] global /opt/code/opencv/modules/videoio/src/cap_gstreamer.cpp (1384) open OpenCV | GStreamer warning: cannot query video width/height
(python3:18838): GStreamer-CRITICAL **: 13:10:33.515: gst_structure_get_fraction: assertion 'structure != NULL' failed
[ WARN:0@3.095] global /opt/code/opencv/modules/videoio/src/cap_gstreamer.cpp (1390) open OpenCV | GStreamer warning: cannot query video fps
[ WARN:0@3.095] global /opt/code/opencv/modules/videoio/src/cap_gstreamer.cpp (1405) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
Traceback (most recent call last):
File "video-test2.py", line 33, in <module>
cv2.destroyAllWindows()
cv2.error: OpenCV(4.5.5) /opt/code/opencv/modules/highgui/src/window.cpp:1262: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvDestroyAllWindows'
voxl2:~/tests$
This is my python test code.
# importing libraries
import cv2
# Create a VideoCapture object and read from input file
cap = cv2.VideoCapture('0122_part_030.MP4')
# Check if camera opened successfully
if (cap.isOpened()== False):
print("Error opening video file")
# Read until video is completed
while(cap.isOpened()):
# Capture frame-by-frame
ret, frame = cap.read()
if ret == True:
# Display the resulting frame
cv2.imshow('Frame', frame)
# Press Q on keyboard to exit
if cv2.waitKey(25) & 0xFF == ord('q'):
break
# Break the loop
else:
break
# When everything done, release
# the video capture object
cap.release()
# Closes all the frames
cv2.destroyAllWindows()