FFmpeg Compilation Guide

举报
小花猫 发表于 2019/12/26 18:41:56 2019/12/26
【摘要】 FFmpeg Compilation GuideSource code download address: https://github.com/FFmpeg/FFmpeg/releasesI. Installing and Configuring FFmpeg on the Atlas 300 (Model 3000 or 3010) Development Host1. Compile ...

FFmpeg Compilation Guide

Source code download address: https://github.com/FFmpeg/FFmpeg/releases

I. Installing and Configuring FFmpeg on the Atlas 300 (Model 3000 or 3010) Development Host

1. Compile FFmpeg

1) Before compilation, download the FFmpeg source code (FFmpeg 4.1 or later versions are recommended) from the system.

2) Save the downloaded source code to the Linux host where the program is to be run, and decompress the source code:

tar xvf FFmpeg-n4.1.3.tar.gz

3)Go to the FFmpeg-n4.1.3 directory and run the configure command:

                       ./configure --enable-shared prefix="<where you place>" --disable-swresample

                       Note: <where you place> indicates the FFmpeg installation path. For example, if the installation path is

                       /usr/local/ffmpeg,  run  the following command:

                       ./configure --enable-shared --prefix="/usr/local/ffmpeg" --disable-swresample

4)  Run the make command for compilation.

5)  Run the sudo make install command to install FFmpeg.

6)   If the message fail is not displayed, FFmpeg is successfully installed.

2. Configure the FFmpeg environment variable:

    export FFMPEG_PATH=<where you place>

 

II. Installing and Configuring FFmpeg on the Atlas 500 (Model 3010) Development Host

1.       Prepare the cross compilation environment

1)  Prepare an x86 64-bit server to decompress the Atlas500_package.zip package for multiple times, and obtain the Euler_compile_env_cross folder. Euler_compile_env_cross is a cross compilation tool on the x86 64-bit server to compile programs on the Atlas 500.

2)  Modify the /etc/profile file, set the environment variable, and add them to the end of the file.

export PATH=$PATH:<where you place>/Euler_compile_env_cross/arm/cross_compile/install/bin

3)  Settings take effect.

source /etc/profile

4)  Check the version of the cross compilation tool aarch64-linux-gnu-g++ to verify whether the settings take effect.

aarch64-linux-gnu-g++ -v

2. Compile FFmpeg

1)  Before compilation, download and install the FFmpeg source code (FFmpeg 4.1 or later versions are recommended) to the x86 64-bit server.

2)  Save the downloaded source code to the Linux host where the program is to be run, and decompress the source code:

tar xvf FFmpeg-n4.1.3.tar.gz

3)   Go to the FFmpeg-n4.1.3 directory and run the configure command:

   ./configure \

    --prefix=<where you place> \

    --target-os=linux \

    --arch=aarch64 \

    --enable-cross-compile \

    --cross-prefix=<your aarch64-linux-gnu path>/aarch64-linux-gnu- \

    --enable-shared \

    --disable-doc

Note: <where you place> indicates the FFmpeg installation path (applicable to the following), such as /opt/aarch64/ffmpeg.

<your aarch64-linux-gnu path> indicates the location of the aarch64-linux-gnu on the x86 64-bit server, such as   /home/Atlas500_DDK/toolchains/aarch64-linux-gcc6.3/bin.

 

If you want to connect to the x264 library, cross-compile x264 (see the appendix for procedures) and add the following content when configuring the file:

  --enable-libx264 --extra-cflags=-I<your x264 install path>/include --extra-ldflags=-L<your x264 install path>/lib --
  enable-gpl

  <your x264 install path> indicates the x264 installation path.

 

4)  Run the make command for compilation.

5)  Run the sudo make install command to install FFmpeg.

6)  If the message fail is not displayed, FFmpeg is successfully installed.

 

3. Configure the FFmpeg environment variable:

    export FFMPEG_PATH=<where you place>

 

III. Installing and Configuring FFmpeg on the Atlas 200 SoC Development Host

1. Prepare the cross compilation environment

1) Prepare an x86 64-bit server and install the cross compilation tool aarch64-linux-gnu on it. If the Atlas 200 DK application development environment has been deployed, you can skip this step.

2) Run the sudo apt-get install gcc-5-aarch64-linux-gnu command to install the cross compilation tool aarch64-linux-gnu. The aarch64-linux-gnu 5.4 is required.

3) Check the version of the cross compilation tool aarch64-linux-gnu-g++ to verify whether the settings take effect:

aarch64-linux-gnu-g++ -v

2. Compile FFmpeg

1) Before compilation, download and install the FFmpeg source code (FFmpeg 4.1 or later versions are recommended) to the x86 64-bit server.

2) Save the downloaded source code to the Linux host where the program is to be run, and decompress the source code:

tar zxvf FFmpeg-n4.1.3.tar.gz

3) Go to the FFmpeg-n4.1.3 directory and run the configure command:

./configure \

--prefix=<where you place> \

--target-os=linux \

--arch=aarch64 \

--enable-cross-compile \

--cross-prefix=<your aarch64-linux-gnu path>/aarch64-linux-gnu- \

--enable-shared \

--disable-doc

Note: <where you place> indicates the FFmpeg installation path, such as /opt/aarch64/ffmpeg. <your aarch64-linux-gnu path> indicates the location of the aarch64-linux-gnu on the x86 64-bit server, such as /usr/bin/.

 

If you want to connect to the x264 library, cross-compile x264 (see the appendix for procedures) and add the following content when configuring the file:

--enable-libx264 --extra-cflags=-I<your x264 install path>/include

--extra-ldflags=-L<your x264 install path>/lib --enable-gpl

<your x264 install path> indicates the x264 installation path.

 

4) Run the make command.

5) Run the sudo make install command to install FFmpeg.

6) If the message fail is not displayed, FFmpeg is successfully installed.

 

3. Configure the FFmpeg environment variable:

export FFMPEG_PATH=<where you place>

4. Note: When you run programs on the Atlas 200 SoC, you need to place the cross-compiled FFmpeg library on the Atlas 200 SoC and set the dynamic library loading path with the export LD_LIBRARY_PATH=/where/your/ffmpeg/lib:$LD_LIBRARY_PATH command.

/where/your/ffmpeg/lib is the path of the cross-compiled FFmpeg dynamic link library, such as ~/ffmpeg/lib.

 

Appendix:

Installing and Configuring x264 on the Atlas 500 (Model 3010) Development Host

Download source code at git clone: https://code.videolan.org/videolan/x264.

 

 

x264 and FFmpeg share the steps for preparing the cross compilation environment.

Compile FFmpeg by running the following commands:

./configure \

--prefix=<your x264 install path>\

--host=aarch64-linux \

--cross-prefix=aarch64-linux-gnu- \

--enable-shared \

--enable-static

make

make install


【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。