ubuntu18.04 compile ffmpeg which the problem record reprint

Because the project needs to be done live broadcast services, it is necessary to build a simple live server itself. Up to now use, and simple basically ffserver, but only official website ffmpeg compiled ffplay, ffmpeg, ffprobe can be used. ffserver have to compile it yourself. Because they used the win10 system, so naturally we have to install from a virtual machine, install Ubuntu, download compile ffmpeg. Here is the short answer toss introduce the experience of the day:

1. Virtual Machine, casual search online, I installed the vmware14.0 version here, online everywhere Key, self-break.

2.Ubuntu Quguan website to download 18.04, although it may be less stable new, but the new stuff is bound more feature-full, the old version of the bug at least have repaired.

3. Download the compiled ffmpeg, a reference to a series of online tutorials, real use the following steps, refer to the official build instructions

1. Installation depends
the sudo APT-GET Update
the sudo APT-GET -Y autoconf automake the install Build-Essential for libfreetype6 libass-dev-dev-dev libsdl1.2 libtheora-dev-dev libtool libva libvorbis, libvdpau-dev-dev-dev libxcb- libxcb1 shm0-dev libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev
under mkdir ~ / ffmpeg_sources // root directory create the folder

2. Compilation & Installation

Yasm
sudo apt-get install yasm

libx264
sudo apt-get install libx264-dev

libx265
sudo apt-get install cmake mercurial
cd ~/ffmpeg_sources
hg clone https://bitbucket.org/multicoreware/x265
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
make install
make distclean

libfdk-aac
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
make install
make distclean

libmp3lame
sudo apt-get install libmp3lame-dev

libopus
sudo apt-get install libopus-dev

libvpx
cd ~/ffmpeg_sources
wget http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.5.0.tar.bz2
tar xjvf libvpx-1.5.0.tar.bz2
cd libvpx-1.5.0
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests
PATH="$HOME/bin:$PATH" make
make install
make clean

avdevice
sudo apt-get install libavdevice-dev

ffmpeg

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"
./configure --prefix=”$HOME/ffmpeg_build” --pkg-config-flags="--static"  --extra-cflags="-I$HOME/ffmpeg_build/include"  --extra-ldflags="-L$HOME/ffmpeg_build/lib"  --bindir="$HOME/bin"  --enable-gpl  --enable-libass  --enable-libfdk-aac  --enable-libfreetype  --enable-libmp3lame  --enable-libopus  --enable-libtheora  --enable-libvorbis  --enable-libvpx  --enable-libx264  --enable-libx265  --enable-nonfreePATH="$HOME/bin:$PATH" makemake installmake distcleanhash -r

Ffmpeg compiled here on the end of the installation, in / bin under the directory compiled ffmpeg ~

Usage
Both methods use ffmpeg

Enter ~ / bin folder, and then call the binary file: cd ~ / bin && ./ffmpeg -i ~ / input.mp4 ~ / videos / output.mkv
use an absolute path: / home / yourusername / bin / ffmpeg -i .. /input.mp4 ../videos/output.mkv
If you want to ffmpeg can direct calls everywhere, you need to log off and log in.
Or performing source ~ / .profile

Documentation
If you want to see a document with a man ffmpeg command, execute the following command

echo "MANPATH_MAP $HOME/bin $HOME/ffmpeg_build/share/man" >> ~/.manpath

Log off and then log in to.

更新FFmpeg
rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffplay,ffserver,vsyasm,x264,x265,yasm,ytasm}

And then start from scratch again

During encountered two problems:

Question 1: config when using x265 thread in question

Libs.private modify properties ffmpeg_build / lib / pkgconfig / x265.pc, increasing -lpthread

Question 2: Compile vpx, always being given, final link failed: Nonrepresentable section on output

Without a good result, I hope there is a solution to teach about

Question 3: I hope that will be kept in the dark about the great God ffmpeg edit records compiled detailed reasons for the failure of files in what path has not been found, so vpx problems encountered by the compiler will not get rid of.
----------------
Disclaimer: This article is CSDN blogger "yingmuliuchuan 'original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement. .
Original link: https: //blog.csdn.net/yingmuliuchuan/article/details/81606178

 

 

Fdk-aac can not find or can not find x265 appear in the configure process, the solution is:

For example the installation path X265 / opt / x265, this path following a path associated pkgconfig / opt / x265 / lib / pkgconfig

Then export PKG_CONFIG_PATH = $ PKG_CONFIG_PATH: / opt / x265 / lib / pkgconfig can be resolved

 

#!/bin/sh
./configure --prefix=/opt/ffmpeg --pkg-config-flags="--static" --extra-cflags="-I/opt/libvpx/include -I/opt/x265/include -I/opt/fdk-aac/include" --extra-ldflags="-L/opt/libvpx/lib -L/opt/x265/lib -L/opt/fdk-aac/lib" --bindir="/opt/x265/bin:/opt/fdk-aac/bin:/opt/libvpx/bin" --enable-gpl --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --disable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-network --enable-protocol=tcp --enable-demuxer=rtsp --pkg-config="pkg-config --static"

Guess you like

Origin www.cnblogs.com/eastgeneral/p/11484883.html