Skip to content

Commit 314eb3d

Browse files
authored
Merge pull request #1209 from ladaapp:add_linux_av1_decoding
Fix VideoCapture not able to read AV1 encoded files on Linux #1209 Hi, this is an attempt to fix #908 as AV1 encoded files are pretty common nowadays. My assumption is that there is no av1 decoder available in the official wheel as the same works just fine using opencv-python from ArchLinux build against their ffmpeg build. On Windows av1 decoding works but not on Linux using the official wheels. I am not sure but I assume there is some kind of fallback mechanism which then uses Windows-native frameworks for decoding which is not available on Linux hence it fails on Linux using ffmpeg backend. Didn't adjust the arm images yet, wanted to get some feedback first if I'm going in the right direction here. Waiting for the CI to run through to create a wheel I can test if this actually fixes the issue 🤞 edit: looks like CI doesn't run without approval by maintainers, so changed to ready-for-review fixes: #1205 fixes: #908
1 parent eb88d91 commit 314eb3d

8 files changed

Lines changed: 111 additions & 19 deletions

File tree

.github/workflows/build_wheels_manylinux.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ jobs:
3333
include:
3434
- platform: aarch64
3535
manylinux: 2014
36-
DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20260723
36+
DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20260725
3737
- platform: x86_64
3838
manylinux: 2014
39-
DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20260723
39+
DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20260725
4040
- platform: x86_64
4141
manylinux: 2_28
42-
DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux_2_28-x86-64:20260723
42+
DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux_2_28-x86-64:20260725
4343
- platform: aarch64
4444
manylinux: 2_28
45-
DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux_2_28-aarch64:20260723
45+
DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux_2_28-aarch64:20260725
4646

4747
env:
4848
ACTIONS_ALLOW_UNSECURE_COMMANDS: true

LICENSE-3RD-PARTY.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3573,3 +3573,31 @@ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
35733573
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35743574
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
35753575
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3576+
3577+
------------------------------------------------------------------------------
3578+
3579+
dav1d library is redistributed within all opencv-python Linux packages.
3580+
3581+
Copyright © 2018-2025, VideoLAN and dav1d authors
3582+
All rights reserved.
3583+
3584+
Redistribution and use in source and binary forms, with or without
3585+
modification, are permitted provided that the following conditions are met:
3586+
3587+
1. Redistributions of source code must retain the above copyright notice, this
3588+
list of conditions and the following disclaimer.
3589+
3590+
2. Redistributions in binary form must reproduce the above copyright notice,
3591+
this list of conditions and the following disclaimer in the documentation
3592+
and/or other materials provided with the distribution.
3593+
3594+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
3595+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
3596+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
3597+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
3598+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
3599+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
3600+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
3601+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3602+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3603+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

docker/manylinux2014/Dockerfile_aarch64

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Version: 20260723
1+
# Version: 20260725
22
# Image name: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64
33

44
FROM quay.io/pypa/manylinux2014_aarch64:latest
@@ -14,6 +14,7 @@ ARG QT_VERSION=5.15.19
1414
ARG YASM_VERSION=1.3.0
1515
ARG AOM_VERSION=v3.14.1
1616
ARG AVIF_VERSION=v1.4.2
17+
ARG LIBDAV1D_VERSION=1.5.3
1718

1819
ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
1920

@@ -122,13 +123,23 @@ RUN mkdir ~/avif_sources && \
122123
make install && \
123124
cd / && rm -rf ~/avif_sources
124125

126+
RUN python3.10 -m pip install meson ninja && \
127+
export PATH=/opt/python/cp310-cp310/bin:$PATH && \
128+
mkdir ~/libdav1d_sources && \
129+
cd ~/libdav1d_sources && \
130+
git clone -b ${LIBDAV1D_VERSION} https://code.videolan.org/videolan/dav1d.git && \
131+
mkdir build && cd build && \
132+
PATH=$HOME/bin:$PATH meson setup --prefix="/ffmpeg_build" --libdir lib ../dav1d && \
133+
meson install && \
134+
cd / && rm -rf ~/libdav1d_sources
135+
125136
RUN mkdir ~/ffmpeg_sources && \
126137
cd ~/ffmpeg_sources && \
127138
curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \
128139
tar -xf ffmpeg-${FFMPEG_VERSION}.tar.gz && \
129140
cd ffmpeg-${FFMPEG_VERSION} && \
130141
PATH=~/bin:$PATH && \
131-
PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/ffmpeg_build" --extra-cflags="-I/ffmpeg_build/include" --extra-ldflags="-L/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \
142+
PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/ffmpeg_build" --extra-cflags="-I/ffmpeg_build/include" --extra-ldflags="-L/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --enable-libdav1d --bindir="$HOME/bin" && \
132143
make -j$(getconf _NPROCESSORS_ONLN) && \
133144
make install && \
134145
echo "/ffmpeg_build/lib/" >> /etc/ld.so.conf && \

docker/manylinux2014/Dockerfile_x86_64

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Version: 20260723
1+
# Version: 20260725
22
# Image name: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64
33

44
FROM quay.io/pypa/manylinux2014_x86_64:latest
@@ -14,11 +14,12 @@ ARG QT_VERSION=5.15.19
1414
ARG YASM_VERSION=1.3.0
1515
ARG AOM_VERSION=v3.14.1
1616
ARG AVIF_VERSION=v1.4.2
17+
ARG LIBDAV1D_VERSION=1.5.3
1718

1819
ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
1920

2021
# epel-release need for aarch64 to get openblas packages
21-
RUN yum install cmake zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release -y && \
22+
RUN yum install cmake zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release meson -y && \
2223
yum install openblas-devel dejavu-sans-fonts -y && \
2324
cp /usr/include/openblas/*.h /usr/include/ && \
2425
cp /usr/include/lapacke/lapacke*.h /usr/include/ && \
@@ -121,13 +122,21 @@ RUN mkdir ~/avif_sources && \
121122
make install && \
122123
cd / && rm -rf ~/avif_sources
123124

125+
RUN mkdir ~/libdav1d_sources && \
126+
cd ~/libdav1d_sources && \
127+
git clone -b ${LIBDAV1D_VERSION} https://code.videolan.org/videolan/dav1d.git && \
128+
mkdir build && cd build && \
129+
PATH=$HOME/bin:$PATH meson setup --prefix="/ffmpeg_build" --libdir lib ../dav1d && \
130+
meson install && \
131+
cd / && rm -rf ~/libdav1d_sources
132+
124133
RUN mkdir ~/ffmpeg_sources && \
125134
cd ~/ffmpeg_sources && \
126135
curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \
127136
tar -xf ffmpeg-${FFMPEG_VERSION}.tar.gz && \
128137
cd ffmpeg-${FFMPEG_VERSION} && \
129138
PATH=~/bin:$PATH && \
130-
PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/ffmpeg_build" --extra-cflags="-I/ffmpeg_build/include" --extra-ldflags="-L/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \
139+
PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/ffmpeg_build" --extra-cflags="-I/ffmpeg_build/include" --extra-ldflags="-L/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --enable-libdav1d --bindir="$HOME/bin" && \
131140
make -j$(getconf _NPROCESSORS_ONLN) && \
132141
make install && \
133142
echo "/ffmpeg_build/lib/" >> /etc/ld.so.conf && \

docker/manylinux_2_28/Dockerfile_aarch64

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Version: 20260723
1+
# Version: 20260725
22
# Image name: quay.io/opencv-ci/opencv-python-manylinux_2_28-aarch64
33

44
FROM quay.io/pypa/manylinux_2_28_aarch64:latest
@@ -10,12 +10,14 @@ ARG VPX_VERSION=v1.15.2
1010
ARG QT_VERSION=5.15.19
1111
ARG AOM_VERSION=v3.14.1
1212
ARG AVIF_VERSION=v1.4.2
13+
ARG LIBDAV1D_VERSION=1.5.3
1314

1415
ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
1516

1617
# epel-release need for aarch64 to get openblas packages
17-
RUN yum install zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release -y && \
18+
RUN yum install zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release meson -y && \
1819
yum install openblas-devel dejavu-sans-fonts ccache yasm nasm ninja-build openssl openssl-devel -y && \
20+
yum mark install dejavu-sans-fonts && \
1921
# libpng will be built from source
2022
yum remove libpng -y
2123

@@ -82,13 +84,21 @@ RUN mkdir ~/avif_sources && \
8284
make install && \
8385
cd / && rm -rf ~/avif_sources
8486

87+
RUN mkdir ~/libdav1d_sources && \
88+
cd ~/libdav1d_sources && \
89+
git clone -b ${LIBDAV1D_VERSION} https://code.videolan.org/videolan/dav1d.git && \
90+
mkdir build && cd build && \
91+
meson setup --prefix="/ffmpeg_build" --libdir lib ../dav1d && \
92+
meson install && \
93+
cd / && rm -rf ~/libdav1d_sources
94+
8595
RUN mkdir ~/ffmpeg_sources && \
8696
cd ~/ffmpeg_sources && \
8797
curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \
8898
tar -xf ffmpeg-${FFMPEG_VERSION}.tar.gz && \
8999
cd ffmpeg-${FFMPEG_VERSION} && \
90100
PATH=~/bin:$PATH && \
91-
PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/ffmpeg_build" --extra-cflags="-I/ffmpeg_build/include" --extra-ldflags="-L/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \
101+
PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/ffmpeg_build" --extra-cflags="-I/ffmpeg_build/include" --extra-ldflags="-L/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --enable-libdav1d --bindir="$HOME/bin" && \
92102
make -j$(getconf _NPROCESSORS_ONLN) && \
93103
make install && \
94104
echo "/ffmpeg_build/lib/" >> /etc/ld.so.conf && \

docker/manylinux_2_28/Dockerfile_x86_64

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Version: 20260723
1+
# Version: 20260725
22
# Image name: quay.io/opencv-ci/opencv-python-manylinux_2_28-x86-64
33

44
FROM quay.io/pypa/manylinux_2_28_x86_64:latest
@@ -10,12 +10,14 @@ ARG VPX_VERSION=v1.15.2
1010
ARG QT_VERSION=5.15.19
1111
ARG AOM_VERSION=v3.14.1
1212
ARG AVIF_VERSION=v1.4.2
13+
ARG LIBDAV1D_VERSION=1.5.3
1314

1415
ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
1516

1617
# epel-release need for aarch64 to get openblas packages
17-
RUN yum install zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release -y && \
18+
RUN yum install zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release meson -y && \
1819
yum install openblas-devel dejavu-sans-fonts ccache yasm nasm ninja-build openssl openssl-devel -y && \
20+
yum mark install dejavu-sans-fonts && \
1921
# libpng will be built from source
2022
yum remove libpng -y
2123

@@ -82,13 +84,21 @@ RUN mkdir ~/avif_sources && \
8284
make install && \
8385
cd / && rm -rf ~/avif_sources
8486

87+
RUN mkdir ~/libdav1d_sources && \
88+
cd ~/libdav1d_sources && \
89+
git clone -b ${LIBDAV1D_VERSION} https://code.videolan.org/videolan/dav1d.git && \
90+
mkdir build && cd build && \
91+
meson setup --prefix="/ffmpeg_build" --libdir lib ../dav1d && \
92+
meson install && \
93+
cd / && rm -rf ~/libdav1d_sources
94+
8595
RUN mkdir ~/ffmpeg_sources && \
8696
cd ~/ffmpeg_sources && \
8797
curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \
8898
tar -xf ffmpeg-${FFMPEG_VERSION}.tar.gz && \
8999
cd ffmpeg-${FFMPEG_VERSION} && \
90100
PATH=~/bin:$PATH && \
91-
PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/ffmpeg_build" --extra-cflags="-I/ffmpeg_build/include" --extra-ldflags="-L/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \
101+
PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/ffmpeg_build" --extra-cflags="-I/ffmpeg_build/include" --extra-ldflags="-L/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --enable-libdav1d --bindir="$HOME/bin" && \
92102
make -j$(getconf _NPROCESSORS_ONLN) && \
93103
make install && \
94104
echo "/ffmpeg_build/lib/" >> /etc/ld.so.conf && \

docker/musllinux_1_2/Dockerfile_aarch64

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# version: 20260723
1+
# version: 20260725
22
# Image name: quay.io/opencv-ci/opencv-python-musllinux_1_2-aarch64
33
FROM quay.io/pypa/musllinux_1_2_aarch64:latest
44

@@ -12,13 +12,16 @@ ARG OPENSSL_VERSION=1_1_1w
1212
ARG YASM_VERSION=1.3.0
1313
ARG AOM_VERSION=v3.14.1
1414
ARG AVIF_VERSION=v1.4.2
15+
ARG LIBDAV1D_VERSION=1.5.3
1516

1617
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
1718

1819
RUN apk add --no-cache \
1920
build-base \
2021
diffutils \
2122
cmake \
23+
meson \
24+
ninja \
2225
bash \
2326
git \
2427
curl \
@@ -91,7 +94,6 @@ RUN mkdir ~/libvpx_sources && \
9194
cd .. && \
9295
rm -rf ~/libvpx_sources
9396

94-
9597
### aom
9698
RUN mkdir -p /tmp/aom_sources && \
9799
cd /tmp/aom_sources && \
@@ -106,6 +108,7 @@ RUN mkdir -p /tmp/aom_sources && \
106108
../aom && \
107109
make -j$(getconf _NPROCESSORS_ONLN) && \
108110
make install
111+
109112
### avif
110113
RUN mkdir ~/avif_sources && \
111114
cd ~/avif_sources && \
@@ -117,6 +120,15 @@ RUN mkdir ~/avif_sources && \
117120
cd .. && \
118121
rm -rf ~/avif_sources
119122

123+
### av1d
124+
RUN mkdir ~/libdav1d_sources && \
125+
cd ~/libdav1d_sources && \
126+
git clone -b ${LIBDAV1D_VERSION} https://code.videolan.org/videolan/dav1d.git && \
127+
mkdir build && cd build && \
128+
meson setup --prefix="/usr" --libdir lib ../dav1d && \
129+
meson install && \
130+
cd / && rm -rf ~/libdav1d_sources
131+
120132
### ffmpeg
121133
RUN mkdir -p /ffmpeg_sources && \
122134
cd /ffmpeg_sources && \

docker/musllinux_1_2/Dockerfile_x86_64

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# version: 20260723
1+
# version: 20260725
22
# Image name: quay.io/opencv-ci/opencv-python-musllinux_1_2-x86-64
33
FROM quay.io/pypa/musllinux_1_2_x86_64:latest
44

@@ -12,13 +12,16 @@ ARG OPENSSL_VERSION=1_1_1w
1212
ARG YASM_VERSION=1.3.0
1313
ARG AOM_VERSION=v3.14.1
1414
ARG AVIF_VERSION=v1.4.2
15+
ARG LIBDAV1D_VERSION=1.5.3
1516

1617
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
1718

1819
RUN apk add --no-cache \
1920
build-base \
2021
diffutils \
2122
cmake \
23+
meson \
24+
ninja \
2225
bash \
2326
git \
2427
curl \
@@ -91,7 +94,6 @@ RUN mkdir ~/libvpx_sources && \
9194
cd .. && \
9295
rm -rf ~/libvpx_sources
9396

94-
9597
### aom
9698
RUN mkdir -p /tmp/aom_sources && \
9799
cd /tmp/aom_sources && \
@@ -106,6 +108,7 @@ RUN mkdir -p /tmp/aom_sources && \
106108
../aom && \
107109
make -j$(getconf _NPROCESSORS_ONLN) && \
108110
make install
111+
109112
### avif
110113
RUN mkdir ~/avif_sources && \
111114
cd ~/avif_sources && \
@@ -117,6 +120,15 @@ RUN mkdir ~/avif_sources && \
117120
cd .. && \
118121
rm -rf ~/avif_sources
119122

123+
### av1d
124+
RUN mkdir ~/libdav1d_sources && \
125+
cd ~/libdav1d_sources && \
126+
git clone -b ${LIBDAV1D_VERSION} https://code.videolan.org/videolan/dav1d.git && \
127+
mkdir build && cd build && \
128+
meson setup --prefix="/usr" --libdir lib ../dav1d && \
129+
meson install && \
130+
cd / && rm -rf ~/libdav1d_sources
131+
120132
### ffmpeg
121133
RUN mkdir -p /ffmpeg_sources && \
122134
cd /ffmpeg_sources && \

0 commit comments

Comments
 (0)