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

Related tags

Video cv2PySide6
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)

Owner
null
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
OpenShot Video Editor is an award-winning free and open-source video editor for Linux, Mac, and Windows, and is dedicated to delivering high quality video editing and animation solutions to the world.

OpenShot Video Editor is an award-winning free and open-source video editor for Linux, Mac, and Windows, and is dedicated to delivering high quality v

OpenShot Studios, LLC 3.1k Jan 1, 2023
A youtube video link or id to video thumbnail python package.

Youtube-Video-Thumbnail A youtube video link or id to video thumbnail python package. Made with Python3

Fayas Noushad 10 Oct 21, 2022
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
A GUI based datamoshing apllication for everyone! Apply this glitch to your videos and gifs. Supports all video formats!

A GUI based datamoshing apllication for everyone! Apply this glitch to your videos and gifs. Supports all video formats!

Akascape 131 Dec 31, 2022
An easy to use GUI based video to image sequence converter (and vice versa).

Vdo & Img Conversion Tools This is a quick conversion tool made with python that can save you a lot of time. With this tool you can extract image sequ

Akash Bora 3 Sep 18, 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

null 1 Nov 19, 2021
MoviePy is a Python library for video editing, can read and write all the most common audio and video formats

MoviePy is a Python library for video editing: cutting, concatenations, title insertions, video compositing (a.k.a. non-linear editing), video processing, and creation of custom effects. See the gallery for some examples of use.

null 10k Jan 8, 2023
Text2Video's purpose is to help people create videos quickly and easily by simply typing out the video’s script and a description of images to include in the video.

Text2Video Text2Video's purpose is to help people create videos quickly and easily by simply typing out the video’s script and a description of images

Josh Chen 19 Nov 22, 2022
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 9, 2022