Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce FFmpeg binary size #5974

Closed
FreezyLemon opened this issue Aug 20, 2023 · 2 comments · Fixed by #5981
Closed

Reduce FFmpeg binary size #5974

FreezyLemon opened this issue Aug 20, 2023 · 2 comments · Fixed by #5981

Comments

@FreezyLemon
Copy link
Contributor

The current ffmpeg build scripts already remove some unnecessary components. The feature set can be reduced a lot further though.

Current features (./configure)
External libraries:
mediafoundation

External libraries providing hardware acceleration:
d3d11va                 dxva2

Libraries:
avcodec                 avfilter                avformat                avutil                  swscale

Programs:

Enabled decoders:
aac                     bfi                     hevc                    pcm_f24le               stl
aac_fixed               bink                    hnm4_video              pcm_f32be               subrip
aac_latm                binkaudio_dct           hq_hqa                  pcm_f32le               subviewer
aasc                    binkaudio_rdft          hqx                     pcm_f64be               subviewer1
ac3                     bintext                 huffyuv                 pcm_f64le               sunrast
ac3_fixed               bitpacked               hymt                    pcm_lxf                 svq1
acelp_kelvin            bmp                     iac                     pcm_mulaw               svq3
adpcm_4xm               bmv_audio               idcin                   pcm_s16be               tak
adpcm_adx               bmv_video               idf                     pcm_s16be_planar        targa
adpcm_afc               brender_pix             iff_ilbm                pcm_s16le               targa_y216
adpcm_agm               c93                     ilbc                    pcm_s16le_planar        text
adpcm_aica              cavs                    imc                     pcm_s24be               theora
adpcm_argo              ccaption                imm4                    pcm_s24daud             thp
adpcm_ct                cdgraphics              imm5                    pcm_s24le               tiertexseqvideo
adpcm_dtk               cdtoons                 indeo2                  pcm_s24le_planar        tiff
adpcm_ea                cdxl                    indeo3                  pcm_s32be               tmv
adpcm_ea_maxis_xa       cfhd                    indeo4                  pcm_s32le               truehd
adpcm_ea_r1             cinepak                 indeo5                  pcm_s32le_planar        truemotion1
adpcm_ea_r2             clearvideo              interplay_acm           pcm_s64be               truemotion2
adpcm_ea_r3             cljr                    interplay_dpcm          pcm_s64le               truemotion2rt
adpcm_ea_xas            cllc                    interplay_video         pcm_s8                  truespeech
adpcm_g722              comfortnoise            jacosub                 pcm_s8_planar           tscc2
adpcm_g726              cook                    jpeg2000                pcm_u16be               tta
adpcm_g726le            cpia                    jpegls                  pcm_u16le               twinvq
adpcm_ima_alp           cscd                    jv                      pcm_u24be               txd
adpcm_ima_amv           cyuv                    kgv1                    pcm_u24le               ulti
adpcm_ima_apc           dca                     kmvc                    pcm_u32be               utvideo
adpcm_ima_apm           dds                     lagarith                pcm_u32le               v210
adpcm_ima_cunning       derf_dpcm               loco                    pcm_u8                  v210x
adpcm_ima_dat4          dfa                     m101                    pcm_vidc                v308
adpcm_ima_dk3           dirac                   mace3                   pcx                     v408
adpcm_ima_dk4           dnxhd                   mace6                   pfm                     v410
adpcm_ima_ea_eacs       dolby_e                 magicyuv                pgm                     vb
adpcm_ima_ea_sead       dpx                     mdec                    pgmyuv                  vble
adpcm_ima_iss           dsd_lsbf                metasound               pgssub                  vc1
adpcm_ima_mtf           dsd_lsbf_planar         microdvd                pictor                  vc1image
adpcm_ima_oki           dsd_msbf                mimic                   pixlet                  vcr1
adpcm_ima_qt            dsd_msbf_planar         mjpeg                   pjs                     vmdaudio
adpcm_ima_rad           dsicinaudio             mjpegb                  ppm                     vmdvideo
adpcm_ima_smjpeg        dsicinvideo             mlp                     prores                  vmnc
adpcm_ima_ssi           dss_sp                  mmvideo                 prosumer                vorbis
adpcm_ima_wav           dst                     motionpixels            psd                     vp3
adpcm_ima_ws            dvaudio                 movtext                 ptx                     vp4
adpcm_ms                dvbsub                  mp1                     qcelp                   vp5
adpcm_mtaf              dvdsub                  mp1float                qdm2                    vp6
adpcm_psx               dvvideo                 mp2                     qdmc                    vp6a
adpcm_sbpro_2           dxtory                  mp2float                qdraw                   vp6f
adpcm_sbpro_3           dxv                     mp3                     qpeg                    vp7
adpcm_sbpro_4           eac3                    mp3adu                  qtrle                   vp8
adpcm_swf               eacmv                   mp3adufloat             r10k                    vp9
adpcm_thp               eamad                   mp3float                r210                    vplayer
adpcm_thp_le            eatgq                   mp3on4                  ra_144                  vqa
adpcm_vima              eatgv                   mp3on4float             ra_288                  wavpack
adpcm_xa                eatqi                   mpc7                    ralf                    webp
adpcm_yamaha            eightbps                mpc8                    rawvideo                webvtt
adpcm_zork              eightsvx_exp            mpeg1video              realtext                wmalossless
agm                     eightsvx_fib            mpeg2video              rl2                     wmapro
aic                     escape124               mpeg4                   roq                     wmav1
alac                    escape130               mpegvideo               roq_dpcm                wmav2
alias_pix               evrc                    mpl2                    rpza                    wmavoice
als                     ffv1                    msa1                    rv10                    wmv1
amrnb                   ffvhuff                 msmpeg4v1               rv20                    wmv2
amrwb                   ffwavesynth             msmpeg4v2               rv30                    wmv3
amv                     fic                     msmpeg4v3               rv40                    wmv3image
anm                     fits                    msrle                   s302m                   wnv1
ansi                    flac                    mss1                    sami                    wrapped_avframe
ape                     flic                    mss2                    sanm                    ws_snd1
aptx                    flv                     msvideo1                sbc                     xan_dpcm
aptx_hd                 fmvc                    mszh                    scpr                    xan_wc3
arbc                    fourxm                  mts2                    sdx2_dpcm               xan_wc4
ass                     fraps                   mv30                    sgi                     xbin
asv1                    frwu                    mvc1                    sgirle                  xbm
asv2                    g723_1                  mvc2                    sheervideo              xface
atrac1                  g729                    mvdv                    shorten                 xl
atrac3                  gdv                     mxpeg                   sipr                    xma1
atrac3al                gif                     nellymoser              siren                   xma2
atrac3p                 gremlin_dpcm            notchlc                 smackaud                xpm
atrac3pal               gsm                     nuv                     smacker                 xsub
atrac9                  gsm_ms                  on2avc                  smc                     xwd
aura                    h261                    paf_audio               smvjpeg                 y41p
aura2                   h263                    paf_video               snow                    ylc
avrn                    h263i                   pam                     sol_dpcm                yop
avrp                    h263p                   pbm                     sonic                   yuv4
avs                     h264                    pcm_alaw                sp5x                    zero12v
avui                    hap                     pcm_bluray              speedhq
ayuv                    hca                     pcm_dvd                 srt
bethsoftvid             hcom                    pcm_f16le               ssa

Enabled encoders:
a64multi                comfortnoise            mpeg1video              pcm_s8_planar           srt
a64multi5               dca                     mpeg2video              pcm_u16be               ssa
aac                     dnxhd                   mpeg4                   pcm_u16le               subrip
aac_mf                  dpx                     msmpeg4v2               pcm_u24be               sunrast
ac3                     dvbsub                  msmpeg4v3               pcm_u24le               svq1
ac3_fixed               dvdsub                  msvideo1                pcm_u32be               targa
ac3_mf                  dvvideo                 nellymoser              pcm_u32le               text
adpcm_adx               eac3                    opus                    pcm_u8                  tiff
adpcm_g722              ffv1                    pam                     pcm_vidc                truehd
adpcm_g726              ffvhuff                 pbm                     pcx                     tta
adpcm_g726le            fits                    pcm_alaw                pgm                     utvideo
adpcm_ima_qt            flac                    pcm_dvd                 pgmyuv                  v210
adpcm_ima_ssi           flv                     pcm_f32be               ppm                     v308
adpcm_ima_wav           g723_1                  pcm_f32le               prores                  v408
adpcm_ms                gif                     pcm_f64be               prores_aw               v410
adpcm_swf               h261                    pcm_f64le               prores_ks               vc2
adpcm_yamaha            h263                    pcm_mulaw               qtrle                   vorbis
alac                    h263p                   pcm_s16be               r10k                    wavpack
alias_pix               h264_mf                 pcm_s16be_planar        r210                    webvtt
amv                     hevc_mf                 pcm_s16le               ra_144                  wmav1
aptx                    huffyuv                 pcm_s16le_planar        rawvideo                wmav2
aptx_hd                 jpeg2000                pcm_s24be               roq                     wmv1
ass                     jpegls                  pcm_s24daud             roq_dpcm                wmv2
asv1                    ljpeg                   pcm_s24le               rv10                    wrapped_avframe
asv2                    magicyuv                pcm_s24le_planar        rv20                    xbm
avrp                    mjpeg                   pcm_s32be               s302m                   xface
avui                    mlp                     pcm_s32le               sbc                     xsub
ayuv                    movtext                 pcm_s32le_planar        sgi                     xwd
bmp                     mp2                     pcm_s64be               snow                    y41p
cinepak                 mp2fixed                pcm_s64le               sonic                   yuv4
cljr                    mp3_mf                  pcm_s8                  sonic_ls

Enabled hwaccels:
h264_d3d11va            hevc_d3d11va2           mpeg2_dxva2             vp9_d3d11va             wmv3_d3d11va2
h264_d3d11va2           hevc_dxva2              vc1_d3d11va             vp9_d3d11va2            wmv3_dxva2
h264_dxva2              mpeg2_d3d11va           vc1_d3d11va2            vp9_dxva2
hevc_d3d11va            mpeg2_d3d11va2          vc1_dxva2               wmv3_d3d11va

Enabled parsers:
aac                     dirac                   gif                     mpegaudio               vc1
aac_latm                dnxhd                   gsm                     mpegvideo               vorbis
ac3                     dpx                     h261                    opus                    vp3
adx                     dvaudio                 h263                    png                     vp8
av1                     dvbsub                  h264                    pnm                     vp9
avs2                    dvd_nav                 hevc                    rv30                    webp
bmp                     dvdsub                  jpeg2000                rv40                    xma
cavsvideo               flac                    mjpeg                   sbc
cook                    g723_1                  mlp                     sipr
dca                     g729                    mpeg4video              tak

Enabled demuxers:
aa                      dnxhd                   image_pbm_pipe          mxf                     ser
aac                     dsf                     image_pcx_pipe          mxg                     shorten
ac3                     dsicin                  image_pgm_pipe          nc                      siff
acm                     dss                     image_pgmyuv_pipe       nistsphere              sln
act                     dts                     image_pictor_pipe       nsp                     smacker
adf                     dtshd                   image_png_pipe          nsv                     smjpeg
adp                     dv                      image_ppm_pipe          nut                     smush
ads                     dvbsub                  image_psd_pipe          nuv                     sol
adx                     dvbtxt                  image_qdraw_pipe        ogg                     sox
aea                     dxa                     image_sgi_pipe          oma                     spdif
afc                     ea                      image_sunrast_pipe      paf                     srt
aiff                    ea_cdata                image_svg_pipe          pcm_alaw                stl
aix                     eac3                    image_tiff_pipe         pcm_f32be               str
alp                     epaf                    image_webp_pipe         pcm_f32le               subviewer
amr                     ffmetadata              image_xpm_pipe          pcm_f64be               subviewer1
amrnb                   filmstrip               image_xwd_pipe          pcm_f64le               sup
amrwb                   fits                    ingenient               pcm_mulaw               svag
anm                     flac                    ipmovie                 pcm_s16be               swf
apc                     flic                    ircam                   pcm_s16le               tak
ape                     flv                     iss                     pcm_s24be               tedcaptions
apm                     fourxm                  iv8                     pcm_s24le               thp
apng                    frm                     ivf                     pcm_s32be               threedostr
aptx                    fsb                     ivr                     pcm_s32le               tiertexseq
aptx_hd                 fwse                    jacosub                 pcm_s8                  tmv
aqtitle                 g722                    jv                      pcm_u16be               truehd
argo_asf                g723_1                  kux                     pcm_u16le               tta
asf                     g726                    kvag                    pcm_u24be               tty
asf_o                   g726le                  live_flv                pcm_u24le               txd
ass                     g729                    lmlm4                   pcm_u32be               ty
ast                     gdv                     loas                    pcm_u32le               v210
au                      genh                    lrc                     pcm_u8                  v210x
av1                     gif                     lvf                     pcm_vidc                vag
avi                     gsm                     lxf                     pjs                     vc1
avr                     gxf                     m4v                     pmp                     vc1t
avs                     h261                    matroska                pp_bnk                  vividas
avs2                    h263                    mgsts                   pva                     vivo
bethsoftvid             h264                    microdvd                pvf                     vmd
bfi                     hca                     mjpeg                   qcp                     vobsub
bfstm                   hcom                    mjpeg_2000              r3d                     voc
bink                    hevc                    mlp                     rawvideo                vpk
bintext                 hls                     mlv                     realtext                vplayer
bit                     hnm                     mm                      redspark                vqf
bmv                     ico                     mmf                     rl2                     w64
boa                     idcin                   mov                     rm                      wav
brstm                   idf                     mp3                     roq                     wc3
c93                     iff                     mpc                     rpl                     webm_dash_manifest
caf                     ifv                     mpc8                    rsd                     webvtt
cavsvideo               ilbc                    mpegps                  rso                     wsaud
cdg                     image2                  mpegts                  rtp                     wsd
cdxl                    image2_alias_pix        mpegtsraw               rtsp                    wsvqa
cine                    image2_brender_pix      mpegvideo               s337m                   wtv
codec2                  image2pipe              mpjpeg                  sami                    wv
codec2raw               image_bmp_pipe          mpl2                    sap                     wve
concat                  image_dds_pipe          mpsub                   sbc                     xa
data                    image_dpx_pipe          msf                     sbg                     xbin
daud                    image_exr_pipe          msnwc_tcp               scc                     xmv
dcstr                   image_gif_pipe          mtaf                    sdp                     xvag
derf                    image_j2k_pipe          mtv                     sdr2                    xwma
dfa                     image_jpeg_pipe         musx                    sds                     yop
dhav                    image_jpegls_pipe       mv                      sdx                     yuv4mpegpipe
dirac                   image_pam_pipe          mvi                     segafilm

Enabled muxers:
a64                     fifo                    latm                    opus                    segafilm
ac3                     fifo_test               lrc                     pcm_alaw                segment
adts                    filmstrip               m4v                     pcm_f32be               singlejpeg
adx                     fits                    matroska                pcm_f32le               smjpeg
aiff                    flac                    matroska_audio          pcm_f64be               smoothstreaming
amr                     flv                     md5                     pcm_f64le               sox
apng                    framecrc                microdvd                pcm_mulaw               spdif
aptx                    framehash               mjpeg                   pcm_s16be               spx
aptx_hd                 framemd5                mkvtimestamp_v2         pcm_s16le               srt
asf                     g722                    mlp                     pcm_s24be               stream_segment
asf_stream              g723_1                  mmf                     pcm_s24le               streamhash
ass                     g726                    mov                     pcm_s32be               sup
ast                     g726le                  mp2                     pcm_s32le               swf
au                      gif                     mp3                     pcm_s8                  tee
avi                     gsm                     mp4                     pcm_u16be               tg2
avm2                    gxf                     mpeg1system             pcm_u16le               tgp
avs2                    h261                    mpeg1vcd                pcm_u24be               truehd
bit                     h263                    mpeg1video              pcm_u24le               tta
caf                     h264                    mpeg2dvd                pcm_u32be               uncodedframecrc
cavsvideo               hash                    mpeg2svcd               pcm_u32le               vc1
codec2                  hds                     mpeg2video              pcm_u8                  vc1t
codec2raw               hevc                    mpeg2vob                pcm_vidc                voc
crc                     hls                     mpegts                  psp                     w64
dash                    ico                     mpjpeg                  rawvideo                wav
data                    ilbc                    mxf                     rm                      webm
daud                    image2                  mxf_d10                 roq                     webm_chunk
dirac                   image2pipe              mxf_opatom              rso                     webm_dash_manifest
dnxhd                   ipod                    null                    rtp                     webp
dts                     ircam                   nut                     rtp_mpegts              webvtt
dv                      ismv                    oga                     rtsp                    wtv
eac3                    ivf                     ogg                     sap                     wv
f4v                     jacosub                 ogv                     sbc                     yuv4mpegpipe
ffmetadata              kvag                    oma                     scc

Enabled protocols:
async                   file                    icecast                 rtmp                    tee
cache                   ftp                     md5                     rtmpt                   udp
concat                  gopher                  mmsh                    rtp                     udplite
crypto                  hls                     mmst                    srtp
data                    http                    pipe                    subfile
ffrtmphttp              httpproxy               prompeg                 tcp

Enabled filters:
abench                  atadenoise              ebur128                 maskedmerge             showwaves
abitscope               atempo                  edgedetect              maskedmin               showwavespic
acompressor             atrim                   elbg                    maskedthreshold         shuffleframes
acontrast               avectorscope            entropy                 maskfun                 shuffleplanes
acopy                   avgblur                 equalizer               mcompand                sidechaincompress
acrossfade              axcorrelate             erosion                 median                  sidechaingate
acrossover              bandpass                extractplanes           mergeplanes             sidedata
acrusher                bandreject              extrastereo             mestimate               sierpinski
acue                    bass                    fade                    metadata                signalstats
addroi                  bbox                    fftdnoiz                midequalizer            silencedetect
adeclick                bench                   fftfilt                 minterpolate            silenceremove
adeclip                 bilateral               field                   mix                     sinc
adelay                  biquad                  fieldhint               movie                   sine
aderivative             bitplanenoise           fieldmatch              negate                  smptebars
adrawgraph              blackdetect             fieldorder              nlmeans                 smptehdbars
aecho                   blend                   fifo                    noformat                sobel
aemphasis               bm3d                    fillborders             noise                   spectrumsynth
aeval                   bwdif                   firequalizer            normalize               split
aevalsrc                cas                     flanger                 null                    sr
afade                   cellauto                floodfill               nullsink                ssim
afftdn                  channelmap              format                  nullsrc                 stereotools
afftfilt                channelsplit            fps                     oscilloscope            stereowiden
afifo                   chorus                  framepack               overlay                 streamselect
afir                    chromahold              framerate               pad                     superequalizer
afirsrc                 chromakey               framestep               pal100bars              surround
aformat                 chromashift             freezedetect            pal75bars               swaprect
agate                   ciescope                freezeframes            palettegen              swapuv
agraphmonitor           codecview               gblur                   paletteuse              tblend
ahistogram              color                   geq                     perms                   telecine
aiir                    colorbalance            gradfun                 photosensitivity        testsrc
aintegral               colorchannelmixer       gradients               pixdesctest             testsrc2
ainterleave             colorhold               graphmonitor            pixscope                thistogram
alimiter                colorkey                greyedge                premultiply             threshold
allpass                 colorlevels             haas                    prewitt                 thumbnail
allrgb                  colorspace              haldclut                pseudocolor             tile
allyuv                  compand                 haldclutsrc             psnr                    tlut2
aloop                   compensationdelay       hdcd                    qp                      tmedian
alphaextract            concat                  headphone               random                  tmix
alphamerge              convolution             hflip                   readeia608              tonemap
amerge                  convolve                highpass                readvitc                tpad
ametadata               copy                    highshelf               realtime                transpose
amix                    crop                    hilbert                 remap                   treble
amovie                  crossfeed               histogram               removegrain             tremolo
amplify                 crystalizer             hqx                     removelogo              trim
amultiply               cue                     hstack                  replaygain              unpremultiply
anequalizer             curves                  hue                     reverse                 unsharp
anlmdn                  datascope               hwdownload              rgbashift               untile
anlms                   dblur                   hwmap                   rgbtestsrc              v360
anoisesrc               dcshift                 hwupload                roberts                 vectorscope
anull                   dctdnoiz                hysteresis              rotate                  vflip
anullsink               deband                  idet                    scale                   vfrdet
anullsrc                deblock                 il                      scale2ref               vibrance
apad                    decimate                inflate                 scdet                   vibrato
aperms                  deconvolve              interleave              scroll                  vignette
aphasemeter             dedot                   join                    select                  vmafmotion
aphaser                 deesser                 lagfun                  selectivecolor          volume
apulsator               deflate                 lenscorrection          sendcmd                 volumedetect
arealtime               deflicker               life                    separatefields          vstack
areverse                dejudder                limiter                 setdar                  w3fdif
arnndn                  derain                  loop                    setfield                waveform
aselect                 deshake                 loudnorm                setparams               weave
asendcmd                despill                 lowpass                 setpts                  xbr
asetnsamples            detelecine              lowshelf                setrange                xfade
asetpts                 dilation                lumakey                 setsar                  xmedian
asetrate                displace                lut                     settb                   xstack
asettb                  dnn_processing          lut1d                   showcqt                 yadif
ashowinfo               doubleweave             lut2                    showfreqs               yaepblur
asidedata               drawbox                 lut3d                   showinfo                yuvtestsrc
asoftclip               drawgraph               lutrgb                  showpalette             zoompan
asplit                  drawgrid                lutyuv                  showspatial
astats                  drmeter                 mandelbrot              showspectrum
astreamselect           dynaudnorm              maskedclamp             showspectrumpic
asubboost               earwax                  maskedmax               showvolume

Enabled bsfs:
aac_adtstoasc           extract_extradata       imx_dump_header         null                    vp9_metadata
av1_frame_merge         filter_units            mjpeg2jpeg              opus_metadata           vp9_raw_reorder
av1_frame_split         h264_metadata           mjpega_dump_header      pcm_rechunk             vp9_superframe
av1_metadata            h264_mp4toannexb        mov2textsub             prores_metadata         vp9_superframe_split
chomp                   h264_redundant_pps      mp3_header_decompress   remove_extradata
dca_core                hapqa_extract           mpeg2_metadata          text2movsub
dump_extradata          hevc_metadata           mpeg4_unpack_bframes    trace_headers
eac3_core               hevc_mp4toannexb        noise                   truehd_core

Enabled indevs:

Enabled outdevs:

License: LGPL version 2.1 or later

My suggestion would be to --disable-everything and configure the feature set from the bottom up. A barebones ffmpeg build can disable almost all features.

As for what should be included, here's my suggestion for a viable minimum:

  • File formats (demuxers, parsers):
    • mp4: m4v (same format, different name) and mov (very similar format) are included
    • matroska: mkv and webm
    • flv: Compatibility
  • Video formats (decoders):
    • H.264
    • H.265/HEVC
    • VP9: The YouTube format, widespread, currently being replaced by AV1
    • VP8: Not that important, but having VP8 + VP9 -> all WebM files will play
  • HW acceleration (hwaccel, sometimes format-specific):
    • macOS/iOS: Video Toolbox
    • Linux: VAAPI (Intel, AMD) + VDPAU (NVIDIA)
    • Windows: D3D11VA, maybe DXVA2 (compatibility with DX9, but worse decoder)
  • No muxers, encoders, protocols, filters, BSFs (not needed)

Let me know what you think, especially about the supported file and video formats.

@peppy
Copy link
Member

peppy commented Aug 21, 2023

This looks good to me.

@smoogipoo
Copy link
Contributor

Sounds fine. I think we also need to include the avi demuxer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants