安装ffmpeg

macOS

1
2
3
brew install srt

brew upgrade srt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Possible conflicting files are:
/usr/local/bin/srt-ffplay
/usr/local/bin/srt-file-transmit
/usr/local/bin/srt-live-transmit
/usr/local/bin/srt-tunnel
/usr/local/lib/libsrt.1.3.3.dylib
/usr/local/lib/libsrt.1.dylib -> /usr/local/lib/libsrt.1.3.3.dylib
/usr/local/lib/libsrt.a
/usr/local/lib/libsrt.dylib -> /usr/local/lib/libsrt.1.dylib
/usr/local/lib/pkgconfig/haisrt.pc
/usr/local/lib/pkgconfig/srt.pc
==> Summary
🍺 /usr/local/Cellar/srt/1.3.3: 20 files, 2.8MB
Removing: /usr/local/Cellar/srt/1.3.2... (21 files, 2.7MB)

brew install srt

mac 报错

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
➜  ffmpeg PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" \
./configure \
--prefix=/usr/local \
--enable-gpl \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libsrt \
--enable-libtheora \
--enable-libopus \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-libxvid \
--enable-nonfree \
--samples=fate-suite \
--pkg-config-flags="--static"
ERROR: srt >= 1.3.0 not found using pkg-config

If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
1
2
3
4
5
6
7
8
9
require_pkg_config libsrt srt >= 1.3.0 srt/srt.h srt_socket
check_pkg_config libsrt srt >= 1.3.0 srt/srt.h srt_socket
test_pkg_config libsrt srt >= 1.3.0 srt/srt.h srt_socket
pkg-config --exists --print-errors srt >= 1.3.0
Package openssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `openssl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'openssl', required by 'srt', not found
ERROR: srt >= 1.3.0 not found using pkg-config

ERROR: srt >= 1.3.0 not found using pkg-config

PKG_CONFIG_PATH=”/usr/local/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig” \
./configure \
–prefix=/usr/local \
–enable-gpl \
–enable-libaom \
–enable-libass \
–enable-libfdk-aac \
–enable-libfreetype \
–enable-libmp3lame \
–enable-libsrt \
–enable-libtheora \
–enable-libopus \
–enable-libvorbis \
–enable-libvpx \
–enable-libx264 \
–enable-libx265 \
–enable-libxvid \
–enable-nonfree \
–samples=fate-suite \
–pkg-config-flags=”–static”

yes

PKG_CONFIG_PATH=”/usr/local/Cellar/srt/1.3.3/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig” \
./configure \
–prefix=/usr/local \
–enable-gpl \
–enable-libaom \
–enable-libass \
–enable-libfdk-aac \
–enable-libfreetype \
–enable-libmp3lame \
–enable-libsrt \
–enable-libtheora \
–enable-libopus \
–enable-libvorbis \
–enable-libvpx \
–enable-libx264 \
–enable-libx265 \
–enable-libxvid \
–enable-nonfree \
–samples=fate-suite \
–pkg-config-flags=”–static”

yes

PKG_CONFIG_PATH=”$HOME/ffmpeg_build/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig” \
./configure \
–prefix=/usr/local \
–enable-gpl \
–enable-libaom \
–enable-libass \
–enable-libfdk-aac \
–enable-libfreetype \
–enable-libmp3lame \
–enable-libsrt \
–enable-libtheora \
–enable-libopus \
–enable-libvorbis \
–enable-libvpx \
–enable-libx264 \
–enable-libx265 \
–enable-libxvid \
–enable-nonfree \
–samples=fate-suite \
–pkg-config-flags=”–static”

mac

https://trac.ffmpeg.org/wiki/CompilationGuide/macOS

mkdir ~/ffmpeg_sources ~/ffmpeg_build
cd ~/ffmpeg_sources

1
2
3
4
5
6
7
8
9
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
git checkout -b n4.2 n4.2
rm -rf .git .gitignore .gitattributes
cd ../
git clone https://github.com/Haivision/srt.git
cd srt/
git checkout -b v1.3.3 v1.3.3
rm -rf .git

PKG_CONFIG_PATH=”$HOME/ffmpeg_build/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig” \
./configure \
–prefix=/usr/local \
–enable-gpl \
–enable-libaom \
–enable-libass \
–enable-libfdk-aac \
–enable-libfreetype \
–enable-libmp3lame \
–enable-libsrt \
–enable-libtheora \
–enable-libopus \
–enable-libvorbis \
–enable-libvpx \
–enable-libx264 \
–enable-libx265 \
–enable-libxvid \
–enable-nonfree \
–samples=fate-suite \
–pkg-config-flags=”–static”
make

./configure \
–prefix=/usr/local \
–enable-gpl \
–enable-libass \
–enable-libfdk-aac \
–enable-libfreetype \
–enable-libmp3lame \
–enable-libsrt \
–enable-libtheora \
–enable-libopus \
–enable-libvorbis \
–enable-libvpx \
–enable-libx264 \
–enable-libx265 \
–enable-libxvid \
–enable-nonfree \
–samples=fate-suite \
–pkg-config-flags=”–static”

ubuntu

apt-get install tclsh pkg-config cmake libssl-dev build-essential
apt-get update -qq
apt-get install -y \
autoconf automake build-essential \
cmake git \
libass-dev \
libfreetype6-dev libmp3lame-dev \
libsdl2-dev libtheora-dev libxvidcore-dev \
libtool libva-dev libvdpau-dev \
libvorbis-dev libxcb1-dev libxcb-shm0-dev \
libxcb-xfixes0-dev pkg-config texinfo wget zlib1g-dev \
libvpx-dev libfdk-aac-dev libopus-dev libx265-dev x265 libaom-dev

1
ffmpeg: error while loading shared libraries: libsrt.so.1: cannot open shared object file: No such file or directory
1
2
## 解决方法
ldconfig

##
./configure \
–prefix=”$HOME/ffmpeg_build” \
–pkg-config-flags=”–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-libaom –enable-libass –enable-libfdk-aac \
–enable-libfreetype –enable-libmp3lame –enable-libsrt –enable-libtheora –enable-libopus \
–enable-libvorbis –enable-libvpx \
–enable-libx264 –enable-libx265 –enable-nonfree

easy

./configure \
–enable-gpl \
–enable-libsrt \
–enable-libx264 \
–enable-libx265 \
–pkg-config-flags=”–static”

install srt

export PKG_CONFIG_PATH=”$HOME/ffmpeg_build/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig”

###
cd ~/ffmpeg_sources
git clone –depth 1 https://github.com/Haivision/srt.git
mkdir srt/build
cd srt/build
cmake -DCMAKE_INSTALL_PREFIX=”$HOME/ffmpeg_build” -DENABLE_C_DEPS=ON -DENABLE_SHARED=OFF -DENABLE_STATIC=ON ..
make
make install

ubuntu

echo $PKG_CONFIG_PATH
export PKG_CONFIG_PATH=”/usr/local/lib/pkgconfig/“