BtbN / FFmpeg-Builds

MIT License
6.99k stars 958 forks source link

docker: command not found #336

Closed newcapricasean closed 3 months ago

newcapricasean commented 5 months ago

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...

BtbN commented 5 months ago

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.

newcapricasean commented 5 months ago

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

BtbN commented 5 months ago

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.

newcapricasean commented 5 months ago

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

BtbN commented 5 months ago

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.

newcapricasean commented 5 months ago

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"

BtbN commented 5 months ago

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.

newcapricasean commented 5 months ago

Use WSL-2 instead of Hyper-V?

BtbN commented 5 months ago

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.

newcapricasean commented 5 months ago

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

newcapricasean commented 5 months ago

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"?

BtbN commented 5 months ago

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.

newcapricasean commented 5 months ago

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

BtbN commented 5 months ago

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

newcapricasean commented 5 months ago

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?

BtbN commented 5 months ago

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

newcapricasean commented 5 months ago

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

BtbN commented 5 months ago

You need something installed there, to run the scripts.

newcapricasean commented 5 months ago

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 commented 5 months ago

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" \
BtbN commented 5 months ago

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

newcapricasean commented 5 months ago

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 commented 5 months ago

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...

BtbN commented 5 months ago

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

newcapricasean commented 5 months ago

WOW!!!

newcapricasean commented 5 months ago

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

newcapricasean commented 5 months ago

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

BtbN commented 5 months ago

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.