VideoOutput QML Type
Render video or camera viewfinder. More...
Import Statement: | import QtMultimedia |
Properties
- autoOrientation : bool
- contentRect : rectangle
- fillMode : enumeration
- flushMode : enumeration
- orientation : int
- sourceRect : rectangle
- videoSurface : object
Detailed Description
Rectangle { width: 800 height: 600 color: "black" MediaPlayer { id: player source: "file://video.webm" autoPlay: true } VideoOutput { id: videoOutput source: player anchors.fill: parent } }
The VideoOutput item supports untransformed, stretched, and uniformly scaled video presentation. For a description of stretched uniformly scaled presentation, see the fillMode property description.
The VideoOutput item works with backends that support either QObject or QPlatformVideoSink. If the backend only supports QPlatformVideoSink, the video is rendered onto an overlay window that is layered on top of the QtQuick window. Due to the nature of the video overlays, certain features are not available for these kind of backends:
- Some transformations like rotations
- Having other QtQuick items on top of the VideoOutput item
Most backends however do support QObject and therefore don't have the limitations listed above.
See also MediaPlayer and Camera.
Property Documentation
[since 5.2] autoOrientation : bool |
This property allows you to enable and disable auto orientation of the video stream, so that its orientation always matches the orientation of the screen. If autoOrientation
is enabled, the orientation
property is overwritten.
By default autoOrientation
is disabled.
This property was introduced in Qt 5.2.
See also orientation.
contentRect : rectangle |
This property holds the item coordinates of the area that would contain video to render. With certain fill modes, this rectangle will be larger than the visible area of the VideoOutput
.
This property is useful when other coordinates are specified in terms of the source dimensions - this applied for relative (normalized) frame coordinates in the range of 0 to 1.0.
Areas outside this will be transparent.
See also mapRectToItem() and mapPointToItem().
fillMode : enumeration |
Set this property to define how the video is scaled to fit the target area.
- Stretch - the video is scaled to fit.
- PreserveAspectFit - the video is scaled uniformly to fit without cropping
- PreserveAspectCrop - the video is scaled uniformly to fill, cropping if necessary
The default fill mode is PreserveAspectFit.
[since 5.13] flushMode : enumeration |
Set this property to define what VideoOutput
should show when playback is finished or stopped.
- EmptyFrame - clears video output.
- FirstFrame - shows the first valid frame.
- LastFrame - shows the last valid frame.
The default flush mode is EmptyFrame.
This property was introduced in Qt 5.13.
orientation : int |
In some cases the source video stream requires a certain orientation to be correct. This includes sources like a camera viewfinder, where the displayed viewfinder should match reality, no matter what rotation the rest of the user interface has.
This property allows you to apply a rotation (in steps of 90 degrees) to compensate for any user interface rotation, with positive values in the anti-clockwise direction.
The orientation change will also affect the mapping of coordinates from source to viewport.
See also autoOrientation.
sourceRect : rectangle |
This property holds the area of the source video content that is considered for rendering. The values are in source pixel coordinates, adjusted for the source's pixel aspect ratio.
Note that typically the top left corner of this rectangle will be 0,0
while the width and height will be the width and height of the input content. Only when the video source has a viewport set, these values will differ.
The orientation setting does not affect this rectangle.
See also QVideoFrameFormat::viewport().
[since 5.15] videoSurface : object |
This property holds the underlaying video surface that can be used to render the video frames to this VideoOutput element. It is similar to setting a QObject with videoSurface
property as a source, where this video surface will be set.
This property was introduced in Qt 5.15.
See also source.