Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Borda/docker_python-opencv-ffmpeg

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker: Python-OpenCV-FFmpeg(-CUDA)

Repository for clean Dockerfile containing FFmpeg, OpenCV4 and Python3, based on Ubuntu 24.04 LTS.

Tags

  • :cpu-pyX.y-cvX.y.z for Python 3.x, OpenCV 4.12.x, FFmpeg
  • :gpu-pyX.y-cvX.y.z for Python 3.x, OpenCV 4.12.x, FFmpeg with CUDA 12.x 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.9 -f cpu/Dockerfile --build-arg PYTHON_VERSION=3.9 .

To build other versions, select different Dockerfile.

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

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.9 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 :)

About

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

Topics

Resources

Stars

Watchers

Forks

Languages

  • Dockerfile 100.0%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.