Skip to content

Commit

Permalink
Support subtitles and drawtext filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Nov 20, 2023
1 parent 66febde commit bec1682
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 8 deletions.
16 changes: 15 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
.idea
ffmpeg-5.0.2
libass-0.17.1
libass-0.17.1
fribidi-1.0.13
freetype-2.13.2
harfbuzz-8.3.0
expat-2.5.0
fontconfig-2.14.2
libpng-1.6.40
*.ttf
*.srt
*.txt
ffmpeg-5.0.2
ffmpeg-5.0.2-libass
ffmpeg-5.0.2-nolibass
.DS_Store
source.flv
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ RUN echo "BUILDPLATFORM: $BUILDPLATFORM, TARGETPLATFORM: $TARGETPLATFORM, TARGET

WORKDIR /tmp/srs

# See https://fonts.google.com/noto/specimen/Noto+Sans+TC
ADD NotoSansTC-Regular.tar.bz2 /usr/local/share/fonts/
# See https://fonts.google.com/specimen/Roboto
ADD Roboto-Regular.tar.bz2 /usr/local/share/fonts/

# Copy all FFmpeg versions and cmake and other tools in /usr/local.
COPY --from=build /usr/local /usr/local
COPY --from=build /usr/local/bin/ffmpeg4 /usr/local/bin/ffprobe4 /usr/local/bin/
Expand Down
30 changes: 28 additions & 2 deletions Dockerfile.base3
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN apt-get update && \
apt-get install -y aptitude gcc g++ make patch unzip python \
autoconf automake libtool pkg-config zlib1g-dev \
liblzma-dev libzip-dev libbz2-dev tcl \
libfreetype6-dev libfribidi-dev libharfbuzz-dev libfontconfig1-dev
gperf python3

# Libs path for app which depends on ssl, such as libsrt.
ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/ssl/lib/pkgconfig
Expand Down Expand Up @@ -64,7 +64,33 @@ RUN if [[ $TARGETPLATFORM != 'linux/arm/v7' ]]; then \
cmake -DENABLE_SHARED=OFF ../../source && make -j${JOBS} && make install; \
fi

# Cost: x.s
# Cost: xs
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

# Cost: xs
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

# Cost: xs
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

# Cost: xs
# 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

# Cost: xs
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

# Cost: xs
# 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

# 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
4 changes: 2 additions & 2 deletions Dockerfile.base50
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y aptitude gcc g++ make patch unzip python \
autoconf automake libtool pkg-config zlib1g-dev \
liblzma-dev libzip-dev libbz2-dev tcl \
libfreetype6-dev libfribidi-dev libharfbuzz-dev libfontconfig1-dev
liblzma-dev libzip-dev libbz2-dev tcl

# Libs path for app which depends on ssl, such as libsrt.
ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/ssl/lib/pkgconfig
Expand Down Expand Up @@ -51,6 +50,7 @@ RUN FFOPTIONS=""; if [[ $TARGETPLATFORM != 'linux/arm/v7' ]]; then \
--enable-libx264 --enable-libmp3lame --enable-libfdk-aac \
--enable-libxml2 --enable-demuxer=dash \
--enable-openssl --enable-protocol=tls --enable-protocol=rtmps \
--enable-filter=drawtext --enable-libfreetype --enable-libfontconfig \
--enable-libass \
--enable-libsrt ${FFOPTIONS} && \
make -j${JOBS} && make install && echo "FFmpeg5 build and install successfully"
Expand Down
8 changes: 5 additions & 3 deletions Dockerfile.base51
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ARG JOBS=2
RUN echo "BUILDPLATFORM: $BUILDPLATFORM, TARGETPLATFORM: $TARGETPLATFORM, JOBS: $JOBS"

# https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image
ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# Update the mirror from aliyun, @see https://segmentfault.com/a/1190000022619136
#ADD sources.list /etc/apt/sources.list
Expand All @@ -24,11 +24,11 @@ RUN apt-get update && \
liblzma-dev libzip-dev libbz2-dev tcl

# Libs path for app which depends on ssl, such as libsrt.
ENV PKG_CONFIG_PATH $PKG_CONFIG_PATH:/usr/local/ssl/lib/pkgconfig
ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/ssl/lib/pkgconfig

# Libs path for FFmpeg(depends on serval libs), or it fail with:
# ERROR: speex not found using pkg-config
ENV PKG_CONFIG_PATH $PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig
ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig

# To use if in RUN, see https://github.com/moby/moby/issues/7281#issuecomment-389440503
# Note that only exists issue like "/bin/sh: 1: [[: not found" for Ubuntu20, no such problem in CentOS7.
Expand All @@ -52,6 +52,8 @@ RUN FFOPTIONS=""; if [[ $TARGETPLATFORM != 'linux/arm/v7' ]]; then \
--enable-libx264 --enable-libmp3lame --enable-libfdk-aac \
--enable-libxml2 --enable-demuxer=dash \
--enable-openssl --enable-protocol=tls --enable-protocol=rtmps \
--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"
# We copy FFmpeg5 without HEVC over RTMP as target, to make the next step easy to use.
Expand Down
Binary file added NotoSansTC-Regular.tar.bz2
Binary file not shown.
Binary file added Roboto-Regular.tar.bz2
Binary file not shown.
Binary file added expat-2.5.0.tar.bz2
Binary file not shown.
Binary file added fontconfig-2.14.2.tar.bz2
Binary file not shown.
Binary file added freetype-2.13.2.tar.gz
Binary file not shown.
Binary file added fribidi-1.0.13.tar.bz2
Binary file not shown.
Binary file added harfbuzz-8.3.0.tar.bz2
Binary file not shown.
Binary file added libpng-1.6.40.tar.gz
Binary file not shown.

0 comments on commit bec1682

Please sign in to comment.