QtAV是基于Qt和FFmpeg多媒体播放库

官方网站: http://qtav.org

项目地址:https://github.com/wang-bin/QtAV

Hardware decoding suppprt: DXVA2, VAAPI, VDA/VideoToolbox, CedarX, CUDA(the 1st player support CUDA on linux?)
OpenGL and ES2 support for almost all formats including Hi10P videos (The 1st player/library support 10bit in ES2? VLC, XBMC, mplayer does not support now)
Real time preview
Video capture in rgb and yuv format
OSD and custom filters
Filters in libavfilter, for example stero3d, blur
Subtitle track select. Dynamic change FFmpeg and libass engine
Play frame by frame
Playback speed control
Variant streams: locale file, http, rtsp etc. and your custom streams
Audio channel, tracks and external audio tracks
Dynamically change render engine when playing.
Dynamically change video decoder
Multiple video outputs for 1 player
Video eq(software and OpenGL): brightness, contrast, saturation, hue
QML support. Most playback APIs are compatible with QtMultimedia module
Compatiblity: QtAV can be built with both Qt4 and Qt5, FFmpeg(>=1.0) and Libav (>=9.0). Latest FFmpeg release is recommended.

FFmepg (编译需要)

事先需要下载对应平台的FFmpeg(https://ffmpeg.org)

需要 FFmepg 的 Static 和 Dev ... 包 ...

解压到系统目录,例如 E:\ffmepg

Windows安装QtAV

直接通过 http://qtav.org 下载对应平台的安装包即可 ...

Windows编译QtAV

注意:如果暂时不使用portaudio可以先不准备 ...


GCC 环境编译: 在QT项目-构件-构件环境中添加:
    设置 CPATH 到 E:\ffmpeg\include;
    设置 LIBRARY_PATH 到 E:\ffmpeg\lib;

MINGW 环境编译: 在QT项目-构件-构件环境中添加:
    设置 INCLUDE 到 E:\ffmpeg\include;
    设置 LIB 到 E:\ffmpeg\lib;

当然:Debug 和 Release 按需求编译了

在编译完成后,进入管理员权限的CMD终端

例如: cd E:\QtAV\build-QtAV-Desktop_Qt_5_7_0_MinGW_32bit-Release

安装: sdk_install.bat ... 即可

使用 …

#include "widget.h"  
#include <QApplication>  
#include <QtAV/AVPlayer.h>  
#include <QtAV/GLWidgetRenderer.h>  
int main(int argc, char *argv[])  
{  
    QApplication a(argc, argv);  
    QtAV::GLWidgetRenderer renderer;  
    renderer.show();  
    QtAV::AVPlayer player;  
    player.setRenderer(&renderer);  
    player.play("http://a.mp4");  
    return a.exec();  
}  


Published

2016-10-23

Categories


Tags