LukasBommes / mv-extractor

Extract frames and motion vectors from H.264 and MPEG-4 encoded video.
MIT License
304 stars 60 forks source link

docker run in headless mode #1

Closed ishanic closed 3 years ago

ishanic commented 3 years ago

Hello,

Thanks for sharing the code! I was able to run it effortlessly on my own machine. However, I am having trouble running this in the headless mode on a remote server without a graphics card. This is the error: ''' Sucessfully opened video file Frame: 0 timestamp: 1621037937.914803 | frame type: I | frame size: (720, 1280, 3) | motion vectors: (0, 10) | elapsed time: 0.12874823901802301 s Unable to init server: Could not connect: Connection refused

(Frame:139): Gtk-WARNING **: 00:18:57.922: cannot open display: localhost:10.0 root@5a0189971e6a:/home/video_cap# '''

In a separate window, I got this error. (base) user@srv~$ xhost + xhost: unable to open display "localhost:11.0"

Thanks for any help.

LukasBommes commented 3 years ago

Hey ishanic,

This is because of cv2.imshow("Frame", frame) in line 66 of test.py. Calling cv2.imshow requires access to a display in order to show the video frame. Try removing that line and see if the script runs. You could just dump the frame (numpy array) to disk instead.