https://blog.youkuaiyun.com/qq_34162500/article/details/80954252
1.ffmpeg 编译
./configure --prefix=/usr/local/ --enable-shared --disable-everything --enable-encoder=libopenh264 --enable-gpl --enable-pthreads --disable-asm --disable-hwaccels --disable-protocols--enable-libopenh264 --disable-programs --enable-muxer=h264 --enable-protocol=file
最开始的时候--disable-everything去除所有编解码库,因为个人使用的是libopenh264编码库,所以需要通过--enable-encoder=libopenh264 来使能。
--enable-pthreads这个必须使能,不使能虽然编译也能通过,但是在链接库的时候会报错/home/file/ffmpeg/libavformat/allformats.c:396: undefined reference to `pthread_once'。
--enable-muxer=h264不使能这个运行时会提示找不到合适的输出格式,Unable to find a suitable output format for '123.h264'。
因为我是保存在文件里,所以需要使能这个--enable-protocol=file。不然在调用avio_open2和av_write_frame会有问题。
make -j 4
make install