


Strangely enough, I could not find an easy description of how to achieve the above. The opencv-python package hits almost all of the boxes in a convenient pip install, but does not allow access to non-open-source Video encoders, namely x264 which is what I needed. In fact, in this case, the only route is by building both OpenCV and FFMpeg from source: however, this led to a convoluted search on the web through multiple tutorials. I hope by this blog post to make the process much easier for the reader. ffmpeg: This is again due to the need for using proprietary (x264) video encoders.x264 Encoder: This was required to encode videos using the protocol.Download them from the links in the description: We will need to get three (optionally five) packages. OpenCV-Contributions : This contains additional open-cv packages not part of the official modules.I attempt to build it here with CUDA support.

They can be quite useful for some more experimental/state-of-the-art methods. I need it here to install the Dense_flow package (for computing Optical flow). Make sure in particular to have the matching opencv/opencv-contrib versions.ĭownload everything as above and extract the zip/tar files. $ sudo apt-get install build-essential cmake git pkg-config libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libgtk-3-dev libatlas-base-dev gfortran libjpeg8-dev libtiff5-dev libpng-dev yasm nasm pkg-config We need to install the following prerequisite libraries (if they are not yet installed) I will assume that they have been extracted to ~/Downloads/*.
