Multimedia 概述
Qt 提供多媒體支持通過
Qt Multimedia
module. The Qt Multimedia module provides a rich feature set that enables you to easily take advantage of a platform's multimedia capabilities, such as media playback and the use of camera devices.
特徵
Here are some things you can do with the Qt Multimedia APIs:
-
Access raw audio devices for input and output.
-
Play low latency sound effects.
-
Play 3D spatial audio.
-
Play media files in playlists (such as compressed audio or video files).
-
Record audio and compress it.
-
使用攝像頭 (包括取景器) 捕獲圖像 錄製影片
-
Decode audio media files into memory for processing.
The Qt Multimedia APIs are categorized into three main components. More information specific to each component is available in the overview pages. You can also take a look at some
recipes
.
For some quick recipes, see this table:
|
用例
|
範例
|
QML 類型
|
C++ 類
|
|
播放音效
|
|
SoundEffect
|
QSoundEffect
|
|
Playing 3D sound
|
audiopanning
|
SpatialSound
,
AudioEngine
|
QSpatialSound
,
QAudioEngine
|
|
播放編碼音頻 (MP3 AAC 等)
|
player
|
MediaPlayer
|
QMediaPlayer
|
|
Playing raw audio data with low latency
|
audiooutput
,
|
|
QAudioSink
|
|
訪問原生音頻輸入數據
|
spectrum
,
audiosource
|
|
QAudioSource
|
|
錄製編碼音頻數據
|
audiorecorder
|
CaptureSession
,
AudioInput
,
MediaRecorder
|
QMediaCaptureSession
,
QAudioInput
,
QMediaRecorder
|
|
Discovering audio and video devices
|
audiodevices
|
MediaDevices
,
audioDevice
,
cameraDevice
|
QMediaDevices
,
QAudioDevice
,
QCameraDevice
|
|
視頻迴放
|
player
,
mediaplayer
|
MediaPlayer
,
VideoOutput
,
Video
|
QMediaPlayer
,
QVideoWidget
,
QGraphicsVideoItem
|
|
Capturing audio and video
|
camera
,
|
recorder
|
CaptureSession
,
Camera
,
AudioInput
VideoOutput
|
QMediaCaptureSession
,
QCamera
,
QAudioInput
,
QVideoWidget
|
|
捕獲照片
|
camera
,
|
recorder
|
CaptureSession
,
Camera
,
ImageCapture
|
QMediaCaptureSession
,
QCamera
,
QImageCapture
|
|
捕獲影片
|
camera
,
|
recorder
|
CaptureSession
,
Camera
,
MediaRecorder
|
QMediaCaptureSession
,
QCamera
,
QMediaRecorder
|
局限性
The Qt Multimedia APIs build upon the multimedia framework of the underlying platform. This can mean that support for various codecs, or containers will vary between machines. This support depends on what the end user has installed. See
Supported Media Formats
for more detail.
先前版本的變化
If you previously used Qt Multimedia in Qt 5, see
Changes to Qt Multimedia
for more information on what has changed, and what you might need to change when porting code to Qt 6.
參考文檔編製