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)

Converts Betaflight blackbox gyro to MP4 GoPro Meta data so it can be used with ReelSteady GO

Here are a bunch of scripts that I created some time ago as a proof of concept that Betaflight blackbox gyro data can be converted to GoPro Metadata F

108 Oct 05, 2022
A pure python media player that can be used in AI media API development.

A pure python media player that can be used in AI media API development.

YDOOK 1 Dec 04, 2021
Convert Video Files To Text And Audio

Video-To-Text Convert Video Files To Text And Audio Convert To Audio 1: open dvtt folder in cmd 2: run this command in cmd = main.py Audio Convert To

Delta Inc. 2 Dec 05, 2021
video streaming userbot (vsu) based on pytgcalls for streaming video trought the telegram video chat group.

VIDEO STREAM USERBOT ✨ an another telegram userbot for streaming video trought the telegram video chat. Environmental Variables 📌 API_ID : Get this v

levina 6 Oct 17, 2021
Your self hosted Youtube media server

The Tube Archivist Your self hosted Youtube media server Core functionality Subscribe to your favourite Youtube channels Download Videos using yt-dlp

Simon 2.1k Dec 31, 2022
Techie Sneh 17 Nov 23, 2021
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

8.2k Dec 26, 2022
A Python media index

pyvideo https://pyvideo.org is simply an index of Python-related media records. The raw data being used here comes out of the pyvideo/data repo. Befor

pyvideo 235 Dec 24, 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
Simple VLC-based media player that can play multiple videos at the same time

Screenshots About Simple VLC-based media player that can play multiple videos at the same time. You can play as many videos as you like, the only limi

161 Jan 05, 2023
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

Roman 6 Apr 06, 2022
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

Brandon Castellano 1.8k Jan 02, 2023
Takes a video as an input and creates a video which is suitable to upload on Youtube Shorts and Tik Tok (1080x1920 resolution).

Shorts-Tik-Tok-Creator Takes a video as an input and creates a video which is suitable to upload on Youtube Shorts and Tik Tok (1080x1920 resolution).

Arber Hakaj 5 Nov 09, 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
Autocut the Twitch VODs based on Marker

Markut Given the VOD of the stream and the markers that are exported as a CSV file, generate a video using ffmpeg that cuts out part of the VOD accord

Tsoding 18 Dec 19, 2022
Examples of usage of GStreamer hlssink3 plugin.

Examples of usage of GStreamer hlssink3 plugin.

Rafael Carício 2 Aug 03, 2022
A Python library that simplifies working with video from soccer matches.

Match Video This is a Python library that simplifies working with video from soccer matches. It allows match video to be selected intuitively by perio

Grant Wenzinger 2 Jul 21, 2022
A wrapper around ffmpeg to make it work in a concurrent and memory-buffered fashion.

Media Fixer Have you ever had a film or TV show that your TV wasn't able to play its audio? Well this program is for you. Media Fixer is a program whi

Halit Şimşek 3 May 04, 2022
In this project, we will be blurring the background in a live video feed

In this project, we will be blurring the background in a live video feed. This can be further integrated into online meetings, streamings etc.

Hassan Shahzad 2 Jan 06, 2022