BtbN / FFmpeg-Builds

MIT License
6.97k stars 956 forks source link

Build a tiny FFmpeg #385

Open Aleksid1 opened 2 weeks ago

Aleksid1 commented 2 weeks ago

I need to build a tiny shared FFmpeg. I removed many .sh files in /scripts.d/ directory with unused libs for my app. However it ignores my changes and build a heavy FFmpeg as with all default libs included in gpl-shared variant. What am I doing wrong?

BtbN commented 2 weeks ago

You probably forgot to build a new image. If you only run build.sh, it'll download the latest image from github with everything in it.

Aleksid1 commented 2 weeks ago

Many thanks for your quick response and great support! You're right. I'll try tomorrow.

BtbN commented 2 weeks ago

If you only modified scripts, and not the core-image, you can also export QUICKBUILD=1 before making the new image. It'll download the base images from github then, and only build your local scripts.

Aleksid1 commented 1 week ago

Thanks for the advice with export QUICKBUILD=1 I added this line to my .sh script before the makeimage command. Is there a way to determine which lib from the /scripts.d directory is required? I removed about 30 libs to build tiny FFmpeg. And when I tried to create a new image, I was missing freetype, then libvmaf, etc.

BtbN commented 1 week ago

Nothing from there is strictly required, except for maybe the very basic mingw stuff at the lowest numbers. There are complex inter-dependencies though, and if you remove something from a number below 50, you can expect something from a higher number to fail. FFmpeg itself will happily build without any of it though.

Aleksid1 commented 1 week ago

I tried to build an image for original scripts (not modified) and got this error:

=> [layer-50-libjxl 2/3] RUN --mount=src=scripts.d/50-libjxl/45-lcms2.sh,dst=/stage.sh --mount=src=.cache/dow  1043.6s
WARNING: local cache import at .cache/ghcr.io/btbn/ffmpeg-builds/win64-lgpl-shared-6.1_latest not found due to err: could not read .cache/ghcr.io/btbn/ffmpeg-builds/win64-lgpl-shared-6.1_latest/index.json: open .cache/ghcr.io/btbn/ffmpeg-builds/win64-lgpl-shared-6.1_latest/index.json: no such file or directory
ERROR: failed to receive status: rpc error: code = Unavailable desc = error reading from server: EOF
+ rm -f /tmp/tmp.lVHpIarWvU.toml

export QUICKBUILD=1 ./makeimage.sh win64 lgpl-shared 6.1

FFmpeg-Builds-latest.zip was downloaded on June 13rd.

Ubuntu 24.04 on WSL2

Aleksid1 commented 1 week ago

I tried to makeimage without any changes in your scripts. Regrettably it fails:

" => [layer-50-onevpl 1/1] RUN --mount=src=scripts.d/50-onevpl.sh,dst=/stage.sh --mount=src=.cache/downloads/50  1469.8s
 => [layer-50-openh264 1/1] RUN --mount=src=scripts.d/50-openh264.sh,dst=/stage.sh --mount=src=.cache/download  1442.7s
WARNING: local cache import at .cache/ghcr.io/btbn/ffmpeg-builds/win64-lgpl-shared-6.1_latest not found due to err: could not read .cache/ghcr.io/btbn/ffmpeg-builds/win64-lgpl-shared-6.1_latest/index.json: open .cache/ghcr.io/btbn/ffmpeg-builds/win64-lgpl-shared-6.1_latest/index.json: no such file or directory
ERROR: failed to receive status: rpc error: code = Unavailable desc = error reading from server: EOF
+ rm -f /tmp/tmp.9tO2rq6t60.toml"
docker builder prune --all
git clone https://github.com/BtbN/FFmpeg-Builds.git
cd FFmpeg-Builds
export QUICKBUILD=1
./makeimage.sh win64 lgpl-shared 6.1

WSL2 / Ubuntu 24.04

BtbN commented 1 week ago

That looks to me like a network issue or temporary outage of something. It should not be talking to Github at that point, so probably some internal issue of Docker? Make sure your docker installation is intact and up to date.

Aleksid1 commented 1 week ago

Thanks for your support! I recently downloaded Docker for WSL2 from Microsoft Store. I'll try with native Ubuntu without WSL2.

BtbN commented 1 week ago

I never used the store version. I usually just install docker proper on WSL these days, since that works just fine if systemd is enabled.

Aleksid1 commented 1 week ago

I reinstalled Ubuntu 24.04 on WSL2 and installed docker from the console (not Docker Desktop). The same problem. Is it possible to disable use of cache for docker in your script?

BtbN commented 1 week ago

It has nothing to do with any caching. The cache warning is normal if there is no cache yet. Building works perfectly fine for me, so I have no idea what causes this for you.