FFmpeg-Builds icon indicating copy to clipboard operation
FFmpeg-Builds copied to clipboard

docker: command not found

Open newcapricasean opened this issue 1 year ago • 28 comments

Whether I try to run the compile script, myself, on either MSYS2, or Ubuntu, it gives me that error... Now, I've read in the readme file that I need to have both bash and docker... I thought bash was included in linux, but docker, I've got no experience with... Nothing I've ever compiled has needed that... So, can anyone share some insight on how I can compile, myself, using this script? Where do I get docker, and how do i set it up? Which OS should I use to do this? I'd prefer Windows, and inside MSYS2, if possible, but could use Fedora or Ubuntu, if I have to... I want to be able to compile my own FFMPEG, with the FDK AAC, audio encoder... Any help would be appreciated... I was trying the "ffmpeg-windows-build-helpers" before, without too much difficulty, but here lately, I cannot get that to work at all...

Thanks, in advance, for any help you might be able to give me...

newcapricasean avatar Jan 20 '24 22:01 newcapricasean

People had massive issues on non-Linux OS. But it should work fine on WSL. Docker Desktop works fine from inside WSL as well. Just download the installer and make sure to enable WSL mode during install.

BtbN avatar Jan 20 '24 22:01 BtbN

Is Docker Desktop a Windows application, or is it something to be installed inside of linux?

newcapricasean avatar Jan 20 '24 22:01 newcapricasean

Literally both, Docker only runs on Linux, so it always depends on a Linux VM, which is substituted by WSL in this case. But really, just run the installer, make sure that box is checked, and it should just work.

BtbN avatar Jan 20 '24 22:01 BtbN

Okay... So... Would it run better in a true linux environment, though? Fedora 39 runs very well, on my desktop...

newcapricasean avatar Jan 20 '24 22:01 newcapricasean

There is no notable difference in speed really. Maybe it'd be a few seconds faster on a baremetal Linux, but it's not really relevant.

BtbN avatar Jan 20 '24 22:01 BtbN

Okay... I wasn't really referring to compiling speed, but rather, likelihood of compile success, as well as, the actual quality of the compiled ffmpeg executable... Additionally, is there a way to put in "-march=znver3 -O3"

newcapricasean avatar Jan 20 '24 22:01 newcapricasean

It either works or it doesn't, there's no "compile quality". If you want custom cflags and build all packages with them, you'll need to modify the base image for the target arch, and modify the C/CXXFLAGS variable in there, then make fresh images.

BtbN avatar Jan 20 '24 22:01 BtbN

Use WSL-2 instead of Hyper-V?

newcapricasean avatar Jan 20 '24 22:01 newcapricasean

Not quite sure what you mean. WSL2 is a "Special Case" HyperV instance. If you mean the Docker Desktop installer, it has a checkbox somewhere to make it use WSL.

BtbN avatar Jan 20 '24 22:01 BtbN

Okay... So... Docker is installed... Now... If I go into the WSL Ubuntu linux, and run the script, it should work, automatically?

newcapricasean avatar Jan 20 '24 22:01 newcapricasean

It may be working, this time... It's in the build image stage... Figured I'd run it, first, without any kinds of modifications of flags... So, assuming I get it to, now, successfully compile the ffmpeg, can you give me a little more specific information about how to modify the scripts, or both scripts, to include "-march=znver3 -O3"?

newcapricasean avatar Jan 20 '24 22:01 newcapricasean

https://github.com/BtbN/FFmpeg-Builds/blob/master/images/base-win64/Dockerfile#L43 is where the CFLAGS for win64 builds are, and where you'll want to add your stuff. Then re-run makeimage.sh and build.sh.

BtbN avatar Jan 20 '24 22:01 BtbN

Thank you so much!!! If I see any errors, in the image build stage, should I be concerned?

"WARNING: local cache import at .cache/ghcr.io/btbn/ffmpeg-builds/base_latest not found due to err: could not read .cache/ghcr.io/btbn/ffmpeg-builds/base_latest/index.json: open .cache/ghcr.io/btbn/ffmpeg-builds/base_latest/index.json: no such file or directory

  • docker buildx --builder ffbuilder build --cache-from=type=local,src=.cache/ghcr.io/btbn/ffmpeg-builds/base-win64_latest --cache-to=type=local,mode=max,dest=.cache/ghcr.io/btbn/ffmpeg-builds/base-win64_latest --push --tag 127.0.0.1:64647/local/base-win64:latest --build-arg GH_REPO=127.0.0.1:64647/local images/base-win64"

newcapricasean avatar Jan 20 '24 22:01 newcapricasean

The warning is normal on the first build. There just is no cache when nothing was ever built before.

BtbN avatar Jan 20 '24 22:01 BtbN

I haven't paid attention, but, does your script download, compile, and use it's own compilers, rather than whatever is installed in the WSL or linux distribution? That way, it makes no difference what linux I am in, as to which version of compiler is used for the compiling... New or older, in OS, make no difference, if script uses it's own downloaded on, correct?

newcapricasean avatar Jan 20 '24 22:01 newcapricasean

It's docker. It really ONLY uses docker and bash from the host (and some other minor standard tools like sed maybe).

BtbN avatar Jan 20 '24 22:01 BtbN

So... Do I even need to have Ubuntu installed, in the WSL, to do this compile, with docker installed?

newcapricasean avatar Jan 20 '24 22:01 newcapricasean

You need something installed there, to run the scripts.

BtbN avatar Jan 20 '24 22:01 BtbN

Ah... Okay... So... What is the difference between build image & build ffmpeg??? What is the actual build image part doing, that differs from the build ffmpeg?

newcapricasean avatar Jan 20 '24 23:01 newcapricasean

So... The compile, to my elation, succeeded!!! So, now, I'm going to try compiling it, again, but this time, with cflags in it... Can you confirm that these lines would be correct, in my case???

CFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -march=znver3 -O3 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong" \
CXXFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -march=znver3 -O3 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong" \
LDFLAGS="-static-libgcc -static-libstdc++ -L/opt/ffbuild/lib -march=znver3 -O3 -pipe -fstack-protector-strong" \

newcapricasean avatar Jan 20 '24 23:01 newcapricasean

-O3 on a global level is dangerous and known to break some stuff. Just -march is plenty.

BtbN avatar Jan 20 '24 23:01 BtbN

So...

CFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -march=znver3 -O2 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong"
CXXFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -march=znver3 -O2 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong"
LDFLAGS="-static-libgcc -static-libstdc++ -L/opt/ffbuild/lib -march=znver3 -O2 -pipe -fstack-protector-strong" \

newcapricasean avatar Jan 20 '24 23:01 newcapricasean

And, by chance... Does this ffmpeg script apply those flags to all component compiles of ffmpeg? I believe the windows ffmpeg build helpers script did not do that...

newcapricasean avatar Jan 20 '24 23:01 newcapricasean

You're putting in that early in the process specifically so the entire dependency tree is built with it, yes.

BtbN avatar Jan 20 '24 23:01 BtbN

WOW!!!

newcapricasean avatar Jan 20 '24 23:01 newcapricasean

Does your script build FFMPEG with x265's 10 and 12 bit color depth options?

newcapricasean avatar Jan 21 '24 00:01 newcapricasean

ERROR: failed to solve: process "/bin/sh -c run_stage /stage.sh" did not complete successfully: exit code: 2

  • rm -f /tmp/tmp.xfpM47QUck.toml

newcapricasean avatar Jan 21 '24 00:01 newcapricasean

That's not the actual error, you'll need to scroll up a bit. Likely one of the dependencies does not take kindly to what should be a simple extra flag. There is no simple solution to that sadly.

BtbN avatar Jan 21 '24 20:01 BtbN