当前位置: 首页 > news >正文

ffmpeg环境

最近想跟中下 ffmpeg 相关的开发, 使用 docker 环境进行编译, 参考项目在 github 上。
对Dockfile做过一些调整后, 成功到ffmpeg编译步骤,但是ffmpeg 的编译命令中 --enable-libvorbis 和 --extra-libs=-static 两个选项有冲突,具体不清楚, 报 libm.so 库中 没有符号的错误

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libvorbis.a(sharedbook.o): in function `_float32_pack':
(.text+0xd6): undefined reference to `__log_finite'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libvorbis.a(sharedbook.o): in function `_book_maptype1_quantvals':
(.text+0x444): undefined reference to `__pow_finite'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libvorbis.a(psy.o): in function `setup_tone_curves':
(.text+0x11e2): undefined reference to `__log_finite'

查看编译的日志 ffbuild/config.log 发现的问题, 我这里 关掉了 -static 的选项, 编译通过

测试程序:

// vorib_test.c
#include <vorbis/codec.h>
#include <stdint.h>
long check_vorbis_info_init(void) { return (long) vorbis_info_init; }
int main(void) { int ret = 0;ret |= ((intptr_t)check_vorbis_info_init) & 0xFFFF;
return ret; }
// gcc -D_ISOC11_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC --static -I/root/ffmpeg_build/include -std=c17 -fomit-frame-pointer -fPIC -pthread -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/opus -c vorib_test.c -o voribtest.o
// gcc voribtest.o -o voribtest -lvorbis -logg -lpthread -lm # -static

编译通过的Dockfile:

FROM harbor.hocker.com:19443/library/ubuntu:20.04# Container for compiling ffmpeg and copying ffmpeg, ffprobe, and ffserver to the host operating system.
# If the host OS is not linux, another container could instead use the binary.# Example build
# docker build -t ffmpeg-compiler .# Example run
# docker run --rm -it -v $(pwd):/host ffmpeg-compiler bash -c "cp /root/bin/ffmpeg /root/bin/ffprobe /root/bin/ffserver /host && chown $(id -u):$(id -g) /host/ffmpeg && chown $(id -u):$(id -g) /host/ffprobe && chown $(id -u):$(id -g) /host/ffserver"MAINTAINER srwarehamENV TZ=Asia/Shanghai # 安装 tzdata 包 运行配置脚本以设置时区
RUN sed -i s:/archive.ubuntu.com:/mirrors.tuna.tsinghua.edu.cn/ubuntu:g /etc/apt/sources.list \
&& apt-get update && apt-get install -y tzdata \
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone# Get the dependencies
RUN set -x \
&& apt-get update \
&& apt-get -y install wget git curl autoconf automake build-essential libass-dev libfreetype6-dev \libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev nasm\
&& mkdir ~/ffmpeg_sources \
&& apt-get -y install yasm \
&& cd ~/ffmpeg_sources \
&& wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz \
&& tar xzvf yasm-1.3.0.tar.gz \
&& cd yasm-1.3.0 \
&& ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" \
&& make -j$(cat /proc/cpuinfo | grep processor | wc -l) \
&& make install \
&& make distclean \
&& apt-get -y install libx264-dev \
&& apt-get -y install cmake mercurial \
&& echo COMPLETED PART 1RUN set -x \
&& cd ~/ffmpeg_sources \
&& hg --version \
&& git clone https://github.com/videolan/x265.git \
&& cd ~/ffmpeg_sources/x265/build/linux \
&& PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source \
&& make -j$(cat /proc/cpuinfo | grep processor | wc -l) \
&& make install \
&& make clean \
&& cd ~/ffmpeg_sources \
&& wget -O fdk-aac.tar.gz https://github.com/mstorsjo/fdk-aac/tarball/master \
&& tar xzvf fdk-aac.tar.gz \
&& cd mstorsjo-fdk-aac* \
&& autoreconf -fiv \
&& ./configure --prefix="$HOME/ffmpeg_build" --disable-shared \
&& make -j$(cat /proc/cpuinfo | grep processor | wc -l) \
&& make install \
&& make distclean \
&& echo COMPLETED PART 2RUN set -x \
&& echo install libmp3lame \
&& apt-get -y install libmp3lame-dev \
&& apt-get -y install libopus-dev \
&& cd ~/ffmpeg_sources \
&& wget https://github.com/webmproject/libvpx/archive/v1.8.2.tar.gz \
&& tar xzvf v1.8.2.tar.gz \
&& cd libvpx-1.8.2 \
&& PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests \
&& PATH="$HOME/bin:$PATH" make -j$(cat /proc/cpuinfo | grep processor | wc -l) \
&& make install \
&& make clean# install ffmpeg
RUN cd ~/ffmpeg_sources \
&& wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 \
&& tar xjvf ffmpeg-snapshot.tar.bz2 \
&& cd ffmpeg \
&& PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig:$PKG_CONFIG_PATH" ./configure \--prefix="$HOME/ffmpeg_build" \--pkg-config-flags="--static" \--extra-libs=-static \--extra-cflags=--static \--extra-cflags="-I$HOME/ffmpeg_build/include" \--extra-ldflags="-L$HOME/ffmpeg_build/lib" \--extra-libs="-lpthread -lm" \--bindir="$HOME/bin" \--enable-gpl \--enable-libfdk-aac \--enable-libfreetype \--enable-libmp3lame \--enable-libopus \--enable-libtheora \--enable-libvorbis \--enable-libvpx \--enable-libx264 \--enable-libx265 \--enable-nonfree \
&& PATH="$HOME/bin:$PATH" make -j$(cat /proc/cpuinfo | grep processor | wc -l) \
&& make install \
&& make distclean \
&& hash -r

更新后的项目上传到 gitee 上。


http://www.mrgr.cn/news/57092.html

相关文章:

  • 提高爬虫性能的 5 个关键技巧:从并发到异步执行
  • 视频云存储/音视频流媒体视频平台EasyCVR视频汇聚平台在欧拉系统中启动失败是什么原因?
  • 初识Vue
  • rockscache源码分析:如何解决缓存db的最终一致性
  • JavaWeb合集07-MyBatis
  • three.js 使用geojson ,实现中国地图区域,边缘流动效果
  • 拍摄照片(鸿蒙系统01)
  • D46【python 接口自动化学习】- python基础之类
  • stl(1)pair
  • JVM、字节码文件介绍
  • 四、多线程带来的的⻛险-线程安全
  • webpack4 - 动态导入文件 dynamic-import 报错的解决方法
  • 安装Python及pip使用方法详解
  • 重生之“我打数据结构,真的假的?”--1.单链表(无习题)
  • React写关键字高亮的三个方案
  • 第二期:第15节,beep 大海
  • latex表格单独编译成pdf表格
  • 华为配置 之 划分VLAN
  • 哪些WordPress的AI插件,更适合收集整理地球前100大行业的信息和关键词?谢谢。0.1
  • SAP B1 缺少税务科目 - 报错 debug
  • 秃姐学AI系列之:FCN + 代码实现
  • java和嵌入式现在哪个好?
  • js 防抖函数避免重复点击提交
  • 全域商户抽佣系统:智能分账新时代
  • 读hunter_bipedal_control-main
  • 力扣209-长度最小的子数组-滑动窗口思想