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)

Real-time video and audio streams over the network, with Streamlit.

streamlit-webrtc Example You can try out the sample app using the following commands.

Yuichiro Tachibana (Tsuchiya) 648 Jan 01, 2023
Streams video from raspberry pi to desktop T1 - Recognizes Faces on client T2

VideoStreamingServer Completed: Streams video from raspberry pi to desktop T1 - Recognizes Faces on client T2 In progress: Change the transmission Pro

1 Dec 06, 2021
Video Object Segmentation(VOS) From Zero to HeroVideo Object Segmentation(VOS) From Zero to Hero

Video Object Segmentation(VOS) From Zero to Hero! Goal 1:train a two layers cnn model for vos. Finish! see model.py FFNet for more diteal.(2021.9.30)

1 Oct 22, 2021
Add the dislike count back to my YouTube videos via a comment containing that information.

YouTube Dislikes Forrest Knight Python Version 3.0+ Only use if you know what the code actually does. I'm not responsible for your use of this code in

Forrest Knight 155 Dec 19, 2022
A platform which give you info about the newest video on a channel

youtube A platform which give you info about the newest video on a channel. This uses web scraping, a better implementation will be to use the API. BR

Custom components for Home Assistant 36 Sep 29, 2022
A Advanced Anime Theme VC Video Player created for playing vidio in the voice chats of Telegram Groups

Yui Vidio Player A Advanced Anime Theme VC Video Player created for playing vidio in the voice chats of Telegram Groups Demo Setting up Add this Bot t

Achu biju 32 Sep 16, 2021
Meteor scan - Scan through video for meteor

meteor_scan Scan through video for meteor Installation Install python packages b

2 Jun 04, 2022
Uncompress DEFLATE streams in pure Python

stream-deflate Uncompress DEFLATE streams in pure Python. Work in progress. This README serves as a rough design spec. Installation pip install stream

Michal Charemza 7 Oct 13, 2022
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
Python bindings for FFmpeg - with complex filtering support

ffmpeg-python: Python bindings for FFmpeg Overview There are tons of Python FFmpeg wrappers out there but they seem to lack complex filter support. ff

Karl Kroening 7.7k Jan 03, 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
Code for the manim-generated scenes used in 3blue1brown videos

Code for the manim-generated scenes used in 3blue1brown videos

Grant Sanderson 4.1k Jan 09, 2023
A Simple Telegram Bot By @Tellybots to add Subtitle Files in Video

Video-subtitle-merger A Simple Telegram Bot By @Tellybots to add Subtitle Files in Video Features Force Sub Button Added Soon Support Media Type Such

6 Dec 31, 2021
pyYotubemanager is full web automated bot capable of General tasks like:- Uploading a Video , Downloading , adding Title , Description , Listing types , adding Thumbnail

PyYoutubemanager Explore the docs » View Demo · Report Bug · Request Feature About The Project PyYotubemanager is full web automated bot capable of Ge

4 Jun 29, 2022
Stream anime from kaa.si with python

kaa.si-cli Stream anime using MPV player from kaa.si with python

Muhammad Rovino Sanjaya 52 Dec 24, 2022
MPV remote controller is a program for remote controlling mpv player with device in your local network through web browser.

MPV remote controller is a program for remote controlling mpv player with device in your local network through web browser.

5 May 26, 2022
This is a tool for making a every day video if you take a picture of you everyday

Face-Everyday-Maker-Studio Description This project is a tool for making a everyday video, which is timelapse video or slides video, of images but for

John A Betancourt G 9 Sep 06, 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
Extracting frames from video and create video using frames

Extracting frames from video and create video using frames This program uses opencv library to extract the frames from video and create video from ext

1 Nov 19, 2021
Rembg Video Virtual Green Screen Edition

Rembg Virtual Greenscreen Edition is a tool to create a green screen matte for videos

Tim Scarfe 217 Jan 06, 2023