From a6a8363527d5853612e56b18841aed71f9ddb44a Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 20 Feb 2025 03:15:54 +0400 Subject: [PATCH] Self-build ffmpeg in snap for lesser package size --- snap/snapcraft.yaml | 184 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 162 insertions(+), 22 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 90ac781f16..8073f1adf5 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -39,7 +39,7 @@ parts: cmake-generator: Ninja cmake-parameters: - -DCMAKE_BUILD_TYPE=Release - - -DCMAKE_INSTALL_PREFIX=/usr + - -DCMAKE_INSTALL_PREFIX=/ - -DTDESKTOP_API_ID=611335 - -DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c override-pull: | @@ -85,8 +85,10 @@ parts: build-packages: - clang - gperf + - nasm - libavif-dev - libboost-regex-dev + - libdav1d-dev - libheif-dev - libhwy-dev - libjxl-dev @@ -95,6 +97,7 @@ parts: - libopus-dev - libpipewire-0.3-dev - libssl-dev + - libvdpau-dev - libvpx-dev - libxcb-cursor-dev - libxcb-glx0-dev @@ -111,6 +114,7 @@ parts: - libxcb-xfixes0-dev - libxcb-xkb-dev - libxkbcommon-x11-dev + - libxv-dev stage-packages: - libavif16 - libopenal1 @@ -152,27 +156,153 @@ parts: prime: [-./*] ffmpeg: - plugin: nil - build-packages: - - libavcodec-dev - - libavfilter-dev - - libavformat-dev - - libavutil-dev - - libswresample-dev - - libswscale-dev - stage-packages: - - libavcodec60 - - libavfilter9 - - libavformat60 - - libavutil58 - - libswresample4 - - libswscale7 - override-build: | - craftctl default - mv "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/blas/"* "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR" - rmdir "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/blas" - mv "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/lapack/"* "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR" - rmdir "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/lapack" + source: https://github.com/FFmpeg/FFmpeg.git + source-depth: 1 + source-branch: n6.1.1 + plugin: autotools + build-environment: + - LDFLAGS: ${LDFLAGS:+$LDFLAGS} -s + autotools-configure-parameters: + - --prefix=/usr + - --libdir=/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR + - --extra-cflags="-DCONFIG_SAFE_BITSTREAM_READER=1" + - --extra-cxxflags="-DCONFIG_SAFE_BITSTREAM_READER=1" + - --disable-debug + - --disable-programs + - --disable-doc + - --disable-network + - --disable-autodetect + - --disable-everything + - --enable-libdav1d + - --enable-libopenh264 + - --enable-libopus + - --enable-libvpx + - --enable-vaapi + - --enable-vdpau + - --enable-xlib + - --enable-libdrm + - --enable-ffnvcodec + - --enable-nvdec + - --enable-cuvid + - --enable-protocol=file + - --enable-hwaccel=av1_vaapi + - --enable-hwaccel=av1_nvdec + - --enable-hwaccel=h264_vaapi + - --enable-hwaccel=h264_vdpau + - --enable-hwaccel=h264_nvdec + - --enable-hwaccel=hevc_vaapi + - --enable-hwaccel=hevc_vdpau + - --enable-hwaccel=hevc_nvdec + - --enable-hwaccel=mpeg2_vaapi + - --enable-hwaccel=mpeg2_vdpau + - --enable-hwaccel=mpeg2_nvdec + - --enable-hwaccel=mpeg4_vaapi + - --enable-hwaccel=mpeg4_vdpau + - --enable-hwaccel=mpeg4_nvdec + - --enable-hwaccel=vp8_vaapi + - --enable-hwaccel=vp8_nvdec + - --enable-decoder=aac + - --enable-decoder=aac_fixed + - --enable-decoder=aac_latm + - --enable-decoder=aasc + - --enable-decoder=ac3 + - --enable-decoder=alac + - --enable-decoder=av1 + - --enable-decoder=av1_cuvid + - --enable-decoder=eac3 + - --enable-decoder=flac + - --enable-decoder=gif + - --enable-decoder=h264 + - --enable-decoder=hevc + - --enable-decoder=libdav1d + - --enable-decoder=libvpx_vp8 + - --enable-decoder=libvpx_vp9 + - --enable-decoder=mp1 + - --enable-decoder=mp1float + - --enable-decoder=mp2 + - --enable-decoder=mp2float + - --enable-decoder=mp3 + - --enable-decoder=mp3adu + - --enable-decoder=mp3adufloat + - --enable-decoder=mp3float + - --enable-decoder=mp3on4 + - --enable-decoder=mp3on4float + - --enable-decoder=mpeg4 + - --enable-decoder=msmpeg4v2 + - --enable-decoder=msmpeg4v3 + - --enable-decoder=opus + - --enable-decoder=pcm_alaw + - --enable-decoder=pcm_f32be + - --enable-decoder=pcm_f32le + - --enable-decoder=pcm_f64be + - --enable-decoder=pcm_f64le + - --enable-decoder=pcm_lxf + - --enable-decoder=pcm_mulaw + - --enable-decoder=pcm_s16be + - --enable-decoder=pcm_s16be_planar + - --enable-decoder=pcm_s16le + - --enable-decoder=pcm_s16le_planar + - --enable-decoder=pcm_s24be + - --enable-decoder=pcm_s24daud + - --enable-decoder=pcm_s24le + - --enable-decoder=pcm_s24le_planar + - --enable-decoder=pcm_s32be + - --enable-decoder=pcm_s32le + - --enable-decoder=pcm_s32le_planar + - --enable-decoder=pcm_s64be + - --enable-decoder=pcm_s64le + - --enable-decoder=pcm_s8 + - --enable-decoder=pcm_s8_planar + - --enable-decoder=pcm_u16be + - --enable-decoder=pcm_u16le + - --enable-decoder=pcm_u24be + - --enable-decoder=pcm_u24le + - --enable-decoder=pcm_u32be + - --enable-decoder=pcm_u32le + - --enable-decoder=pcm_u8 + - --enable-decoder=pcm_zork + - --enable-decoder=vorbis + - --enable-decoder=vp8 + - --enable-decoder=wavpack + - --enable-decoder=wmalossless + - --enable-decoder=wmapro + - --enable-decoder=wmav1 + - --enable-decoder=wmav2 + - --enable-decoder=wmavoice + - --enable-encoder=aac + - --enable-encoder=libopenh264 + - --enable-encoder=libopus + - --enable-encoder=pcm_s16le + - --enable-filter=atempo + - --enable-parser=aac + - --enable-parser=aac_latm + - --enable-parser=flac + - --enable-parser=gif + - --enable-parser=h264 + - --enable-parser=hevc + - --enable-parser=mpeg4video + - --enable-parser=mpegaudio + - --enable-parser=opus + - --enable-parser=vorbis + - --enable-demuxer=aac + - --enable-demuxer=flac + - --enable-demuxer=gif + - --enable-demuxer=h264 + - --enable-demuxer=hevc + - --enable-demuxer=matroska + - --enable-demuxer=m4v + - --enable-demuxer=mov + - --enable-demuxer=mp3 + - --enable-demuxer=ogg + - --enable-demuxer=wav + - --enable-muxer=mp4 + - --enable-muxer=ogg + - --enable-muxer=opus + - --enable-muxer=wav + prime: [-./*] + after: + - nv-codec-headers + - pkgs geoclue: plugin: nil @@ -219,6 +349,16 @@ parts: - ./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libjpeg.a prime: [-./*] + nv-codec-headers: + source: https://github.com/FFmpeg/nv-codec-headers.git + source-depth: 1 + source-branch: n12.1.14.0 + plugin: make + make-parameters: + - PREFIX=/usr + - LIBDIR=lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR + prime: [-./*] + protobuf: source: https://github.com/protocolbuffers/protobuf.git source-depth: 1