Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PySide2.QtWidgets import QApplication
- from PySide2.QtQml import qmlRegisterType
- from PySide2.QtQuick import QQuickView
- from PySide2.QtMultimedia import QAbstractVideoFilter, QVideoFilterRunnable
- from PySide2.QtCore import QUrl
- class ExampleFilterRunnable(QVideoFilterRunnable):
- def run(self, frame, surfaceFormat, flags):
- return frame
- class ExampleFilter(QAbstractVideoFilter):
- def createFilterRunnable(self):
- return ExampleFilterRunnable()
- app = QApplication([])
- qmlRegisterType(ExampleFilter, "ExampleFilter", 1, 0, "ExampleFilter")
- view = QQuickView()
- url = QUrl("example.qml")
- view.setSource(url)
- view.setResizeMode(view.SizeRootObjectToView)
- view.show()
- app.exec_()
- import QtQuick 2.0
- import QtQuick.Controls 2.3
- import QtMultimedia 5.8
- import ExampleFilter 1.0
- Rectangle {
- id: rectangle
- width: 800
- height: 600
- color: "black"
- ExampleFilter {
- id: filter
- }
- MediaPlayer {
- id: player
- source: "https://archive.org/download/Mario1_500/Mario1_500_LQ.avi"
- autoPlay: true
- }
- VideoOutput {
- id: videoOutput
- source: player
- filters: [filter]
- anchors.fill: parent
- }
- }
Add Comment
Please, Sign In to add comment