forked from Cle3000/FFmpegVideoComponent-for-JUCE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCompiling FFmpeg - Windows.txt
174 lines (140 loc) · 4.57 KB
/
Compiling FFmpeg - Windows.txt
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
****************************************
Compiling FFmpeg On Windows ************
****************************************
0. Helpfull Resources ******************
https://cygwin.com/install.html
https://superuser.com/questions/1425350/how-to-compile-the-best-version-of-ffmpeg-for-cygwin-windows
https://winlibs.com/
https://github.com/TechSmith/FFmpeg/tree/main/Windows
Since we want to build FFmpeg ourself to configure it to our liking, we need unix building tools like
gcc (compiler) and make. There is several ways to get these, i chose cygwin.
1. Cygwin
This worked well for me. See:
https://superuser.com/questions/1425350/how-to-compile-the-best-version-of-ffmpeg-for-cygwin-windows
1.1. Install cygwin and basic tools
Install https://cygwin.com/install.html
- option "download from internet"
- install to C:\cygwin64
- for All users
- use system proxy settings
- select mirror
Then install:
- from category "Net": wget
- from "Base": tar and gawk
- from "Devel": git
- from "Libs": libiconv
DON'T INSTALL EVERYTHING!
1.2. Install the apt-cyg package manager
mkdir -p /usr/local/src
cd /usr/local/src
git clone https://github.com/kou1okada/apt-cyg.git
ln -s "$(realpath apt-cyg/apt-cyg)" /usr/local/bin/
1.3. Install build tools
apt-cyg install autoconf
apt-cyg install automake
apt-cyg install binutils
apt-cyg install cmake
apt-cyg install doxygen
apt-cyg install git
apt-cyg install libtool
apt-cyg install make
optional: mercurial
apt-cyg install mingw64-x86_64-SDL2
apt-cyg install mingw64-x86_64-binutils
apt-cyg install mingw64-x86_64-gcc-core
apt-cyg install mingw64-x86_64-gcc-g++
apt-cyg install mingw64-x86_64-headers
apt-cyg install mingw64-x86_64-libvpx
apt-cyg install mingw64-x86_64-runtime
apt-cyg install mingw64-x86_64-win-iconv
apt-cyg install mingw64-x86_64-windows-default-manifest
apt-cyg install mingw64-x86_64-zlib
optional: apt-cyg install mingw64-x86_64-libtheora
optional: apt-cyg install mingw64-x86_64-fribidi
apt-cyg install nasm
apt-cyg install pkg-config
apt-cyg install subversion
apt-cyg install texinfo
apt-cyg install yasm
1.4. compile FFmpeg
Download source code of ffmpeg (bzip2), if not in this project (/ffmpeg/ffmpeg-5.1.2.tar.bz2).
FFmpeg-Version: 5.1.2 "Riemann"
http://ffmpeg.org/download.html#get-sources
Goto cygwin console, then:
# extract source code
tar jxvf ffmpeg-5.1.2.tar.bz2
# go to unpacked directory
cd ffmpeg-5.1.2
# reset everything, when ever you want to reset your configuration, run this
make clean
# link/compile in libraries
CFLAGS=-I/usr/x86_64-w64-mingw32/sys-root/mingw/include &&
LDFLAGS=-L/usr/x86_64-w64-mingw32/sys-root/mingw/lib &&
# pkg config
export PKG_CONFIG_PATH= &&
export PKG_CONFIG_LIBDIR=/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig
# configure, this is the most important part. FFmpeg should be configured
# with the following features:
# - output shared libraries
# - FFmpeg is LGPLv3 compliant
# - only file protocol
# - no programs, no documentation, no filters, no static builds
# - if possible don't use third libraries
#
# Run one of the following commands:
#
#### "normal" configuration: all decoders, all demuxers, all parsers ####
# prefix is where everything gets installed
make clean && \
./configure \
--prefix='../../win' \
--arch=x86_64 \
--target-os=mingw32 \
--cross-prefix=x86_64-w64-mingw32- \
--enable-cross-compile \
--pkg-config=pkg-config \
--pkg-config-flags=--static \
--extra-cflags=-static \
--extra-ldflags=-static \
--enable-shared \
--enable-static \
--enable-version3 \
--enable-avdevice \
--enable-avcodec \
--enable-avformat \
--enable-swresample \
--enable-swscale \
--enable-avfilter \
--disable-filters \
--disable-programs \
--disable-doc \
--disable-htmlpages \
--disable-txtpages \
--disable-manpages \
--disable-podpages \
--disable-libjack \
--disable-libopencore-amrnb \
--disable-libxcb \
--disable-libxcb-shm \
--disable-libxcb-xfixes \
--disable-indevs \
--disable-indev=jack \
--disable-outdev=xv \
--disable-securetransport \
--disable-protocols \
--enable-protocol='file' \
discarded options:
--enable-w32threads \
--extra-ldflags='-L/usr/local/x86_64-w64-mingw32/lib' \
--pkg-config=pkg-config \
--pkg-config-flags=--static \
This can take a while! Don't abort, That's actually a good sign!
Look for this in configure's output: "License: LGPL version 3 or later"
This means we are save.
If you see "License: nonfree and unredistributable" or something else, reconfigure
Then:
make -j$(nproc) &&
make install
To check for dependencies in compiled dlls, try something like this in cygwin
ldd avcodec-59.dll
Apart from FFmpeg dlls there shouldn't be any other dependencies