网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
涉及技术:
1、ffmpeg下linux编译+x264
进入x264解压
./configure --prefix=/usr/local/x264 --enable-shared --enable-static --host=arm-linux --cross-prefix=aarch64-linux-gnu- --disable-opencl --enable-fPIC --disable-asm
make -j8
make install
ffmpeglinux下编译
--prefix=/home/Desktop/ffmpeg/ffmpeg-outX11 --enable-x11grab --enable-filters --enable-asm --enable-ffmpeg --enable-ffplay --enable-ffprobe --enable-doc --enable-cross-compile --cross-prefix=aarch64-linux-gnu- --arch=aarch64 --target-os=linux --host-os=linux --enable-gpl --enable-version3 --enable-small --enable-shared --enable-static --enable-encoder=rawvideo --enable-encoder=mpeg2video --enable-encoder=mp2 --enable-encoder=libx264 --enable-libx264 --enable-muxer=adts --enable-muxer=mpegts --enable-muxer=mgeg2video --enable-muxer=rtsp --enable-muxer=hls --enable-muxer=h264 --enable-muxer=rtp --enable-muxer=avi --enable-muxer=flv --enable-muxer=mp4 --enable-demuxer=mpegts --enable-demuxer=rtsp --enable-demuxer=hls --enable-demuxer=h264 --enable-demuxer=rtp --enable-demuxer=flv --enable-demuxer=mp4 --enable-demuxer=avi --enable-demuxer=mpegps --enable-demuxer=mpegtsraw --enable-parser=aac --enable-parser=h264 --enable-parser=mpeg4video --enable-parser=mpegvideo --enable-parser=mpegaudio --enable-bsf=h264_mp4toannexb --enable-protocol=http --enable-protocol=rtp --enable-protocol=rtmpts --enable-protocol=https --enable-protocol=hls --enable-protocol=file --enable-protocol=data --enable-gray --enable-safe-bitstream-reader --enable-swscale --enable-swscale-alpha --enable-filter=scale --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib
make -j8
make install
借鉴博客
https://www.cnblogs.com/yaoz/p/6944942.html ffmpeg编译
2、Linux下动态库路径搜索设置&动态库的依赖库
sudo vi /etc/ld.so.conf 将想要包含的动态库路径放里面
sudo ldconfig 将设置同步到系统上,注意设置之后ldd查看调用动态库寻找的时候最好关闭命令矿重新打开
动态库的依赖库(需要使用动态库需要链接的动态库) LD_Library_PATH 使用相对路径 -rpath .属性 libswresample.so.3 => ./libswresample.so.3
sudo ldconfig 可以创建出实体动态库相应的软链接
借鉴博客
https://blog.csdn.net/weixin_37139197/article/details/78736291
3、cmake&make&g++编译
使用自己编出的动态库编测试程序,依赖库放置lib下
g++ main.cpp -I/home/ffmpeg/include -L/home/ffmpeg/lib -lDesktopRecordSO_shared
将cmanager和DoubleRecord以及依赖库编译生成动态库
g++ cmanager.cpp DoubleRecord.cpp -g -std=c++11 -fPIC -Wl,-rpath ./ffmpeg/lib -shared -o libDesktopRecordSO_shared.so -I/home
/DesktopRecord/ffmpeg/include -lz -llzma -lm -lbz2 -lasound -lxcb -lssl -lavformat -lavcodec -lavutil -lx264 -lswresample -lswscale
cmake博客 编写生成动态库 失败
cmake_minimum_required (VERSION 3.5)
project (DesktopRecordSO)
add_compile_options(-fPIC)
include_directories (/home/Desktop/DesktopRecord_so/ffmpeg/include)
find_library(TESTFUNC_LIB libavcodec.a libxcb.a libavfilter.a libavformat.a libavutil.a libpostproc.a libswresample.a libswscale.a libx264 HINTS /home/Desktop/DesktopRecord_so/ffmpeg/lib)
set (SRC_LIST /home/Desktop/DesktopRecord_so/cmanager.cpp)
add_library (DesktopRecordSO_shared SHARED ${SRC_LIST})
set_target_properties (DesktopRecordSO_shared PROPERTIES OUTPUT_NAME "DesktopRecordSO_shared")
target_link_libraries (DesktopRecordSO_shared ${TESTFUNC_LIB})
set (LIBRARY_OUTPUT_PATH /home/Desktop/DesktopRecord_so/lib)
借鉴博客
https://blog.csdn.net/whahu1989/article/details/82078563#t5
make 编写生成动态库 失败
4、linux zlog日志库
借鉴博客
https://blog.csdn.net/wangqingchuan92/article/details/107338690/
https://www.cnblogs.com/superPerfect/p/3617716.html
https://blog.csdn.net/sinat_36436112/article/details/105921759?utm_term=zlog%E6%97%A5%E5%BF%97%E7%9A%84%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6&utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2allsobaiduweb~default-0-105921759&spm=3001.4430
http://hardysimpson.github.io/zlog/ 下载最新的zlog源码包以及代码直接输出配置文件
https://blog.csdn.net/fireblue1990/article/details/55808086
获取本地时间 创建文件夹mkdir函数 注意操作mode |来组合
void GetTimeEx2(char *pBuf)
{
time_t nt;
time(&nt);
struct tm *local;
local = localtime(&nt);
sprintf(pBuf, "%04d%02d%02d", local->tm_year + 1900,
local->tm_mon + 1,
local->tm_mday);
}
bool InitLogFile(void)
{
int rc;
char *szAppPath;
szAppPath = getcwd(NULL, 0);
char szTime[32] = { 0 };
GetTimeEx2(szTime);
char szConfigPath[10000] = { 0 };
sprintf(szConfigPath, "%s/zlog.conf", szAppPath);
char szLogFilePath[10000] = { 0 };
sprintf(szLogFilePath, "%s/log", szAppPath);
![img](https://img-blog.csdnimg.cn/img_convert/d8c429b29bdf73f4e9935eeee49aab5f.png)
![img](https://img-blog.csdnimg.cn/img_convert/ed4a5eed81ff6b2e5caee20aa76d051b.png)
**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**
**[需要这份系统化的资料的朋友,可以添加戳这里获取](https://bbs.csdn.net/topics/618668825)**
**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**
ttps://bbs.csdn.net/topics/618668825)**
**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**