opencv-python无法生成H264编码问题的解决方案

目前作者只是在原生系统ubuntu18.04的python3.6环境和更换为python3.7下尝试,,,未尝试anaconda。具体操作如下:
编译前,需要安装编译opencv需要的各种依赖:

sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev libgtk-3-dev libgtkglext1-dev libgstreamer1.0-dev libavresample-dev  libgphoto2-dev libopenblas-dev libatlas-base-dev doxygen libgstreamer-ocaml-dev libgstreamer-plugins-bad1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer1.0-dev libgstreamermm-1.0-dev libtesseract-dev liblept5 libleptonica-dev liblapacke-dev libgstreamer-opencv1.0-0 libgstreamer-plugins-bad1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev libgstreamerd-3-dev libgstreamermm-1.0-dev libv4l-dev libprotobuf-dev libhdf5-dev libgflags-dev python3-numpy

不提前安装也可以,,,根据编译过程中的报错,依次安装。
编译步骤参考https://www.cnblogs.com/xuanmanstein/p/14807453.html,具体步骤如下:

git clone --recursive https://github.com/skvark/opencv-python.git
export CMAKE_ARGS="-DWITH_FREETYPE=ON"
export ENABLE_CONTRIB=1 
export ENABLE_HEADLESS=0
export MAKEFLAGS="-j $(($(nproc)-1))"
cd ./opencv-python
pip wheel . --verbose

过程中会碰到形形色色的问题,,,根据failed信息或cmake报错,,查找原因,,编译成功问题不大。。
ubuntu18.04—python3.6/3.7编译好的opencv-contrib-python.whl文件可以通过如下途径获得。。
途径1/途径2

你可能感兴趣的:(opencv,h264编码,python,python,opencv,编译)