当前位置:网站首页>Ffmpeg serial 1 - environment construction
Ffmpeg serial 1 - environment construction
2022-04-21 21:41:00 【FlyerGo】
Preface
Before, when I was engaged in Android development, I wanted to learn audio and video practice , In my mind, I think if there is one specially developed for Android FFmpeg Just a tutorial . Slowly found that this idea is very unreliable , Because there were few audio and video related tutorials at that time , If you want to target Android, it's rare .
Later, in order to learn FFmpeg, The author is also intermittent , Start with the basic data of audio and video , from FFmpeg Compile to practice , I hope that through my study, I can uncover FFmpeg The veil of mystery , Until now, I only dare to say that I am just a novice in the army of audio and video development , Although I've been groping for a long time ,
But it is still difficult to advance , I think there are two main reasons , It's a fairy's Guide , The second is intermittent , Lack of systematic learning summary .
The most important thing in learning is to master , If you want to learn in your heart , However, there is no fully targeted tutorial materials , In the end, you will find that you still think more than you do , You might as well not …
about FFmpeg This thing , You say it's difficult , In fact, it's just the same thing , You say it's simple , Countless people are forced to give up at the compilation stage , Perhaps it is not itself that is difficult , More learners have the courage to start and persevere .
In order to enable novices to get started more quickly FFmpeg, The author will start a series on FFmpeg Related articles , It mainly involves audio and video unpacking 、 Audio and video decoding 、 Audio and video coding 、 Audio resampling and other related knowledge points .
At the end of this series , It may end with a little practice , The content of this practice is generally :
1、 Enter multiple mp3 file , Decoded into pcm, Then resampling , Splice and code into aac Audio ;
2、 Enter multiple mp4 file , Extract the video and decode it into yuv, Then splice and encode into h264;
3、 take 1 Medium aac Audio and 2 Medium h264 Merge videos into new mp4 file .
Today, we mainly set up the environment first , After all, a journey of a thousand miles begins with a single step .
Author's environment
The example environment used by the author Mac System , The development tool is CLion.
install FFmpeg
About introducing in PC Up lead in FFmpeg It's still relatively simple , It can be installed through the command line tool , Then extract and process the relevant library , Or you can directly use the source code and directly compile the relevant libraries . But if you want to FFmpeg To inherit into Android, you need to use NDK The tutorial compiled ,
For how to use NDK Tutorial compilation FFmpeg Children's shoes can go through my previous articles , Maybe I can sort out one later .
Whereas FFmpeg It's a C Language library , Born with cross platform ability , Therefore, the author suggests to study directly in PC Just practice and study , If you've learned , That's transplanted to other platforms. That's not so easy Do you .
Today, I use the command line installation method to integrate FFmpeg, stay Mac We can use Homebrew Package management tools for installation ,Linux It can be used apt.
1、 use first Homebrew install ffmpeg:
brew install ffmpeg
Then wait quietly , Generally, if you fail, it's mostly a network problem , The solution is well known …
2、 After successful installation, we use brew info Command to see where the installation went , When introducing the project later, we need to use , The order is :
brew info ffmpeg
For example, the author's output is shown in the figure :

To configure CLion engineering
Newly-built CLion After the project , We will FFmpeg Configure the library path and header file , To configure CMakeLists.txt:
cmake_minimum_required(VERSION 3.17)
# Be careful FFmpegPro It's the name of the project , This development needs to be replaced according to the actual situation
project(FFmpegPro)
set(CMAKE_CXX_STANDARD 11)
# FFmpeg Installation directory , By command "brew info ffmpeg" obtain
set(FFMPEG_DIR /opt/homebrew/Cellar/ffmpeg/5.0)
# Header file search path
include_directories(${FFMPEG_DIR}/include/)
# Search path of dynamic link library or static link library
link_directories(${FFMPEG_DIR}/lib/)
add_executable(FFmpegPro main.cpp)
# Link library
target_link_libraries(FFmpegPro
#FFmpeg library
avcodec
avfilter
avformat
avutil
swresample
swscale
)
Simply test whether the configuration is successful , stay main Simply call some... In the code ffmpeg Library API, If it works normally, it indicates that the configuration is successful :
#include <iostream>
extern "C"{
#include "libavcodec/avcodec.h"
#include <libavformat/avformat.h>
#include "libavutil/avutil.h"
}
int main(int arg,char **argv) {
// Print ffmpeg Information about
std::cout << "av_version_info:" << av_version_info() << std::endl;
std::cout << "av_version_info:" << avcodec_configuration() << std::endl;
return 0;
}
If it works normally, print out ffmpeg The version number of indicates that the environment configuration is successful .
Pay attention to me , Progress together , Life is more than coding!!!

版权声明
本文为[FlyerGo]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204212134195757.html
边栏推荐
- Browser principle interview questions
- 2022安全员-A证考试练习题及在线模拟考试
- (亲测有效)Oracle在linux下命令行无法使用退格键退格,无法使用上下键切换历史命令的解决办法,会出现乱码
- LeetCode琅琊榜第三层-盛最多水的容器
- Hospital-Oriented RFID Service
- UML之一综合设计例题
- TCP / IP protocol
- OA form design case display
- Various DNS: Baidu DNS / Alibaba DNS / 114dns / Tencent DNS / Google DNS / OpenDNS comparison evaluation
- iphone测试,自定义tabbar的图片会跟着屏幕滑动
猜你喜欢

Nacos注册中心-服务注册与分级存储

浏览器原理面试题
![[charming Java] - data types and variables](/img/d1/22122803b7b796fbc5e269219d6db8.png)
[charming Java] - data types and variables

135, 137, 138, 139 and 445 port explanation and closing method

Use try-with-resources or close this “FileOutputStream“

User manual for visual view of data source of easybi reporting system

Common SQL optimization

JVM 从入门到放弃之 ZGC 垃圾收集器精讲

在线YAML转Properties工具

初识线程安全有这一篇就够了
随机推荐
Neural network learning small record 56 -- the principle and function of batch normalization layer
Eeasybi report system data source selection code development manual
【史上最全 BAT 必问高并发总结】
Smart face recognition 4 -- pytoch uses retinaface + facenet to build a face recognition platform
或许你不知道的12条SQL技巧
在线YAML转Properties工具
【C语言进阶9——指针的进阶(6)- 回调函数】
Common data type conversion methods in crypto
Linux MySQL常用命令
Dynamically connecting data sources and transaction rollback
2022 safety officer-a certificate examination exercises and online simulation examination
Multi tenant points system function list
135, 137, 138, 139 and 445 port explanation and closing method
Shell编程学习(四)read读取、函数、文件归档、定时任务
01_ Cross compile Hello program
【UML-操作契约】
一加连发两款耳机产品:充电10分钟 听歌20小时
Reflex WMS study experience shelf principle
PHP数组函数extract 使用详解
Pay off 900000 housing loans to get the resignation certificate? Tencent response: inconsistent with the actual situation