Python package to display video in GUI using OpenCV-Python and PySide6

Related tags

Videocv2PySide6
Overview

Python package to display video in GUI using OpenCV-Python and PySide6.

Introduction

cv2PySide6 is a package which provides utility classes and functions that integrate cv2 and PySide6.

With cv2PySide6, you can build pipeline which reads video with PySide6, converts the frame to numpy array for processing with cv2, and casts it back to PySide6 object.

Installation

Before you install, be careful for other Qt-dependent packages installed in your environment. For example, non-headless OpenCV-Python module modifies the Qt dependency thus making PySide6 unavailable.

For quick install, run the following command. This directly installs cv2PySide6 from the repository using pip.

$ pip install git+https://github.com/JSS95/cv2PySide6.git

You can specify the version after an @ at the end of the url. The following command installs cv2PySide6 with version v1.0.0.

$ pip install git+https://github.com/JSS95/[email protected]

How to use

  1. Subclass QVideoFrame2Array to define image processor with custom processArray method.
  2. Set the video sink of QMediaPlayer as frame source of the processor.
  3. Set the image processor as array source of NDArrayVideoWidget.

In PySide6, video frames are acquired as QVideoFrame and passed from QMediaPlayer to QVideoSink, then to QVideoWidget.


Video display pipeline in PySide6

In cv2PySide6, QVideoFrame2Array comes after QVideoSink. This converts the QVideoFrame to numpy.ndarray, process it, then pass to NDArrayVideoWidget. You can subclass QVideoFrame2Array and override processArray with your own image processing.


Video display pipeline in cv2PySide6

Use cases are provided in examples directory.

You might also like...
pygamevideo module helps developer to embed videos into their Pygame display

pygamevideo module helps developer to embed videos into their Pygame display. Audio playback doesn't use pygame.mixer.

Python and OpenCV-based scene cut/transition detection program & library.
Python and OpenCV-based scene cut/transition detection program & library.

Video Scene Cut Detection and Analysis Tool Latest Release: v0.5.6.1 (October 11, 2021) Main Webpage: py.scenedetect.com Documentation: manual.scenede

Streamlink is a CLI utility which pipes video streams from various services into a video player

Streamlink is a CLI utility which pipes video streams from various services into a video player

Filtering user-generated video content(SberZvukTechDays)Filtering user-generated video content(SberZvukTechDays)
Filtering user-generated video content(SberZvukTechDays)Filtering user-generated video content(SberZvukTechDays)

Filtering user-generated video content(SberZvukTechDays) Table of contents General info Team members Technologies Setup Result General info This is a

Telegram Video Chat Video Streaming bot 🇱🇰
Telegram Video Chat Video Streaming bot 🇱🇰

🧪 Get SESSION_NAME from below: Pyrogram 🎭 Preview ✨ Features Music & Video stream support MultiChat support Playlist & Queue support Skip, Pause, Re

Play Video & Music on Telegram Group Video Chat
Play Video & Music on Telegram Group Video Chat

🖤 DEMONGIRL 🖤 ʜᴇʟʟᴏ ❤️ 🇱🇰 Join us ᴠɪᴅᴇᴏ sᴛʀᴇᴀᴍ ɪs ᴀɴ ᴀᴅᴠᴀɴᴄᴇᴅ ᴛᴇʟᴇʀᴀᴍ ʙᴏᴛ ᴛʜᴀᴛ's ᴀʟʟᴏᴡ ʏᴏᴜ ᴛᴏ ᴘʟᴀʏ ᴠɪᴅᴇᴏ & ᴍᴜsɪᴄ ᴏɴ ᴛᴇʟᴇɢʀᴀᴍ ɢʀᴏᴜᴘ ᴠɪᴅᴇᴏ ᴄʜᴀᴛ 🧪 ɢ

Turn any live video stream or locally stored video into a dataset of interesting samples for ML training, or any other type of analysis.
Turn any live video stream or locally stored video into a dataset of interesting samples for ML training, or any other type of analysis.

Sieve Video Data Collection Example Find samples that are interesting within hours of raw video, for free and completely automatically using Sieve API

Video-to-GIF-Converter - A small code snippet that can be used to convert any video to a gif

Video to GIF Converter Project Description: This is a small code snippet that ca

Video-stream - A telegram video stream bot repo
Video-stream - A telegram video stream bot repo

This is a Telegram Video stream Bot. Binary Tech 💫 Features stream videos downl

Comments
  • refact: add NDArrayVideoPlayer.videoPositionChanged

    refact: add NDArrayVideoPlayer.videoPositionChanged

    VideoController now takes NDArrayVideoPlayer as its player (no QMediaPlayer) NDArrayVideoPlayer now has videoPosition property and videoPositionChanged signal. VideoController updates slider value by videoPositionChanged signal.

    This new videoPositionChanged signal fixes:

    1. Inaccurate media position by long image processing job
    2. Redundant position update when media position changed while media is not playing
    opened by JSS95 0
Releases(v3.1.0)
  • v3.1.0(Jun 4, 2022)

    cv2PySide6 v3.1.0 release

    What's Changed

    • Python dependency is now >= 3.6
    • PySide6 dependency is now >= 6.2

    Full Changelog: https://github.com/JSS95/cv2PySide6/compare/v3.0.0...v3.1.0

    Source code(tar.gz)
    Source code(zip)
  • v3.0.0(Jun 4, 2022)

    cv2PySide6 v3.0.0 release

    Backward incompatible changes

    • ArrayProcessor is removed.
    • FrameToArrayConverter, NDAraryVideoPlayer, NDArrayMediaCaptureSession are moved to videostream.py
    • NDArrayVideoPlayerWidget and NDArrayCameraWidget are redesigned.

    What's Changed

    • feat: introduce MediaController by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/47
    • refact: modify video widgets by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/49
    • refact: remove protocols by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/50
    • refact: remove ArrayProcessor by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/52
    • feat: allow array processing in video widgets by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/67

    Full Changelog: https://github.com/JSS95/cv2PySide6/compare/v2.1.1...v3.0.0

    Source code(tar.gz)
    Source code(zip)
  • v2.1.1(May 17, 2022)

    What's Changed

    • Lint by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/44
    • maint: use type checking by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/45

    Full Changelog: https://github.com/JSS95/cv2PySide6/compare/v2.1.0...v2.1.1

    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Apr 15, 2022)

    cv2PySide6 v2.1.0 release

    What's Changed

    • feat: add converter() to FrameToArrayConverter by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/42

    Full Changelog: https://github.com/JSS95/cv2PySide6/compare/v2.0.4...v2.1.0

    Source code(tar.gz)
    Source code(zip)
  • v2.0.4(Apr 13, 2022)

    cv2PySide6 v2.0.4 release

    What's Changed

    • fix: fix onSliderValueChange by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/40

    Full Changelog: https://github.com/JSS95/cv2PySide6/compare/v2.0.3...v2.0.4

    Source code(tar.gz)
    Source code(zip)
  • v2.0.3(Apr 13, 2022)

    cv2PySide6 v2.0.3 release

    What's Changed

    • fix: fix onSliderValueChange by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/37

    Full Changelog: https://github.com/JSS95/cv2PySide6/compare/v2.0.2...v2.0.3

    Source code(tar.gz)
    Source code(zip)
  • v2.0.2(Apr 1, 2022)

    cv2PySide6 v2.0.2 release

    What's Changed

    • Fix setVideoPlayer by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/35

    Full Changelog: https://github.com/JSS95/cv2PySide6/compare/v2.0.1...v2.0.2

    Source code(tar.gz)
    Source code(zip)
  • v2.0.1(Apr 1, 2022)

    cv2PySide6 v2.0.1 release

    What's Changed

    • fix: fix stop button connection of NDArrayVideoPlayerWidget by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/32

    Full Changelog: https://github.com/JSS95/cv2PySide6/compare/v2.0.0...v2.0.1

    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Apr 1, 2022)

    cv2PySide6 v2.0.0 release

    This release greatly breaks backwards compatibility with previous version. Almost all features are changed.

    Full Changelog: https://github.com/JSS95/cv2PySide6/compare/v1.1.1...v2.0.0

    What's Changed

    • refact: redesign video pipeline by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/20
    • refact: use QMediaPlayer.sourceChanged signal by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/21
    • refact: modify module names by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/22
    • feat: introduce NDArrayVideoWidget by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/23
    • feat: introduce NDArrayVideoSeekerWidget by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/24
    • feat: introduce CV2VideoPlayer example by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/25
    • feat: introduce VideoPlayerProtocol by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/26
    • feat: introduce NDArrayCameraWidget by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/27

    Full Changelog: https://github.com/JSS95/cv2PySide6/compare/v1.1.1...v2.0.0

    Source code(tar.gz)
    Source code(zip)
  • v1.1.1(Mar 17, 2022)

    cv2PySide6 v1.1.1 release

    What's Changed

    • fix : allow empty array to setArray by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/17

    Full Changelog: https://github.com/JSS95/cv2PySide6/compare/v1.1.0...v1.1.1

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Mar 14, 2022)

    cv2PySide6 v1.1.0 release

    What's Changed

    • refact : use qimage2ndarray package by @JSS95 in https://github.com/JSS95/cv2PySide6/pull/15

    Full Changelog: https://github.com/JSS95/cv2PySide6/compare/v1.0.2...v1.1.0

    Source code(tar.gz)
    Source code(zip)
  • v1.0.2(Dec 29, 2021)

  • v1.0.1(Dec 29, 2021)

  • v1.0.0(Dec 28, 2021)

Python retagging utility for mkv files using mkvmerge.

pyretag A python script to retag mkv files. Setting Up pip install pyfiglet pip install rich Move the mkv files to input folder.

25 Dec 04, 2022
Spotify playlist video generator

This program creates a video version of your Spotify playlist by using the Spotify API and YouTube-dl.

0 Mar 03, 2022
FLIR/DJI IR Camera Data Parser, Python Version

FLIR/DJI IR Camera Data Parser, Python Version Parser infrared camera data as NumPy data. Usage Clone this respository and cd thermal_parser. Run pip

14 Dec 23, 2022
Techie Sneh 17 Nov 23, 2021
A GUI application for cropping images from videos

v-trimming-gui A GUI application for cropping images from videos. 動画をシークバーで操作しながらスクリーンショットを撮るためのアプリ。 Requirement Python =3.7 opencv-python ^4.5.5 PyS

Menrui 6 Feb 05, 2022
TkVideoplayer - This is a simple library to play video files in tkinter.

TkVideoplayer - This is a simple library to play video files in tkinter.

Art/Paul 38 Dec 23, 2022
A web RTSP play platform based on websocket and tornado, websocket use blob binaryType read as ArrayBuffer

A web RTSP play platform based on websocket and tornado, websocket use blob binaryType read as ArrayBuffer

2 Feb 25, 2022
Video Chat Streamer With Python

Voice Chat Streamer This bot can stream audio or video files and urls in telegram voice chats :) 🎯 Follow me and star this repo for more telegram bot

WiskeyWorm 4 Oct 09, 2022
Youtube as covert-channel - Control systems remotely and execute commands by uploading videos to Youtube

covert-tube A program to control systems remotely by uploading videos to Youtube using Python to create the videos and the listener, emulating some ma

Ricardo Ruiz 101 Nov 01, 2022
Ffmpeg videostream - High speed video frame access in Python, using FFmpeg and FFshow

FFmpeg VideoStream High speed video frame access in Python, using FFmpeg and FFshow This script requires: Karl Kroening's 'ffmpeg-python' library. (ht

3 Sep 29, 2022
720p FPGA Media Player (RISC-V + Motion JPEG + SD + HDMI on an Artix 7)

FPGA Media Player This project is a FPGA based media player which is capable of playing Motion JPEG encoded video over HDMI or VGA on commonly availab

179 Dec 02, 2022
A self-hosted streaming platform with Discord authentication, auto-recording and more!

A self-hosted streaming platform with Discord authentication, auto-recording and more!

John Patrick Glattetre 331 Dec 27, 2022
PyAV is a Pythonic binding for the FFmpeg libraries.

PyAV is a Pythonic binding for the FFmpeg libraries. We aim to provide all of the power and control of the underlying library, but manage the gritty details as much as possible.

PyAV 1.8k Jan 01, 2023
Examples of usage of GStreamer hlssink3 plugin.

Examples of usage of GStreamer hlssink3 plugin.

Rafael Carício 2 Aug 03, 2022
Cross-platform command-line AV1 / VP9 / HEVC / H264 encoding framework with per scene quality encoding

Av1an A cross-platform framework to streamline encoding Easy, Fast, Efficient and Feature Rich An easy way to start using AV1 / HEVC / H264 / VP9 / VP

Zen 947 Jan 01, 2023
Splat a video into a mosaic by sampling a frame at regular intervals

Splat a video into a mosaic by sampling a frame at regular intervals. Useful for seeing the changes over time of an entire video or movie.

Ryan Fox 4 Oct 16, 2022
Telegram Video Stream

Video Stream An Advanced VC Video Player created for playing video in the voice chats of Telegram Groups And Channel Configs TOKEN - Get bot token fro

mr_lokaman 46 Dec 25, 2022
Tautulli - A Python based monitoring and tracking tool for Plex Media Server.

Tautulli A python based web application for monitoring, analytics and notifications for Plex Media Server. This project is based on code from Headphon

Tautulli 4.7k Jan 07, 2023
A Python extension that provides bindings to WebRTC M92

This project follows the W3C specification with some modifications and additions to make it work better with Python applications, with useful APIs like programmatic audio and video.

Il'ya 104 Dec 26, 2022
A Telegram bot to convert videos into x265/x264 format via ffmpeg.

Video Encoder Bot A Telegram bot to convert videos into x265/x264 format via ffmpeg. Configuration Add values in environment variables or add them in

1 Mar 08, 2022