ffmpeg在ubuntu和Qt下的安裝及配置例程
阿新 • • 發佈:2019-02-06
2.解壓後進入ffmpeg資料夾下,執行命令:
./configure --enable-shared;//預設安裝到/usr/local/下。也可以通過在後面新增“--prefix=目錄”進行更改
make
sudo make install
3.在配置Qt下的ffmpeg開發環境下,需要注意修改/usr/local/include/libavutil/common.h檔案
最上面新增:
#ifndef UINT64_C
#define UINT64_C(value) __CONCAT(value, ULL)
#endif
4.注意在configure時不新增後面的--enable-shared得到是靜態庫檔案,不利於後面的開發
5.在/etc/ld.so.conf中新增/usr/local/lib,執行命令sudo ldconfig即可在在系統內全域性使用
6.Qt的pro檔案新增:
INCLUDEPATH += /usr/local/include
LIBS += -L"/usr/local/lib"
LIBS += -lavcodec -lavdevice -lavfilter -lavformat -lavutil -lswresample -lswscale
main.cpp檔案:
#ifdef __cplusplus
extern "C"{
#endif
#include <libavutil/avstring.h>
#include <libavutil/opt.h>
#include <libavutil/parseutils.h>
#include <libavutil/pixdesc.h>
#include <libavutil/frame.h>
#include <libavutil/imgutils.h>
#include <libavutil/samplefmt.h>
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libswscale/swscale.h>
#ifdef __cplusplus
}
#endif
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
av_register_all();
Widget w;
w.show();
return a.exec();
}
INCLUDEPATH += /usr/local/include
LIBS += -L"/usr/local/lib"
LIBS += -lavcodec -lavdevice -lavfilter -lavformat -lavutil -lswresample -lswscale
extern "C"{
#endif
#include <libavutil/avstring.h>
#include <libavutil/opt.h>
#include <libavutil/parseutils.h>
#include <libavutil/pixdesc.h>
#include <libavutil/frame.h>
#include <libavutil/imgutils.h>
#include <libavutil/samplefmt.h>
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libswscale/swscale.h>
#ifdef __cplusplus
}
#endif
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
av_register_all();
Widget w;
w.show();
return a.exec();
}