PyAV Media Player
Install avplayer
:
pip install avplayer
If you want to use the tk preview:
pip install avplayer[Pillow]
python -m avplayer --help
If it is important to get the latest frame in real-time streaming
such as RTSP streaming, we recommend adjusting the --drop-*
related options.
python -m avplayer --drop-slow-frame --drop-threshold=1 ...
The cvplayer.avconfig.AvConfig
class can be used as follows:
from avplayer.avconfig import AvConfig
config = AvConfig(
input_file="rtsp://...",
drop_slow_frame=True,
drop_threshold=1,
)
opencv-python compatibility
To prevent freeze when using opencv-python's imshow,
do not use import av
at file-scope.
Please refer to the following link:
- AV import leads to OpenCV imshow freeze · Issue #21952 · opencv/opencv
- python - Can't show image with opencv when importing av - Stack Overflow
See the examples/aio_cv.py file.
See the examples/cv2_example.py file.
See the LICENSE file for details. In summary, avplayer is licensed under the MIT license.