QtAV is a media playing library based on Qt and FFmpeg. It can help you to write a player with less effort than ever before.
QtAV has been added to FFmpeg projects page http://ffmpeg.org/projects.html
QtAV is free software licensed under the term of LGPL v2.1. If you use QtAV or its constituent libraries, you must adhere to the terms of the license in question.
QtAV can meet your most demands
- Seek, pause/resume
- Video capture
- OSD and custom filters
- Aspect ratio
- Transform video using GraphicsItemRenderer. (rotate, shear, etc)
- Playing frame by frame (currently support forward playing)
- Playing speed control. At any speed.
- Variant streams: locale file, http, rtsp, etc.
- Playing music
- Choose audio channel
- Choose media stream, e.g. play a desired audio track
- Volume control
- Fullscreen, stay on top
- Multiple render engine support. Currently supports QPainter, GDI+, Direct2D, XV and OpenGL(and ES2).
- Dynamically change render engine when playing.
- Multiple video outputs for 1 player
- Region of interest(ROI), i.e. video cropping
- QML support as a plugin
- Compatiblity: QtAV can be built with both Qt4 and Qt5. QtAV supports both FFmpeg(>=0.9) and Libav.
QtAV currently uses FFmpeg to decode video, convert image and audio data, and uses PortAudio to play sound. Every part in QtAV is designed to be extensible. For example, you can write your audio output class using OpenAL, image converting class using cuda to get better performance etc. These features will be added in the feature by default.
- FFmpeg (>=0.9)Latest version is recommanded.
or Libav (>=0.8) Latest version is recommanded.
The required development files for MinGW can be found in sourceforge page: depends
You can build QtAV with many compilers and on many platforms. You can use gcc, clang, vc to compile it.
See the wiki Build QtAV
Here is a brief guide:
It's recommend not to build in source dir.
cd your_build_dir
qmake QtAV_project_dir/QtAV.pro
make
qmake will run check the required libraries at the first time, so you must make sure those libraries can be found by compiler.
Then qmake will create a cache file .qmake.cache in your build dir. Cache file stores the check results, for example, whether portaudio is available. If you want to recheck, run qmake QtAV_project_dir/QtAV.pro -config recheck
WARNING: If you are in windows mingw with sh.exe environment, you may need run qmake twice.
Wrtie a media player using QtAV is quite easy.
WidgetRenderer renderer;
renderer.show();
AVPlayer player;
player.setRenderer(&renderer);
player.play("test.avi");
For more detail to using QtAV, see the wiki Use QtAV In Your Project or examples.
QtAV can also be used in Qml
import QtQuick 2.0
import QtAV 1.3
Rectangle {
width: 640
height: 360
color: "black"
VideoOut {
id: vo
anchors.fill: parent
}
AVPlayer {
id: player
videoOut: vo
}
MouseArea {
anchors.fill: parent
onClicked: {
player.source = "test.mp4"
player.play()
}
}
}
- Fork QtAV project on github and make a branch. Commit in that branch, and push, then create a pull request to be reviewed and merged.
- Create an issue if you have any problem when using QtAV or you find a bug, etc.
An simple player can be found in examples. The command line options is
player [-vo qt|gl|d2d|gdi|xv] [url/path]
You can choose a paint engine with -vo option. For example, in windows that support Direct2D, you can run
player -vo d2d filename
The default is Qt's paint engine.
- Double click: fullscreen switch
- Ctrl+O: open a file
- Space: pause/continue
- F: fullscreen on/off
- I: switch display quality
- T: stays on top on/off
- N: show next frame. Continue the playing by pressing "Space"
- O: OSD
- P: replay
- Q/ESC: quit
- S: stop
- R: switch aspect ratio
- M: mute on/off
- Up / Down: volume + / -
- Ctrl+Up/Down: speed + / -
- -> / <-: seek forward / backward
- Drag and drop a media file to player
The default behavior can be replaced by subclassing QObject and call void AVPlayer::setPlayerEventFilter(QObject *obj)
(use null to disable).
- Component framework
- Subtitle
- Filters: filter api. integrate all filters in libavfilter.
- Hardware acceleration using DirectX, NVIDIA Cuda, ATI UVD, Intel IPP, OpenCL and OpenGL:
- decoding: DXVA, XvBA, cuvid, VAAPI
- image, audio and text filters
- rendering: DirectX
- Stylish GUI based on Qt Graphics View Framework
- Document and SDK
- Other: better sync method and seeking, tests, playing statistics, etc.
- More platform support. Maemo, Android, iOS, BB10 etc. Depends on Qt and FFmpeg for those platforms.
- ppa, debian package etc.
Use QtAV in QML with OpenGL shaders(example is from qtmultimedia. But qtmultimedia is replaced by QtAV)
QtAV on Mac OS X
IP camera using QtAV. OS: Fedora 18 (some developers from Italy http://www.selcomsrl.eu/)
Rotate a video item
Video Wall
软件由我一人利用空余学习和工作时间开发。如果您觉得不错,可以考虑资助一下
Thanks
Copyright © Wang Bin [email protected]
Shanghai University, Shanghai, China
2013-01-21