jellyfin / jellyfin-ffmpeg

FFmpeg for Jellyfin
https://jellyfin.org
Other
436 stars 118 forks source link

Road to macOS builds #339

Closed gnattu closed 4 months ago

gnattu commented 4 months ago

I succesfully made a statically linked jellyfin-ffmpeg on macOS:

image

To support building this on our CI, significant changes need to be made to our builder. I will note the observations during my build process here.

First, macOS targets do not use Docker and cross-compiling; they compile for the native target. To accommodate this, we will need:

Additionally, macOS needs special handling on dependencies:

For all build scripts, we have to also take care of the differences between BSD tools and the GNU tools. Common tools like tar and sed will work differently. Specifically for macOS, the GNU binutils does not support macOS target, so ar need to be replaced with libtool on macOS.

nyanmisaka commented 4 months ago

Take your own pace. The full build script is not necessary for the 10.9 release, just the built binaries. AFAIK Anthonylavado is responsible for packaging Jellyfin Server on MacOS. You can talk to him about how to ship our FFmpeg fork.

And here's our latest release schedule.

AbandonedCart commented 4 months ago

The full build script is not necessary for the 10.9 release, just the built binaries.

If I might make a request that you enable Chromaprint if you are going to do that. It may not matter much to the code Jellyfin experience, but it creates an absolute mess trying to reroute the ffmpeg. The packaged version has a meltdown when you try to change it and there is virtually no documentation for the commandline version. I only managed to do it through a string of forum comments and over-engineering what would have been a simple --enable-chromaprint in the original build.

gnattu commented 4 months ago

Current ffmpeg shipped with Jellyfin macOS is not our custom build and Chromaprint will be enabled in our builds in the following 10.9 version.

AbandonedCart commented 4 months ago

If I remember right, your current version is from https://evermeet.cx/ffmpeg/

AbandonedCart commented 4 months ago

It still requires installing the "click" dependency to run, but that can be solved with brew install click

gnattu commented 4 months ago

Why it requires click? We are not using it anywhere

AbandonedCart commented 4 months ago

@gnattu If you submitted it and you don't know, imagine how surprising it is as a user to download a "portable" binary and it fails saying no module found for click.

gnattu commented 4 months ago

I manually check for EVERY binary it generates with otool and it does not link to anything other than the macOS built-ins. Click is not our dependency, and if it appears to yours, can I ask you sharing what otool -L ffmpeg and ffmpeg -version outputs?

image
gnattu commented 4 months ago

Click is not even installed on my machine:

image

Are you really using our build of ffmpeg or you are just getting a random build from "somewhere"?

AbandonedCart commented 4 months ago

@gnattu https://github.com/jellyfin/jellyfin-ffmpeg/actions/runs/8180064861/artifacts/1304265869

otool -L ffmpeg

ffmpeg:
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1953.255.0)
    /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 1000.0.0)
    /System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
    /System/Library/Frameworks/AVFoundation.framework/Versions/A/AVFoundation (compatibility version 1.0.0, current version 2.0.0)
    /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.5.0)
    /System/Library/Frameworks/CoreMedia.framework/Versions/A/CoreMedia (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1690.3.3)
    /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 61.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1953.255.0)
    /usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
    /usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 70.1.0)
    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2299.30.112)
    /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 169.0.0)
    /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.8)
    /System/Library/Frameworks/Metal.framework/Versions/A/Metal (compatibility version 1.0.0, current version 306.3.4)
    /System/Library/Frameworks/VideoToolbox.framework/Versions/A/VideoToolbox (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.36.0)
    /System/Library/Frameworks/CoreImage.framework/Versions/A/CoreImage (compatibility version 1.0.1, current version 5.0.0)
    /System/Library/Frameworks/OpenCL.framework/Versions/A/OpenCL (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1228.0.0)
    /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

ffmpeg -version

ffmpeg version 6.0.1-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
built with Apple clang version 14.0.0 (clang-1400.0.29.202)
configuration: --prefix=/ffbuild/prefix --disable-shared --enable-static --pkg-config-flags=--static --enable-pthreads --cc=clang --host-cflags='-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/opt/ffbuild/prefix/include' --host-ldflags='-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -L/opt/ffbuild/prefix/lib' --extra-version=Jellyfin --extra-cflags=-I/opt/ffbuild/prefix/include --extra-cxxflags= --extra-ldflags=-L/opt/ffbuild/prefix/lib --extra-ldexeflags= --extra-libs= --enable-gpl --enable-version3 --enable-lto --disable-ffplay --disable-debug --disable-doc --disable-ptx-compression --disable-sdl2 --disable-libjack --disable-indev=jack --enable-neon --enable-runtime-cpudetect --enable-audiotoolbox --enable-videotoolbox --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-openssl --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-amf --enable-chromaprint --enable-libdav1d --disable-libfdk-aac --disable-ffnvcodec --disable-cuda --disable-cuda-llvm --disable-cuvid --disable-nvdec --disable-nvenc --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-libopenmpt --enable-libsrt --enable-libsvtav1 --enable-libx264 --enable-libx265 --enable-libzimg --enable-libzvbi
libavutil      58.  2.100 / 58.  2.100
libavcodec     60.  3.100 / 60.  3.100
libavformat    60.  3.100 / 60.  3.100
libavdevice    60.  1.100 / 60.  1.100
libavfilter     9.  3.100 /  9.  3.100
libswscale      7.  1.100 /  7.  1.100
libswresample   4. 10.100 /  4. 10.100
libpostproc    57.  1.100 / 57.  1.100

Are you really using our build of ffmpeg or you are just getting a random build from "somewhere"?

I can't tell you why it happened, but I don't entirely appreciate the accusation.

gnattu commented 4 months ago

It does not link to "click" and runs fine without it(mine does not, and it runs).

Which macOS version are you on? And what will it tell you when you removed the "click" from homebrew?

AbandonedCart commented 4 months ago

If nobody else reports it, then call it a fluke. Mine works now and it's really not worth the aggression.

gnattu commented 4 months ago

If nobody else reports it, then call it a fluke.

It is not a "fluke". I test the portability in clean VMs (nothing is installed via Homebrew) and ensure it runs. I have a very high level of confidence that it would work for most of the intended environments. I even tested the binary you pointed to with a new macOS 12 VM, and it runs as expected. If it breaks in a certain environment, then we need to investigate what's unique about that environment because it should work on a brand new Mac.

it's really not worth the aggression. I can't tell you why it happened, but I don't entirely appreciate the accusation.

If you believe that asking questions implies accusation and aggression, I'd like to clarify why I asked those questions in the first place.

Click is a command-line utility for managing Kubernetes clusters, and it has no connection to our ffmpeg. Therefore, it doesn't make sense for any part of ffmpeg to rely on it. The only logical explanation, in my opinion, would be that the user is using the wrong binary. That's why I asked you to confirm that the binary you tested is the one provided by us.

After confirming that you are indeed using a binary from us, which is good, the unexpected behavior prompted me to ask additional questions about your environment and request the error message when click is not installed. However, you refused to answer questions and dismissed my work as a "fluke" and call my questions "aggression."

If you feel that my questions came across as aggressive accusations, I apologize for any misunderstanding. Perhaps I could have explained my intentions better. However, I also want to express that I didn't appreciate the way you responded to my inquiries.

nyanmisaka commented 4 months ago

To be fair, one should not be too picky about a daily build that is being introduced for the first time and has not yet been released. There may be subsequent fixes and improvements in the Release Candidate phase.

If someone encounters an issue but cannot wait for the developer to fix it immediately, then he should spend his own time looking into it and even open a PR. This is the essence of open source.

AbandonedCart commented 4 months ago

To be fair, one should not be too picky about a daily build that is being introduced for the first time and has not yet been released. There may be subsequent fixes and improvements in the Release Candidate phase.

If someone encounters an issue but cannot wait for the developer to fix it immediately, then he should spend his own time looking into it and even open a PR. This is the essence of open source.

That is true, but also not relevant to the situation. In reality, I made a passing comment that it was still asking for click and included the command used to install it. After I was told I was using the wrong binary and it was asserted multiple times that it was impossible, I said to write it off as a fluke.

If you feel that my questions came across as aggressive accusations, I apologize for any misunderstanding. Perhaps I could have explained my intentions better. However, I also want to express that I didn't appreciate the way you responded to my inquiries.

I don't really understand how being just as surprised as you were and providing log output offended you, but I apologize it did.

After confirming that you are indeed using a binary from us, which is good, the unexpected behavior prompted me to ask additional questions about your environment and request the error message when click is not installed. However, you refused to answer questions and dismissed my work as a "fluke" and call my questions "aggression."

I called the situation a fluke. Perhaps that misunderstanding is why your posts come off aggressive.

AbandonedCart commented 4 months ago

I don't know why it asked for click. Installing click fixed it. It kept working after it was uninstalled. Seems to be the literal definition of a fluke, but you could also call it a coincidence if you like. I marked the comments resolved. Best of luck.

gnattu commented 4 months ago

It kept working after it was uninstalled.

Glad to hear that.

Seems to be the literal definition of a fluke, but you could also call it a coincidence if you like.

Seems to be the case. No idea what is asking for a Kubernetes management tool. It's akin to saying an aircraft requires an anchor to fly. If it's referring to python-click, then it makes more sense, as some Python scripts require it to provide a command-line interface. There could be a chance that a Python script is invoked accidentally but for only once.

AbandonedCart commented 4 months ago

It is python-click that it needed. Installing the wrong one probably fixed a broken link after switching Homebrew Python to official. Seems as good an explanation as any.