cv2.imshow freezes after av is imported
Created by: samiamlabs
Overview
My setup is a docker container with Ubuntu 22.04 and python 3.10 and av installed through pip as a dependency of aiortc.
The python scripts freeze on the cv2.imshow line after av is imported. There is no opencv window either. If I don't import av it works.
Expected behavior
The pip installed version of av should not cause any issues for opencv.
Actual behavior
cv2.imshow does not work after av is imported
Traceback: There is no error print or traceback, and I was not able to find any info additional info through the VSCode debugger.
Investigation
I tried building/installing v10.0.0 of PyAV from the source, which fixed the issue.
Reproduction
import cv2
import numpy as np
import av
def main(args=None):
img = np.zeros((200, 200, 3), dtype=np.uint8)
cv2.imshow('ImageWindow', img)
cv2.waitKey()
if __name__ == '__main__':
main()
Versions
- OS: {{Ubuntu 22.04}}
- PyAV runtime:
PyAV v9.2.0
library configuration: --disable-static --enable-shared --libdir=/tmp/vendor/lib --prefix=/tmp/vendor --disable-alsa --disable-doc --disable-mediafoundation --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-lzma --enable-version3 --enable-zlib
library license: GPL version 3 or later
libavcodec 58.134.100
libavdevice 58. 13.100
libavfilter 7.110.100
libavformat 58. 76.100
libavutil 56. 70.100
libswresample 3. 9.100
libswscale 5. 9.100
- PyAV build:
{{ Complete output of `python setup.py config --verbose`. }}
No setup.py for pip installed package?
- FFmpeg:
bash: ffmpeg: command not found
Research
I have done the following:
- [ x] Checked the PyAV documentation
- [ x] Searched on Google
- [x ] Searched on Stack Overflow
- [ x] Looked through old GitHub issues
-
Asked on PyAV Gitter -
... and waited 72 hours for a response.