Skip to content

Instantly share code, notes, and snippets.

@AkashiSN
Last active Apr 25, 2021
Embed
What would you like to do?
FFmpeg with Intel QSV (Intel Quick Sync Video) in Docker

Environment

Detail: https://trac.ffmpeg.org/wiki/Hardware/QuickSync

Build

$ docker build -t ffmpeg .

Run

Ref: https://nico-lab.net/installing_qsv_with_ffmpeg/

H.264 (Sandy Bridge ~)

QSV

$ docker run --rm -it --device=/dev/dri -v `pwd`:/workdir \
  ffmpeg -y \
    -init_hw_device qsv=qsv:hw -hwaccel qsv -filter_hw_device qsv -hwaccel_output_format qsv \
    -fflags +discardcorrupt \
    -analyzeduration 30M -probesize 100MB \
    -i AB1.m2ts \
    -vf hwupload=extra_hw_frames=64,vpp_qsv=deinterlace=2,vpp_qsv=w=1920:h=1080,fps=30000/1001 \
    -c:v h264_qsv \
    -q:v 20 \
    -c:a copy \
    -bsf:a aac_adtstoasc \
    AB1_h264_qsv.mp4

VAAPI

$ docker run --rm -it --device=/dev/dri -v `pwd`:/workdir \
  ffmpeg -y \
    -hwaccel vaapi -hwaccel_output_format vaapi \
    -fflags +discardcorrupt \
    -analyzeduration 30M -probesize 100MB \
    -i AB1.m2ts \
    -vf hwupload=extra_hw_frames=64,deinterlace_vaapi,scale_vaapi=1920:1080,sharpness_vaapi,fps=30000/1001 \
    -c:v h264_vaapi \
    -qp 20 \
    -c:a copy \
    -bsf:a aac_adtstoasc \
    AB1_h264_vaapi.mp4

H.265 (Skylake ~), H.265 Main10 (Kaby Lake ~)

QSV

$ docker run --rm -it --device=/dev/dri -v `pwd`:/workdir \
  ffmpeg -y \
    -init_hw_device qsv=qsv:hw -hwaccel qsv -filter_hw_device qsv -hwaccel_output_format qsv \
    -fflags +discardcorrupt \
    -analyzeduration 30M -probesize 100MB \
    -i AB1.m2ts \
    -t 60 \
    -vf hwupload=extra_hw_frames=64,vpp_qsv=deinterlace=2,vpp_qsv=w=1920:h=1080,fps=30000/1001 \
    -c:v hevc_qsv \
    -q:v 20 \
    -c:a copy \
    -bsf:a aac_adtstoasc \
    AB1_h265_qsv.mp4

VAAPI

$ docker run --rm -it --device=/dev/dri -v `pwd`:/workdir \
  ffmpeg -y \
    -hwaccel vaapi -hwaccel_output_format vaapi \
    -fflags +discardcorrupt \
    -analyzeduration 30M -probesize 100MB \
    -i AB1.m2ts \
    -t 60 \
    -vf hwupload=extra_hw_frames=64,deinterlace_vaapi,scale_vaapi=1920:1080,sharpness_vaapi,fps=30000/1001 \
    -c:v hevc_vaapi \
    -qp 20 \
    -c:a copy \
    -bsf:a aac_adtstoasc \
    AB1_h265_vaapi.mp4

Info

Encoders
$ docker run --rm ffmpeg -encoders
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --disable-debug --enable-small --enable-version3 --enable-libmfx --prefix=/opt/ffmpeg
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
Encoders:
 V..... = Video
 A..... = Audio
 S..... = Subtitle
 .F.... = Frame-level multithreading
 ..S... = Slice-level multithreading
 ...X.. = Codec is experimental
 ....B. = Supports draw_horiz_band
 .....D = Supports direct rendering method 1
 ------
 V..... a64multi              (codec a64_multi)
 V..... a64multi5             (codec a64_multi5)
 V..... alias_pix
 V..... amv
 V..... asv1
 V..... asv2
 V..... avrp
 V..X.. avui
 V..... ayuv
 V..... bmp
 VF.... cfhd
 V..... cinepak
 V..... cljr
 V.S... vc2                   (codec dirac)
 VFS... dnxhd
 V..... dpx
 VFS... dvvideo
 V.S... ffv1
 VF.... ffvhuff
 V..... fits
 V..... flv                   (codec flv1)
 V..... gif
 V..... h261
 V..... h263
 V..... h263_v4l2m2m          (codec h263)
 V.S... h263p
 V..... h264_qsv              (codec h264)
 V..... h264_v4l2m2m          (codec h264)
 V....D h264_vaapi            (codec h264)
 V..... hevc_qsv              (codec hevc)
 V..... hevc_v4l2m2m          (codec hevc)
 V....D hevc_vaapi            (codec hevc)
 VF.... huffyuv
 V..... jpeg2000
 VF.... jpegls
 VF.... ljpeg
 VF.... magicyuv
 VFS... mjpeg
 V..... mjpeg_qsv             (codec mjpeg)
 V....D mjpeg_vaapi           (codec mjpeg)
 V.S... mpeg1video
 V.S... mpeg2video
 V..... mpeg2_qsv             (codec mpeg2video)
 V....D mpeg2_vaapi           (codec mpeg2video)
 V.S... mpeg4
 V..... mpeg4_v4l2m2m         (codec mpeg4)
 V..... msmpeg4v2
 V..... msmpeg4               (codec msmpeg4v3)
 V..... msvideo1
 V..... pam
 V..... pbm
 V..... pcx
 V..... pfm
 V..... pgm
 V..... pgmyuv
 V..... ppm
 VF.... prores
 VF.... prores_aw             (codec prores)
 VFS... prores_ks             (codec prores)
 V..... qtrle
 V..... r10k
 V..... r210
 V..... rawvideo
 V..... roqvideo              (codec roq)
 V..... rpza
 V..... rv10
 V..... rv20
 V..... sgi
 V..... snow
 V..... speedhq
 V..... sunrast
 V..... svq1
 V..... targa
 VF.... tiff
 VF.... utvideo
 V..... v210
 V..... v308
 V..... v408
 V..... v410
 V..... vp8_v4l2m2m           (codec vp8)
 V....D vp8_vaapi             (codec vp8)
 V....D vp9_vaapi             (codec vp9)
 V..... vp9_qsv               (codec vp9)
 V..... wmv1
 V..... wmv2
 V..... wrapped_avframe
 V..... xbm
 V..... xface
 V..... xwd
 V..... y41p
 V..... yuv4
 A..... aac
 A..... ac3
 A..... ac3_fixed             (codec ac3)
 A..... adpcm_adx
 A..... adpcm_argo
 A..... g722                  (codec adpcm_g722)
 A..... g726                  (codec adpcm_g726)
 A..... g726le                (codec adpcm_g726le)
 A..... adpcm_ima_alp
 A..... adpcm_ima_amv
 A..... adpcm_ima_apm
 A..... adpcm_ima_qt
 A..... adpcm_ima_ssi
 A..... adpcm_ima_wav
 A..... adpcm_ms
 A..... adpcm_swf
 A..... adpcm_yamaha
 A..... alac
 A..... aptx
 A..... aptx_hd
 A..... comfortnoise
 A..X.. dca                   (codec dts)
 A..... eac3
 A..... flac
 A..... g723_1
 A..X.. mlp
 A..... mp2
 A..... mp2fixed              (codec mp2)
 A..... nellymoser
 A..X.. opus
 A..... pcm_alaw
 A..... pcm_dvd
 A..... pcm_f32be
 A..... pcm_f32le
 A..... pcm_f64be
 A..... pcm_f64le
 A..... pcm_mulaw
 A..... pcm_s16be
 A..... pcm_s16be_planar
 A..... pcm_s16le
 A..... pcm_s16le_planar
 A..... pcm_s24be
 A..... pcm_s24daud
 A..... pcm_s24le
 A..... pcm_s24le_planar
 A..... pcm_s32be
 A..... pcm_s32le
 A..... pcm_s32le_planar
 A..... pcm_s64be
 A..... pcm_s64le
 A..... pcm_s8
 A..... pcm_s8_planar
 A..... pcm_u16be
 A..... pcm_u16le
 A..... pcm_u24be
 A..... pcm_u24le
 A..... pcm_u32be
 A..... pcm_u32le
 A..... pcm_u8
 A..... pcm_vidc
 A..... real_144              (codec ra_144)
 A..... roq_dpcm
 A..X.. s302m
 A..... sbc
 A..X.. sonic
 A..X.. sonicls
 A..X.. truehd
 A..... tta
 A..X.. vorbis
 A..... wavpack
 A..... wmav1
 A..... wmav2
 S..... ssa                   (codec ass)
 S..... ass
 S..... dvbsub                (codec dvb_subtitle)
 S..... dvdsub                (codec dvd_subtitle)
 S..... mov_text
 S..... srt                   (codec subrip)
 S..... subrip
 S..... text
 S....D ttml
 S..... webvtt
 S..... xsub
Decoders
$ docker run --rm ffmpeg -decoders
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --disable-debug --enable-small --enable-version3 --enable-libmfx --prefix=/opt/ffmpeg
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
Decoders:
 V..... = Video
 A..... = Audio
 S..... = Subtitle
 .F.... = Frame-level multithreading
 ..S... = Slice-level multithreading
 ...X.. = Codec is experimental
 ....B. = Supports draw_horiz_band
 .....D = Supports direct rendering method 1
 ------
 V....D 012v
 V....D 4xm
 V....D 8bps
 V....D aasc
 V....D agm
 VF...D aic
 V....D alias_pix
 V....D amv
 V....D anm
 V....D ansi
 V....D arbc
 V....D argo
 V....D asv1
 V....D asv2
 V....D aura
 V....D aura2
 V....D av1
 V....D av1_qsv               (codec av1)
 V....D avrn
 V....D avrp
 V....D avs
 V....D avui
 V....D ayuv
 V....D bethsoftvid
 V....D bfi
 V....D binkvideo
 V....D bintext
 V..X.. bitpacked
 V....D bmp
 V....D bmv_video
 V....D brender_pix
 V....D c93
 V....D cavs
 V....D cdgraphics
 V....D cdtoons
 V....D cdxl
 VF...D cfhd
 V....D cinepak
 V....D clearvideo
 V....D cljr
 VF...D cllc
 V....D eacmv                 (codec cmv)
 V....D cpia
 VF...D cri
 V....D camstudio             (codec cscd)
 V....D cyuv
 V.S..D dds
 V....D dfa
 V.S..D dirac
 VFS..D dnxhd
 V....D dpx
 V....D dsicinvideo
 VFS..D dvvideo
 VF...D dxtory
 VFS..D dxv
 V....D escape124
 V....D escape130
 VFS..D ffv1
 VF..BD ffvhuff
 V.S..D fic
 V....D fits
 V....D flic
 V...BD flv                   (codec flv1)
 V....D fmvc
 VF...D fraps
 V....D frwu
 V....D gdv
 V....D gif
 V....D h261
 V...BD h263
 V..... h263_v4l2m2m          (codec h263)
 V...BD h263i
 V...BD h263p
 VFS..D h264
 V..... h264_v4l2m2m          (codec h264)
 V....D h264_qsv              (codec h264)
 VFS..D hap
 VFS..D hevc
 V....D hevc_qsv              (codec hevc)
 V..... hevc_v4l2m2m          (codec hevc)
 V....D hnm4video
 V....D hq_hqa
 VFS..D hqx
 VF..BD huffyuv
 VF..BD hymt
 V....D idcinvideo            (codec idcin)
 V....D idf
 V....D iff                   (codec iff_ilbm)
 V....D imm4
 V..... imm5
 V....D indeo2
 V....D indeo3
 V....D indeo4
 V....D indeo5
 V....D interplayvideo
 V....D ipu
 VFS..D jpeg2000
 V....D jpegls
 V....D jv
 V....D kgv1
 V....D kmvc
 VF...D lagarith
 V....D loco
 V....D m101
 V....D eamad                 (codec mad)
 VFS..D magicyuv
 VF...D mdec
 VF...D mimic
 V....D mjpeg
 V....D mjpeg_qsv             (codec mjpeg)
 V....D mjpegb
 V....D mmvideo
 V....D mobiclip
 V....D motionpixels
 V.S.BD mpeg1video
 V..... mpeg1_v4l2m2m         (codec mpeg1video)
 V.S.BD mpeg2video
 V.S.BD mpegvideo             (codec mpeg2video)
 V..... mpeg2_v4l2m2m         (codec mpeg2video)
 V....D mpeg2_qsv             (codec mpeg2video)
 VF..BD mpeg4
 V..... mpeg4_v4l2m2m         (codec mpeg4)
 V....D msa1
 V...BD msmpeg4v1
 V...BD msmpeg4v2
 V...BD msmpeg4               (codec msmpeg4v3)
 V....D msp2
 V....D msrle
 V....D mss1
 V....D mss2
 V....D msvideo1
 VF...D mszh
 V....D mts2
 V....D mv30
 V....D mvc1
 V....D mvc2
 V....D mvdv
 V....D mxpeg
 VF...D notchlc
 V....D nuv
 V....D paf_video
 V....D pam
 V....D pbm
 V....D pcx
 V....D pfm
 V....D pgm
 V....D pgmyuv
 V....D pgx
 VF...D photocd
 V....D pictor
 VF...D pixlet
 V....D ppm
 VFS..D prores
 V....D prosumer
 VF...D psd
 V....D ptx
 V....D qdraw
 V....D qpeg
 V....D qtrle
 V....D r10k
 V....D r210
 V..... rawvideo
 V....D rl2
 V....D roqvideo              (codec roq)
 V....D rpza
 V....D rv10
 V....D rv20
 VF...D rv30
 VF...D rv40
 V....D sanm
 V....D scpr
 V....D sga
 V....D sgi
 V....D sgirle
 VF...D sheervideo
 V....D simbiosis_imx
 V....D smackvid              (codec smackvideo)
 V....D smc
 V....D smvjpeg
 V....D snow
 V....D sp5x
 V....D speedhq
 V....D sunrast
 V....D svq1
 V...BD svq3
 V....D targa
 V....D targa_y216
 V....D eatgq                 (codec tgq)
 V....D eatgv                 (codec tgv)
 VF..BD theora
 V....D thp
 V....D tiertexseqvideo
 VF...D tiff
 V....D tmv
 V....D eatqi                 (codec tqi)
 V....D truemotion1
 V....D truemotion2
 V....D truemotion2rt
 V....D tscc2
 V....D txd
 V....D ultimotion            (codec ulti)
 VF...D utvideo
 VFS..D v210
 V....D v210x
 V....D v308
 V....D v408
 VFS..D v410
 V....D vb
 VF...D vble
 V....D vc1
 V....D vc1_qsv               (codec vc1)
 V..... vc1_v4l2m2m           (codec vc1)
 V....D vc1image
 V....D vcr1
 V....D xl                    (codec vixl)
 V....D vmdvideo
 V....D vmnc
 VF..BD vp3
 VF..BD vp4
 V....D vp5
 V....D vp6
 V.S..D vp6a
 V....D vp6f
 V....D vp7
 VFS..D vp8
 V..... vp8_v4l2m2m           (codec vp8)
 V....D vp8_qsv               (codec vp8)
 VFS..D vp9
 V..... vp9_v4l2m2m           (codec vp9)
 V....D vp9_qsv               (codec vp9)
 VF...D webp
 V...BD wmv1
 V...BD wmv2
 V....D wmv3
 V....D wmv3image
 V....D wnv1
 V..... wrapped_avframe
 V....D vqavideo              (codec ws_vqa)
 V....D xan_wc3
 V....D xan_wc4
 V....D xbin
 V....D xbm
 V..... xface
 V....D xpm
 V....D xwd
 V....D y41p
 VF...D ylc
 V..... yop
 V....D yuv4
 A....D 8svx_exp
 A....D 8svx_fib
 A....D aac
 A....D aac_fixed             (codec aac)
 A....D aac_latm
 A....D ac3
 A....D ac3_fixed             (codec ac3)
 A....D acelp.kelvin
 A....D adpcm_4xm
 A....D adpcm_adx
 A....D adpcm_afc
 A....D adpcm_agm
 A....D adpcm_aica
 A....D adpcm_argo
 A....D adpcm_ct
 A....D adpcm_dtk
 A....D adpcm_ea
 A....D adpcm_ea_maxis_xa
 A....D adpcm_ea_r1
 A....D adpcm_ea_r2
 A....D adpcm_ea_r3
 A....D adpcm_ea_xas
 A....D g722                  (codec adpcm_g722)
 A....D g726                  (codec adpcm_g726)
 A....D g726le                (codec adpcm_g726le)
 A....D adpcm_ima_alp
 A....D adpcm_ima_amv
 A....D adpcm_ima_apc
 A....D adpcm_ima_apm
 A....D adpcm_ima_cunning
 A....D adpcm_ima_dat4
 A....D adpcm_ima_dk3
 A....D adpcm_ima_dk4
 A....D adpcm_ima_ea_eacs
 A....D adpcm_ima_ea_sead
 A....D adpcm_ima_iss
 A....D adpcm_ima_moflex
 A....D adpcm_ima_mtf
 A....D adpcm_ima_oki
 A....D adpcm_ima_qt
 A....D adpcm_ima_rad
 A....D adpcm_ima_smjpeg
 A....D adpcm_ima_ssi
 A....D adpcm_ima_wav
 A....D adpcm_ima_ws
 A....D adpcm_ms
 A....D adpcm_mtaf
 A....D adpcm_psx
 A....D adpcm_sbpro_2
 A....D adpcm_sbpro_3
 A....D adpcm_sbpro_4
 A....D adpcm_swf
 A....D adpcm_thp
 A....D adpcm_thp_le
 A....D adpcm_vima
 A....D adpcm_xa
 A....D adpcm_yamaha
 A....D adpcm_zork
 AF...D alac
 A....D amrnb                 (codec amr_nb)
 A....D amrwb                 (codec amr_wb)
 A....D ape
 A....D aptx
 A....D aptx_hd
 A....D atrac1
 A....D atrac3
 A....D atrac3al
 A....D atrac3plus            (codec atrac3p)
 A....D atrac3plusal          (codec atrac3pal)
 A....D atrac9
 A....D on2avc                (codec avc)
 A....D binkaudio_dct
 A....D binkaudio_rdft
 A....D bmv_audio
 A....D comfortnoise
 A....D cook
 A....D derf_dpcm
 A....D dolby_e
 A.S..D dsd_lsbf
 A.S..D dsd_lsbf_planar
 A.S..D dsd_msbf
 A.S..D dsd_msbf_planar
 A....D dsicinaudio
 A....D dss_sp
 A....D dst
 A....D dca                   (codec dts)
 A....D dvaudio
 A....D eac3
 A....D evrc
 A....D fastaudio
 AF...D flac
 A....D g723_1
 A....D g729
 A....D gremlin_dpcm
 A....D gsm
 A....D gsm_ms
 A....D hca
 A....D hcom
 A....D iac
 A....D ilbc
 A....D imc
 A....D interplay_dpcm
 A....D interplayacm
 A....D mace3
 A....D mace6
 A....D metasound
 A....D mlp
 A....D mp1
 A....D mp1float              (codec mp1)
 A....D mp2
 A....D mp2float              (codec mp2)
 A....D mp3float              (codec mp3)
 A....D mp3
 A....D mp3adufloat           (codec mp3adu)
 A....D mp3adu
 A....D mp3on4float           (codec mp3on4)
 A....D mp3on4
 A....D als                   (codec mp4als)
 A....D mpc7                  (codec musepack7)
 A....D mpc8                  (codec musepack8)
 A....D nellymoser
 A....D opus
 A....D paf_audio
 A....D pcm_alaw
 A....D pcm_bluray
 A....D pcm_dvd
 A....D pcm_f16le
 A....D pcm_f24le
 A....D pcm_f32be
 A....D pcm_f32le
 A....D pcm_f64be
 A....D pcm_f64le
 A....D pcm_lxf
 A....D pcm_mulaw
 A....D pcm_s16be
 A....D pcm_s16be_planar
 A....D pcm_s16le
 A....D pcm_s16le_planar
 A....D pcm_s24be
 A....D pcm_s24daud
 A....D pcm_s24le
 A....D pcm_s24le_planar
 A....D pcm_s32be
 A....D pcm_s32le
 A....D pcm_s32le_planar
 A....D pcm_s64be
 A....D pcm_s64le
 A....D pcm_s8
 A....D pcm_s8_planar
 A....D pcm_sga
 A....D pcm_u16be
 A....D pcm_u16le
 A....D pcm_u24be
 A....D pcm_u24le
 A....D pcm_u32be
 A....D pcm_u32le
 A....D pcm_u8
 A....D pcm_vidc
 A....D qcelp
 A....D qdm2
 A....D qdmc
 A....D real_144              (codec ra_144)
 A....D real_288              (codec ra_288)
 A....D ralf
 A....D roq_dpcm
 A....D s302m
 A....D sbc
 A....D sdx2_dpcm
 A....D shorten
 A....D sipr
 A....D siren
 A....D smackaud              (codec smackaudio)
 A....D sol_dpcm
 A..X.D sonic
 AF...D tak
 A....D truehd
 A....D truespeech
 AF...D tta
 A....D twinvq
 A....D vmdaudio
 A....D vorbis
 A....D wavesynth
 AFS..D wavpack
 A....D ws_snd1               (codec westwood_snd1)
 A....D wmalossless
 A....D wmapro
 A....D wmav1
 A....D wmav2
 A....D wmavoice
 A....D xan_dpcm
 A....D xma1
 A....D xma2
 S..... ssa                   (codec ass)
 S..... ass
 S..... dvbsub                (codec dvb_subtitle)
 S..... dvdsub                (codec dvd_subtitle)
 S..... cc_dec                (codec eia_608)
 S..... pgssub                (codec hdmv_pgs_subtitle)
 S..... jacosub
 S..... microdvd
 S..... mov_text
 S..... mpl2
 S..... pjs
 S..... realtext
 S..... sami
 S..... stl
 S..... srt                   (codec subrip)
 S..... subrip
 S..... subviewer
 S..... subviewer1
 S..... text
 S..... vplayer
 S..... webvtt
 S..... xsub
FROM debian:buster AS ffmpeg-build
ENV DEBIAN_FRONTEND=noninteractive
# Install build tools
RUN apt-get update && \
apt-get install -y make build-essential yasm nasm cmake pkg-config
ENV FFMPEG_CONFIGURE_OPTIONS="" \
FFMPEG_EXTRA_LIBS=""
# Build libvpx
ADD https://github.com/webmproject/libvpx/archive/master.tar.gz /tmp/libvpx-master.tar.gz
RUN cd /tmp && \
tar xf libvpx-master.tar.gz && \
cd /tmp/libvpx-master && \
./configure --disable-unit-tests --as=yasm && \
make -j $(nproc) && \
make install
ENV FFMPEG_CONFIGURE_OPTIONS="${FFMPEG_CONFIGURE_OPTIONS} --enable-libvpx"
# Build x264
ADD https://code.videolan.org/videolan/x264/-/archive/master/x264-master.tar.bz2 /tmp/
RUN cd /tmp && \
tar xf x264-master.tar.bz2 && \
cd /tmp/x264-master && \
./configure && \
make -j $(nproc) && \
make install && \
make install-cli && \
make install-lib-static
ENV FFMPEG_CONFIGURE_OPTIONS="${FFMPEG_CONFIGURE_OPTIONS} --enable-libx264"
# Build x265
ADD https://github.com/videolan/x265/archive/master.tar.gz /tmp/x265-master.tar.gz
RUN cd /tmp && \
tar xf x265-master.tar.gz && \
mkdir /tmp/x265_build && cd /tmp/x265_build && \
cmake -DENABLE_SHARED=off -DBUILD_SHARED_LIBS=OFF ../x265-master/source && \
make -j $(nproc) && \
make install
ENV FFMPEG_CONFIGURE_OPTIONS="${FFMPEG_CONFIGURE_OPTIONS} --enable-libx265" \
FFMPEG_EXTRA_LIBS="${FFMPEG_EXTRA_LIBS} -lpthread"
#
# HWAccel
#
# Install MediaSDK
ENV INTEL_MEDIA_SDK_VERSION=21.1.3
ADD https://github.com/Intel-Media-SDK/MediaSDK/releases/download/intel-mediasdk-${INTEL_MEDIA_SDK_VERSION}/MediaStack.tar.gz /tmp/
RUN apt-get install -y libdrm2
RUN cd /tmp && \
tar xf MediaStack.tar.gz && \
cd /tmp/MediaStack/opt/intel/mediasdk && \
cp --archive --no-dereference include /usr/local/ && \
cp --archive --no-dereference lib64/. /usr/local/lib/ && \
ldconfig
ENV FFMPEG_CONFIGURE_OPTIONS="${FFMPEG_CONFIGURE_OPTIONS} --enable-libmfx"
#
# Build ffmpeg
#
ENV FFMPEG_VERSION=4.4
ADD https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.xz /tmp/
RUN cd /tmp && \
tar xf /tmp/ffmpeg-${FFMPEG_VERSION}.tar.xz && \
cd /tmp/ffmpeg-${FFMPEG_VERSION} && \
./configure ${FFMPEG_CONFIGURE_OPTIONS} \
--disable-debug \
--enable-small \
--enable-gpl \
--enable-version3 \
--extra-libs="${FFMPEG_EXTRA_LIBS}" \
--pkg-config="pkg-config --static" && \
make -j $(nproc) && \
make install
# Copy artifacts
RUN mkdir /build && \
cp --archive --parents --no-dereference /usr/local/bin/ff* /build && \
cp --archive --parents --no-dereference /usr/local/lib/*.so* /build
# final image
FROM debian:buster-slim
# Install runtime dependency
RUN apt-get update && \
apt-get install -y libdrm2 && \
apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
COPY --from=ffmpeg-build /build /
ENV LIBVA_DRIVERS_PATH=/usr/local/lib \
LIBVA_DRIVER_NAME=iHD
RUN ldconfig
WORKDIR /workdir
ENTRYPOINT [ "ffmpeg" ]
CMD [ "--help" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment