If the text is the original article, shall not be reproduced without permission
of the original bloggers blog address: https://blog.csdn.net/qq21497936
original bloggers blog Navigation: https://blog.csdn.net/qq21497936/article/details / 102 478 062
This article blog address: https://blog.csdn.net/qq21497936/article/details/104081729
table of Contents
Step one: download, compile placed in a folder
Step four: Install sudo make install
Step Five (supplement): For developers need to reload after installation
Yuv turn mpeg4 format and packaged as mp4
Qt + FFmpeg project template and built environment ubuntu
FFmpeg development Box
" FFmpeg Development Notes (b): ffmpeg build the development environment and compiler ubuntu "
"FFmpeg Development Notes (c): ffmpeg encoding yuv420p stored as avi / mp4": to be released
"FFmpeg Development Notes (d): ffmpeg decoding avi / mp4 player": to be released
Continued to supplement ...
FFmpeg Development Notes (b): ffmpeg build a development environment and compiler in ubuntu
blessing
I wish you all a happy New Year's Eve New Year's Eve! ! !
Wuhan Come on, come on people across the country! ! !
Foreword
This chapter describes ffmpeg on ubuntu18.04 compiler and development environment to build, with reference to the relevant cross compiler may also be present section.
FFmpeg Download
This chapter using multiple versions of current use, previous chapter is compiled ffmpeg4, the actual 4 to 3 to change something, I do not go into these specific.
Use this section 3.2.14 version.
Official Download: http://ffmpeg.org/download.html#releases
CSND Download: https://download.csdn.net/download/qq21497936/12104638
The latest version of the 3.2 series.
Compile ffmpeg
Step one: download, compile placed in a folder
Step two: Configure lack yasm (looks like a support assembly instructions optimization, do not control)
(Note: The prefix parameter is not specified, the default installed directly into the system)
./configure
Change parameters continue configuration, change the dynamic library:
./configure --disable-yasm --enable-shared
Step Three: compiler make
make
Step four: Install sudo make install
sudo make install
Step Five (supplement): For developers need to reload after installation
ldconfig
Command-Line Test
View version
Yuv turn mpeg4 format and packaged as mp4
ffmpeg -s 176x144 -pix_fmt yuv420p -i 176_144.yuv -vcodec mpeg4 176_144.mp4
Qt + FFmpeg project template and built environment ubuntu
Add the library (header files included by default in include system)
FFmpeg add and configure the search path, build step can also refer to " FFmpeg Development Notes (a): ffmpeg introduction, windows development environment to build (mingw and MSVC) " in the " New FFmpeg project ," The main difference is the presence of the configuration file, as follows:
FFmpegServer.pri (I use the system header files and libraries, where no additional introduced)
LIBS += \
-lavcodec \
-lavdevice \
-lavfilter \
-lavformat \
-lavutil \
-lpostproc \
-lswscale
FFmpegMnager.h
#ifndef FFMPEGMANAGER_H
#define FFMPEGMANAGER_H
#include <QObject>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavdevice/avdevice.h>
#include <libavformat/version.h>
#include <libavutil/time.h>
#include <libavutil/mathematics.h>
}
class FFmpegManager : public QObject
{
Q_OBJECT
public:
explicit FFmpegManager(QObject *parent = nullptr);
signals:
public:
void testEnv();
};
#endif // FFMPEGMANAGER_H
FFmpegManager.cpp
#include "FFmpegManager.h"
#include <QDebug>
FFmpegManager::FFmpegManager(QObject *parent) : QObject(parent)
{
}
void FFmpegManager::testEnv()
{
qDebug() << __FILE__ << __LINE__ << avcodec_configuration();
}
测试运行输出
工程模板v1.0.0
工程模板v1.0.0:
- 使用系统ffmpeg库;
- 使用系统ffmpeg头文件;
- 模板不带ffmpeg库(使用系统库文件);
- 不单独带ffmpeg头文件(使用系统头文件);
- 包含一个测试函数测试环境是否搭建成功。
入坑
入坑一:播放器播放不出yuv格式,专用播放器可以播放yuv(需要设置w、h,甚至是格式:yuv420p,yuv444等等)
原因:
yuv格式用播放器是播放不出来的,因为yuv是原始数据格式,需要设置播放的宽度和高度才能正确解析,大部分播放器不会这么智能。
解决方法:
不播放,直接使用ffmpeg命令进行转换
ffmpeg -s 176x144 -pix_fmt yuv420p -i 176_144.yuv -vcodec mpeg4 176_144.mp4
入坑二:安装ffmpeg后,工程编译成功,但是运行提示失败
原因:
安装完ffmpeg,但是库的路径没有更新。
解决方法:
需要重启计算机或者使用命令ldconfig进行库路径更新,当然也可以设置
QT_LIBRARY_PATH=/usr/local/lib
直接引入。
原博主博客地址:https://blog.csdn.net/qq21497936
原博主博客导航:https://blog.csdn.net/qq21497936/article/details/102478062
本文章博客地址:https://blog.csdn.net/qq21497936/article/details/104081729