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)

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
Automagically synchronize subtitles with video.

FFsubsync Language-agnostic automatic synchronization of subtitles with video, so that subtitles are aligned to the correct starting point within the

Stephen Macke 5.7k Jan 06, 2023
Python based script to operate FFMPEG.

FMPConvert Python based script to operate FFMPEG. Ver 1.0 -- 2022.02.08 Feature ✅ Maximum compatibility: Third-party dependency libraries unused ✅ Che

cybern000b 1 Feb 28, 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
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
Video Translation Into Text

2021/12/9 The project has been updated Added a home screen Just drag it onto the screen The final results \ 2021/12/9 项目已更新 添加了主界面 拖到即可 最后结果 \ Using t

10 Mar 12, 2022
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
Become a virtual character with just your webcam!

Become a virtual character with just your webcam!

Rich 300 Jan 03, 2023
A python generator that converts youtube videos to ascii art in your console.

Video To ASCII A python generator that converts youtube videos to ascii art in your console. This has not been tested for windows! Example Normal mode

Julian Jones 24 Nov 02, 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
Python Script for Streaming YouTube Videos in VLC Media Player.

Short Description Use this Simple Script to stream YouTube Video to VLC

Sijey 6 May 27, 2021
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
VIT - VideoInTerminal. A quick piece of code to play videos in your terminal using python

VIT VIT - VideoInTerminal. A quick piece of code to play videos in your terminal using python.

ShellTear 3 Mar 03, 2022
Vigia-youtube - The YouTube Watch bot is able to monitor channels on Google's video platform

Vigia do YouTube O bot Vigia do YouTube é capaz de monitorar canais na plataform

Alessandro Feitosa Jr 10 Oct 03, 2022
Python package for Near Duplicate Video Detection (Perceptual Video Hashing) - Get a 64-bit comparable hash-value for any video.

The Python package for near duplicate video detection ⭐️ Introduction Videohash is a Python package for detecting near-duplicate videos (Perceptual Vi

Akash Mahanty 144 Dec 19, 2022
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
Cvplayer - A simple video player written in python using ffpyplayer and OpenCV

Video Player cvplayer is a minimal wrapper around the ffpyplayer.MediaPlayer cla

ADI 7 Dec 19, 2022
Video processing routines for SciPy

scikit-video Video Processing SciKit BETA Video processing algorithms, including I/O, quality metrics, temporal filtering, motion/object detection, mo

Alex Izvorski 119 Dec 27, 2022
goal: render videos on eu4's timeline function

Rendering Videos on the EU4 Time Line This repository contains code to create an eu4-savefile that plays back a video in question.

29 Dec 24, 2022
A script to disable steam servers regionwise. [Works on Windows only]

Csgo-server-blocker A script to disable steam servers regionwise. [Works on Windows only] Dependencies python3.x Usage: pip install requirements.txt I

Aditya Bennur 2 Jun 10, 2022