Sign inSign up

borda/docker_python-opencv-ffmpeg

By borda

•Updated 6 months ago

Dockerfile containing FFmpeg, OpenCV4 and Python2/3, based on Ubuntu 20.04 LTS

Image
14

50K+

borda/docker_python-opencv-ffmpeg repository overview

⁠Docker: Python-OpenCV-FFmpeg(-CUDA)

Repository for clean Dockerfile containing FFmpeg⁠, OpenCV4⁠ and Python2/3⁠, based on Ubuntu⁠ 20.04 LTS.

⁠Tags

  • :cpu-pyX.y-cvX.y.z for Python 2.x/3.x, OpenCV 4.x.y, FFmpeg
  • :gpu-pyX.y-cvX.y.z for Python 2.x/3.x, OpenCV 4.x.y, FFmpeg with CUDA 11.4 support

⁠Build

Publish Docker Image Docker Build Status DockerHub Pulls Docker

First you need to install docker on your local computer, see following tutorial⁠. Note, for running the docker properly you have be logged as superuser otherwise you will face many partial issues which sometimes does not make much sense.

You can build it on your own, note it takes lots of time, be prepared.

git clone <git-repository>
cd docker_python-opencv-ffmpeg
docker image build -t python-opencv-ffmpeg:py3.6 -f cpu/Dockerfile --build-arg PYTHON_VERSION=3.6 .

To build other versions, select different Dockerfile.

docker image list
docker run --rm -it python-opencv-ffmpeg:py3.6 bash
docker image rm python-opencv-ffmpeg:py3.6

Other option is using already build image from DockerHub which is significantly faster. it basically download the already build image.

docker pull borda/docker_python-opencv-ffmpeg

Cleaning In case you fail with some builds, you may need to clean your local storage.

docker image prune

or Docker - How to cleanup (unused) resources⁠

docker images | grep "none"
docker rmi $(docker images | grep "none" | awk '/ / { print $3 }')

or remove all - Some way to clean up⁠

docker rm -vf $(docker ps -aq)
docker rmi -f $(docker images -aq)
docker volume prune -f

⁠Usage

Image has OpenCV4, Python2.7/3.6 and FFmpeg ready to use. Example:

docker run --rm -it -v $PWD:/srv borda/docker_python-opencv-ffmpeg python
>>> import cv2; cv2.VideoCapture(0).read()
# truncated for transparency
(True, array([[[ 0, 43, 37], ...]], dtype=uint8))

Note, server usually doe not have webcam :)

Tag summary

Content type

Image

Digest

sha256:42b832056…

Size

5.2 GB

Last updated

6 months ago

docker pull borda/docker_python-opencv-ffmpeg:gpu-py3.13-cv4.13.0