| 1 | # Minimal ffmpeg build with test process
|
|---|
| 2 | # In order To detect color space conversion optimization bug in libswscale on ppc64le arch
|
|---|
| 3 | # the Orignal docker file located in
|
|---|
| 4 | # https://raw.githubusercontent.com/seiko2plus/just4share/master/opencv/issue11034/Dockerfile
|
|---|
| 5 | # which has an extra build and test for opencv
|
|---|
| 6 |
|
|---|
| 7 | FROM debian:stretch
|
|---|
| 8 |
|
|---|
| 9 | RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
|---|
| 10 |
|
|---|
| 11 | RUN apt-get update \
|
|---|
| 12 | && apt-get install -y apt-utils build-essential cmake git pkg-config curl \
|
|---|
| 13 | && apt-get clean
|
|---|
| 14 |
|
|---|
| 15 | WORKDIR /usr/src
|
|---|
| 16 |
|
|---|
| 17 | RUN apt-get install -y libpng-dev libjpeg-dev libvpx-dev libx264-dev libx265-dev
|
|---|
| 18 |
|
|---|
| 19 | ARG FFMPEG_VER=3.4.2
|
|---|
| 20 | ARG FFMPEG_DEBUG_LEVEL=3
|
|---|
| 21 |
|
|---|
| 22 | RUN git clone -b n${FFMPEG_VER} --single-branch --depth 1 git://source.ffmpeg.org/ffmpeg.git
|
|---|
| 23 |
|
|---|
| 24 | RUN cd ffmpeg \
|
|---|
| 25 | && ./configure --prefix=/usr --extra-libs="-lpthread -lm" --enable-gpl \
|
|---|
| 26 | --enable-libvpx --enable-libx264 --enable-nonfree \
|
|---|
| 27 | --enable-shared --enable-avresample \
|
|---|
| 28 | --enable-debug=${FFMPEG_DEBUG_LEVEL} \
|
|---|
| 29 | --disable-doc --disable-static \
|
|---|
| 30 | && make -j$(nproc) install
|
|---|
| 31 |
|
|---|
| 32 | RUN mkdir -p /tests/before && cd ffmpeg \
|
|---|
| 33 | && make check > /tests/before/ffmpeg_check.log 2>&1; exit 0
|
|---|
| 34 |
|
|---|
| 35 | ENV THE_VIDEO=./Sintel.mp4
|
|---|
| 36 | ENV VIDEO_URL=http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/Sintel.mp4
|
|---|
| 37 |
|
|---|
| 38 | RUN curl -o $THE_VIDEO $VIDEO_URL
|
|---|
| 39 |
|
|---|
| 40 | RUN mkdir /tests/before/frames \
|
|---|
| 41 | && ffmpeg -i $THE_VIDEO -filter:v fps=fps=1/60 /tests/before/frames/%0d.png \
|
|---|
| 42 | && ffmpeg -i $THE_VIDEO -filter:v fps=fps=1/60 /tests/before/frames/%0d.jpg
|
|---|
| 43 |
|
|---|
| 44 | # Now it's the time to disable color space conversion optimization
|
|---|
| 45 |
|
|---|
| 46 | # patching libswscale instead of rebuild ffmpeg with disable altivec/vsx
|
|---|
| 47 | # to add more clarification and to save some energy
|
|---|
| 48 |
|
|---|
| 49 | # disable PPC/Altivec YUV-RGB color space conversion optimization
|
|---|
| 50 | ENV THE_PATCH=https://raw.githubusercontent.com/seiko2plus/just4share/master/opencv/issue11034/libswscale-disable-ppc-yuv2rgb.diff
|
|---|
| 51 |
|
|---|
| 52 | RUN cd ffmpeg \
|
|---|
| 53 | && curl $THE_PATCH | git apply -v --whitespace=fix --no-index --directory libswscale \
|
|---|
| 54 | && make -j$(nproc) install
|
|---|
| 55 |
|
|---|
| 56 | # run tests after patching libswscale
|
|---|
| 57 |
|
|---|
| 58 | RUN mkdir -p /tests/after && cd ffmpeg \
|
|---|
| 59 | && make check > /tests/after/ffmpeg_check.log 2>&1; exit 0
|
|---|
| 60 |
|
|---|
| 61 | RUN mkdir /tests/after/frames \
|
|---|
| 62 | && ffmpeg -i $THE_VIDEO -filter:v fps=fps=1/60 /tests/after/frames/%0d.png \
|
|---|
| 63 | && ffmpeg -i $THE_VIDEO -filter:v fps=fps=1/60 /tests/after/frames/%0d.jpg
|
|---|
| 64 |
|
|---|
| 65 | WORKDIR /tests
|
|---|