Skip to content

Commit

Permalink
Refine code.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Jun 19, 2024
1 parent 0e1a230 commit ce74da5
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 18 deletions.
17 changes: 11 additions & 6 deletions Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ SHELL ["/bin/bash", "-c"]
# Openssl 1.1.* for SRS.
ADD openssl-1.1.1j.tar.bz2 /tmp
RUN cd /tmp/openssl-1.1.1j && \
./config -no-shared -no-threads --prefix=/usr/local/ssl && make -j${JOBS} && make install_sw
./config -no-shared -no-threads --prefix=/usr/local/ssl && make -j${JOBS} && make install_sw && \
rm -rf /tmp/openssl-1.1.1j

# Openssl 1.0.* for SRS.
#ADD openssl-OpenSSL_1_0_2u.tar.gz /tmp
Expand All @@ -48,18 +49,22 @@ RUN cd /tmp/openssl-1.1.1j && \
# Cost: 698.9s
# For FFMPEG
ADD nasm-2.14.tar.bz2 /tmp
RUN cd /tmp/nasm-2.14 && ./configure && make -j${JOBS} && make install
RUN cd /tmp/nasm-2.14 && ./configure && make -j${JOBS} && make install && \
rm -rf /tmp/nasm-2.14

# Cost: 1293.6s
# For aac
ADD fdk-aac-2.0.2.tar.gz /tmp
RUN cd /tmp/fdk-aac-2.0.2 && bash autogen.sh && CXXFLAGS=-Wno-narrowing ./configure --disable-shared && make -j${JOBS} && make install
RUN cd /tmp/fdk-aac-2.0.2 && bash autogen.sh && CXXFLAGS=-Wno-narrowing ./configure --disable-shared && make -j${JOBS} && make install && \
rm -rf /tmp/fdk-aac-2.0.2
# Cost: 226.4s
# For mp3, see https://sourceforge.net/projects/lame/
ADD lame-3.100.tar.gz /tmp
RUN cd /tmp/lame-3.100 && ./configure --disable-shared && make -j${JOBS} && make install
ADD lame-3.100.tar.gz /tmp
RUN cd /tmp/lame-3.100 && ./configure --disable-shared && make -j${JOBS} && make install && \
rm -rf /tmp/lame-3.100
# Cost: 620.7s
# For libx264
ADD x264-snapshot-20181116-2245.tar.bz2 /tmp
RUN cd /tmp/x264-snapshot-20181116-2245 && ./configure --disable-shared --disable-cli --enable-static --enable-pic && make -j${JOBS} && make install
RUN cd /tmp/x264-snapshot-20181116-2245 && ./configure --disable-shared --disable-cli --enable-static --enable-pic && make -j${JOBS} && make install && \
rm -rf /tmp/x264-snapshot-20181116-2245

3 changes: 2 additions & 1 deletion Dockerfile.base2
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ SHELL ["/bin/bash", "-c"]
# Cost: 15125.8s
# For cmake. Note that the PATH has /usr/local/bin by default in ubuntu:focal.
ADD CMake-3.22.5.tar.gz /tmp
RUN cd /tmp/CMake-3.22.5 && ./configure && make -j${JOBS} && make install
RUN cd /tmp/CMake-3.22.5 && ./configure && make -j${JOBS} && make install && \
rm -rf /tmp/CMake-3.22.5
#ENV PATH=$PATH:/usr/local/bin

# To limit each jobs in 6h, see https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#usage-limits
Expand Down
27 changes: 18 additions & 9 deletions Dockerfile.base3
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ RUN which cmake && cmake --version
ADD srt-1.5.3.tar.gz /tmp
RUN cd /tmp/srt-1.5.3 && \
./configure --enable-shared=0 --enable-static --disable-app --enable-c++11=0 && \
make -j${JOBS} && make install
make -j${JOBS} && make install && \
rm -rf /tmp/srt-1.5.3

# Cost: 904.1s
# For libxml2, depends on cmake.
Expand All @@ -63,37 +64,45 @@ ADD x265-3.5_RC2.tar.bz2 /tmp
RUN if [[ $TARGETPLATFORM != 'linux/arm/v7' ]]; then \
cd /tmp/x265-3.5_RC2/build/linux && \
sed -i 's/^if(X265_LATEST_TAG)/if(TRUE)/g' ../../source/CMakeLists.txt && \
cmake -DENABLE_SHARED=OFF ../../source && make -j${JOBS} && make install; \
cmake -DENABLE_SHARED=OFF ../../source && make -j${JOBS} && make install && \
rm -rf /tmp/x265-3.5_RC2; \
fi

# Cost: 204s
ADD libpng-1.6.40.tar.gz /tmp
RUN cd /tmp/libpng-1.6.40 && ./configure --disable-shared --enable-static && make -j${JOBS} && make install
RUN cd /tmp/libpng-1.6.40 && ./configure --disable-shared --enable-static && make -j${JOBS} && make install && \
rm -rf /tmp/libpng-1.6.40

# Cost: 128s
ADD fribidi-1.0.13.tar.bz2 /tmp
RUN cd /tmp/fribidi-1.0.13 && ./configure --disable-shared --enable-static && make -j${JOBS} && make install
RUN cd /tmp/fribidi-1.0.13 && ./configure --disable-shared --enable-static && make -j${JOBS} && make install && \
rm -rf /tmp/fribidi-1.0.13

# Cost: 2167s
ADD harfbuzz-8.3.0.tar.bz2 /tmp
RUN cd /tmp/harfbuzz-8.3.0 && ./configure --disable-shared --enable-static && make -j${JOBS} && make install
RUN cd /tmp/harfbuzz-8.3.0 && ./configure --disable-shared --enable-static && make -j${JOBS} && make install && \
rm -rf /tmp/harfbuzz-8.3.0

# Cost: 259s
# Depends on libpng.
ADD freetype-2.13.2.tar.gz /tmp
RUN cd /tmp/freetype-2.13.2 && ./configure --disable-shared --enable-static && make -j${JOBS} && make install
RUN cd /tmp/freetype-2.13.2 && ./configure --disable-shared --enable-static && make -j${JOBS} && make install && \
rm -rf /tmp/freetype-2.13.2

# Cost: 174s
ADD expat-2.5.0.tar.bz2 /tmp
RUN cd /tmp/expat-2.5.0 && ./configure --disable-shared --enable-static && make -j${JOBS} && make install
RUN cd /tmp/expat-2.5.0 && ./configure --disable-shared --enable-static && make -j${JOBS} && make install && \
rm -rf /tmp/expat-2.5.0

# Cost: 399s
# Depends on gperf, expat, freetype.
ADD fontconfig-2.14.2.tar.bz2 /tmp
RUN cd /tmp/fontconfig-2.14.2 && ./configure --disable-shared --enable-static && make -j${JOBS} && make install
RUN cd /tmp/fontconfig-2.14.2 && ./configure --disable-shared --enable-static && make -j${JOBS} && make install && \
rm -rf /tmp/fontconfig-2.14.2

# Cost: 130.9s
# For libass, which depends on libfreetype6-dev, libfribidi-dev, libharfbuzz-dev, libfontconfig1-dev.
ADD libass-0.17.1.tar.gz /tmp
RUN cd /tmp/libass-0.17.1 && ./configure --disable-shared --enable-static && make -j${JOBS} && make install
RUN cd /tmp/libass-0.17.1 && ./configure --disable-shared --enable-static && make -j${JOBS} && make install && \
rm -rf /tmp/libass-0.17.1

4 changes: 3 additions & 1 deletion Dockerfile.base50
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ RUN FFOPTIONS=""; if [[ $TARGETPLATFORM != 'linux/arm/v7' ]]; then \
--enable-filter=drawtext --enable-libfreetype --enable-libfontconfig \
--enable-libass \
--enable-libsrt ${FFOPTIONS} && \
make -j${JOBS} && make install && echo "FFmpeg5 build and install successfully"
make -j${JOBS} && make install && \
rm -rf /tmp/ffmpeg-5.0.2 && \
echo "FFmpeg5 build and install successfully"
RUN cp /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg5 && \
cp /usr/local/bin/ffprobe /usr/local/bin/ffprobe5
RUN ls -lh /usr/local/bin/*
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile.base51
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ RUN FFOPTIONS=""; if [[ $TARGETPLATFORM != 'linux/arm/v7' ]]; then \
--enable-filter=drawtext --enable-libfreetype --enable-libfontconfig \
--enable-libass \
--enable-libsrt ${FFOPTIONS} && \
make -j${JOBS} && make install && echo "FFmpeg5(HEVC over RTMP) build and install successfully"
make -j${JOBS} && make install && \
rm -rf /tmp/ffmpeg-5.0.2 && \
echo "FFmpeg5(HEVC over RTMP) build and install successfully"
# We copy FFmpeg5 without HEVC over RTMP as target, to make the next step easy to use.
RUN cp /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg5-hevc-over-rtmp && \
cp /usr/local/bin/ffprobe /usr/local/bin/ffprobe5-hevc-over-rtmp
Expand Down

0 comments on commit ce74da5

Please sign in to comment.