roc-toolkit icon indicating copy to clipboard operation
roc-toolkit copied to clipboard

Add FFmpeg to build scripts

Open gavv opened this issue 1 year ago • 1 comments

This issue will allow us to implement #568.

We need to modify build scripts (scons and build-3rdparty.py) to support using FFmpeg from system or automatically building it.

Steps:

  • teach build-3rdparty.py to build ffmpeg

  • add ffmpeg to https://github.com/roc-streaming/dockerfiles (so that ffmpeg will be pre-installed in docker images on CI)

  • add ffmpeg to https://github.com/roc-streaming/distfiles/tree/main/tarballs (so that ffmpeg will be pre-fetched on CI)

  • add --disable-ffmpeg to SConstruct (like --disable-sox)

  • in SConstruct, automatically append target_ffmpeg to ROC_TARGETS if --disable-ffmpeg is not provided (like we do it for target_sox)

  • in 3rdparty/SConscript, check whether ffmpeg is available on system (like we do it in if 'target_sox' in system_dependencies branch for sox)

  • in 3rdparty/SConscript, download and build ffmpeg if it's present in --build-3rdparty option (like we do it in if 'target_sox' in autobuild_dependencies branch for sox)

  • update scripts/ci_checks: for build where ffmpeg is not pre-installed, and for cross-compilation, add ffmpeg to --build-3rdparty (like we do it for sox)

  • add ffmpeg to dependencies.rst

We recently did very similar work for OpenSSL. Here are related commits:

  • https://github.com/roc-streaming/dockerfiles/commit/ce06fa973fbd857d172f7f522d2fdc052e942aec
  • https://github.com/roc-streaming/distfiles/commit/5ec3d6fa00bcba601056cc9e1732da8782dc860e
  • https://github.com/roc-streaming/roc-toolkit/pull/490/commits/808b126f111a5ce376831cac583dfb80fb9b97dc (ignore openssl_get_platform part; this is specific to OpenSSL and not needed for FFmpeg)

And here is related documentation:

  • https://roc-streaming.org/toolkit/docs/development/continuous_integration.html
  • https://roc-streaming.org/toolkit/docs/building/developer_cookbook.html
  • https://roc-streaming.org/toolkit/docs/portability/cross_compiling.html

gavv avatar Sep 28 '23 13:09 gavv

Here are configure options to build FFmpeg in build-3rdparty.py. These options will give us minimal FFmpeg build with all dependencies disabled.

      --disable-alsa
      --disable-amf
      --disable-asm
      --disable-avdevice
      --disable-avfilter
      --disable-bzlib
      --disable-cuda-llvm
      --disable-cuvid
      --disable-dct
      --disable-doc
      --disable-dwt
      --disable-error-resilience
      --disable-faan
      --disable-ffnvcodec
      --disable-fft
      --disable-iconv
      --disable-libmp3lame
      --disable-libxcb
      --disable-lsp
      --disable-lzma
      --disable-mdct
      --disable-network
      --disable-nvdec
      --disable-nvenc
      --disable-pixelutils
      --disable-postproc
      --disable-programs
      --disable-rdft
      --disable-schannel
      --disable-sdl2
      --disable-securetransport
      --disable-sndio
      --disable-static
      --disable-stripping
      --disable-swscale
      --disable-v4l2-m2m
      --disable-vaapi
      --disable-vdpau
      --disable-videotoolbox
      --disable-vulkan
      --disable-x86asm
      --disable-xlib
      --disable-zlib

gavv avatar Sep 28 '23 13:09 gavv