5

I am trying to read a video stream from a Parrot Bebop 2 drone. The video stream is written as "socket" to a file as H264 stream.

$ ffmpeg -i [STREAM]
Input #0, h264, from 'stream_h264':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264 (Constrained Baseline), 1 reference frame, yuv420p(progressive, left), 1280x720, 23.98 fps, 23.98 tbr, 1200k tbn, 47.95 tbc

Reading the video stream in MPlayer is not a problem using the parameters below. Playing it using VLC or ffmpeg should also not be too hard. For MPlayer the following works:

mplayer -fs -demuxer h264es -benchmark stream_h264

This plays the stream in high-res. However my goal is to perform image processing on the frames using Python (mostly OpenCV). Therefore, I would like to read the frames into NumPy arrays. I have already considered using cv2.VideoCapture but this does not seem to work for my stream. Other (somewhat easy) to use options I am not aware of, therefore my question is whether someone recommend me how to read the video frames in Python?

All recommendations are more than welcome!

verified.human
  • 1,287
  • 3
  • 17
  • 26

0 Answers0