1 Reply Latest reply on Jun 3, 2018 9:05 AM by virtualdvid

    OpenCV activate ffmpeg on DevCloud

    virtualdvid

      Hi, I have been trying to load a video using these lines

       

      import cv2

      vidcap = cv2.VideoCapture('video.mp4')

       

      But it is no recognizing the video '.mp4'. Researching on Internet I found that I can solve this if I use:

       

      pip install opencv-python

      conda install -c conda-forge dlib

      conda install -c conda-forge ffmpeg

      conda install -c conda-forge opencv ffmpeg

      conda install -c menpo opencv3 ffmpeg

       

      Not succeed at all. I also tried this* but It is asking me root permission. Even if I start a job with qsub -I and run it in a conda environment.

       

      * conda-opencv/README.md at master · menpo/conda-opencv · GitHub

       

      I test the activation with this line:

       

      python -c "import cv2; print(cv2.getBuildInformation())" | grep -i ffmpeg

       

      How can I activate ffmpeg on Devcloud?

       

      Thank you!

        • 1. Re: OpenCV activate ffmpeg on DevCloud
          virtualdvid

          Never mind! The solution was simple. It was loading `cv2` from (/home/uxxxxx/.local/lib/python3.6/site-packages) instead of (/home/uxxxxx/.conda/envs/my_env_name/lib/python3.6/site-packages). I followed this steps:

           

          1. pip uninstall opencv-python

          2. source activate my_env_name

          3. pip install --ignore-installed opencv-python

          4. pip show install

           

          Problem solved now I have:

           

          5. python -c "import cv2; print(cv2.getBuildInformation())" | grep -i ffmpeg

              Linker flags (Release):      -L/root/ffmpeg_build/lib

              Linker flags (Debug):        -L/root/ffmpeg_build/lib

              FFMPEG:                      YES