101 lines
3.4 KiB
Docker
101 lines
3.4 KiB
Docker
#
|
|
# Docker.solution based on the Intel-Media-SDK instructions available here:
|
|
#
|
|
# https://github.com/Intel-Media-SDK/MediaSDK/wiki/Build-and-use-ffmpeg-with-MediaSDK
|
|
#
|
|
# This should really be part of a multi-stage build so the final
|
|
# image isn't polluted with build artifacts
|
|
#
|
|
# NOTE: This image will only work with Ubuntu 19.04 (eoan) and newer
|
|
FROM xe-user-stage AS solution-build
|
|
|
|
USER root
|
|
|
|
# Install git and build tools, clone ffmpeg, and get ready to build it
|
|
RUN apt-get update \
|
|
&& DEBIAN_FRONTEND=noninteractive \
|
|
&& apt-get -q -y install \
|
|
git build-essential pkg-config
|
|
|
|
# Install all required Media common packages, broken out
|
|
# from the above command to highlight which packages are
|
|
# specific to media
|
|
RUN apt-get update \
|
|
&& DEBIAN_FRONTEND=noninteractive \
|
|
&& apt-get -q -y install \
|
|
libva-dev \
|
|
libmfx-dev \
|
|
libmfx1 \
|
|
vainfo
|
|
|
|
RUN sed -i -e 's,^# deb-src,deb-src,g' /etc/apt/sources.list
|
|
RUN apt-get update \
|
|
&& DEBIAN_FRONTEND=noninteractive \
|
|
&& apt-get build-dep -y \
|
|
ffmpeg
|
|
|
|
ENV LIBVA_DRIVER_NAME=iHD
|
|
|
|
USER user
|
|
|
|
# Clone ffmpeg
|
|
# NOTE: This explicitly clones the FFMPEG_TAG_VERSION (see SOLUTIONS)
|
|
RUN git clone --depth 1 --branch $FFMPEG_TAG_VERSION https://github.com/ffmpeg/ffmpeg /home/user/ffmpeg
|
|
|
|
# Build FFmpeg
|
|
WORKDIR /home/user/ffmpeg
|
|
|
|
RUN ./configure --arch=x86_64 \
|
|
--disable-x86asm --enable-vaapi --enable-libmfx --enable-nonfree \
|
|
--arch=amd64 --enable-gpl --disable-stripping --enable-swresample --disable-filter=resample --enable-gnutls \
|
|
--enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 \
|
|
--enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack \
|
|
--enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg \
|
|
--enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora \
|
|
--enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 \
|
|
--enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl \
|
|
--enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 \
|
|
&& make -j $(nproc --all) \
|
|
&& sudo make install
|
|
|
|
# --enable-shared \
|
|
|
|
FROM xe-user-stage
|
|
|
|
USER root
|
|
|
|
# Update and install the Mesa, OpenCL, and Media from repositories.intel.com
|
|
#
|
|
# NOTE: libva requires libpciaccess0, however it doesn't depend on it
|
|
# so explicitly install it.
|
|
#
|
|
# curl is used by assets/commands/test to obtain test content if it
|
|
# does not already exist
|
|
RUN apt-get -q update \
|
|
&& DEBIAN_FRONTEND=noninteractive \
|
|
&& apt-get --no-install-recommends -q -y install \
|
|
intel-media-va-driver-non-free \
|
|
libva2 \
|
|
libmfx1 \
|
|
vainfo \
|
|
libpciaccess0 \
|
|
pciutils \
|
|
curl \
|
|
ffmpeg
|
|
|
|
# Copy ffmpeg and ffprobe from build container
|
|
COPY --from=solution-build /usr/local/bin/ /usr/local/bin/
|
|
|
|
RUN apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV LIBVA_DRIVER_NAME=iHD
|
|
|
|
# In order for ffmpeg to access the video input, 'user' needs to have
|
|
# access to the hardware. Not sure how to do that across different
|
|
# OS releases, so setting user to 'root' for now.
|
|
USER root
|
|
|
|
WORKDIR /home/user
|
|
|