SavageCore / node-ffprobe-installer

Platform independent binary installer of FFprobe for node projects
https://www.npmjs.com/package/@ffprobe-installer/ffprobe
73 stars 29 forks source link

Update darwin-arm64 platform, version 4.4.1 #200

Closed wongyiuhang closed 2 years ago

wongyiuhang commented 2 years ago

I recompiled the ffprobe from FFmpeg with Apple Silicon. The reason I recompile the executable, is that the current executable is not a standalone executable.

  1. It's only 279KB size
  2. When it was run, it prompts for loading another library
    dyld[39699]: Library not loaded: /opt/homebrew/Cellar/ffmpeg/4.4_1/lib/libavdevice.58.dylib
    Referenced from: /***/node-ffprobe-installer/platforms/darwin-arm64/ffprobe
    Reason: tried: '/opt/homebrew/Cellar/ffmpeg/4.4_1/lib/libavdevice.58.dylib' (no such file), '/usr/local/lib/libavdevice.58.dylib' (no such file), '/usr/lib/libavdevice.58.dylib' (no such file)
    zsh: abort      ./ffprobe

Resolves #199

Kikobeats commented 2 years ago

Thanks a lot!

MohamedBakoush commented 2 years ago

The error stated above

dyld[39699]: Library not loaded: /opt/homebrew/Cellar/ffmpeg/4.4_1/lib/libavdevice.58.dylib
  Referenced from: /***/node-ffprobe-installer/platforms/darwin-arm64/ffprobe
  Reason: tried: '/opt/homebrew/Cellar/ffmpeg/4.4_1/lib/libavdevice.58.dylib' (no such file), '/usr/local/lib/libavdevice.58.dylib' (no such file), '/usr/lib/libavdevice.58.dylib' (no such file)
zsh: abort      ./ffprobe

is the same error i received

dyld[47947]: Library not loaded: /opt/homebrew/Cellar/ffmpeg/4.4.1_3/lib/libavdevice.58.dylib

Referenced from: /Users/mohamedbakoush/Documents/GitHub/WatchVideoByLink/node_modules/@ffprobe-installer/darwin-arm64/ffprobe
Reason: tried: '/opt/homebrew/Cellar/ffmpeg/4.4.1_3/lib/libavdevice.58.dylib' (no such file), '/usr/local/lib/libavdevice.58.dylib' (no such file), '/usr/lib/libavdevice.58.dylib' (no such file)

both have a missing libavdevice.58.dylib file, the only difference is ffprobe version.

The problem is Homebrew while an easy way to compile FFmpeg files, sadly they are not static. Static means you can copy the FFmpeg files anywhere you want. It has no dependencies compared to a dynamically build like Homebrew does.

This error is bound to happen, if Homebrew FFmpeg isn't installed or if Homebrew FFmpeg doesn't match SavageCore/node-ffprobe-installer ffprobe version number.

Last time i checked brew install ffmpeg provides ffprobe version 4.4.1_5, while this repo provides version 4.4.1_3, seems insignificant, but makes the difference between getting /opt/homebrew/Cellar/ffmpeg/4.4.1_3/lib/libavdevice.58.dylib, vs /opt/homebrew/Cellar/ffmpeg/4.4.1_5/lib/libavdevice.58.dylib

I believe the only way to fix this problem is to build a real static FFprobe file.

wongyiuhang commented 2 years ago

As of writing, the pull request has just merged this week. The update has yet been pushed to NPM. The latest NPM version (1.3.0) was published on Dec 13, 2021.

May I confirm the SHA1 hash of your current ffprobe file? It should be 6772ae035b33e9e6a27b0de1338e33f0d583500e

Also, you may download the newly merged version (ffprobe).

MohamedBakoush commented 2 years ago

Yesterday when testing i had a missing libavdevice.58.dylib file, While today It seems i was playing around with the wrong version, either way ffprobe 6772ae035b33e9e6a27b0de1338e33f0d583500e works great

Works great if brew install ffpmeg or brew uninstall ffmpeg gets executed

Only problem is if Homebrew gets uninstall or if brew install ffpmeg has never been executed prior

Error

dyld[89086]: Library not loaded: /opt/homebrew/opt/libxcb/lib/libxcb.1.dylib
  Referenced from: /Users/mohamedbakoush/Documents/GitHub/node-ffprobe-installer/platforms/darwin-arm64/ffprobe
  Reason: tried: '/opt/homebrew/opt/libxcb/lib/libxcb.1.dylib' (no such file), '/usr/local/lib/libxcb.1.dylib' (no such file), '/usr/lib/libxcb.1.dylib' (no such file)

Either way great job.

wongyiuhang commented 2 years ago

I've just recompiled ffprobe again, with removing libxcb dependency.

I've tested the combiled ffprobe on my machine. @MohamedBakoush, before I create a pull request, may you help to test if it works without libxcb?😬

MohamedBakoush commented 2 years ago

384491447b76b483cfd32c99e9f6327f201e19a3 - Works no prob, no longer reliant on Homebrew 🎉

Also when i replaced node_modules/@ffprobe-installer/darwin-arm64 ffprobe 1dd6aab8b1880c44cc98db96f950634ad701848a with 384491447b76b483cfd32c99e9f6327f201e19a3 - Got 4 tests passed when npm test

Great job

JuanIrache commented 2 years ago

Thank you for this @wongyiuhang

Do you plan to provide builds for the latest Git master of ffprobe? I'm asking specifically because release versions still have a bug where rotation cannot be extracted, but also because there does not seem to be a source for reliable static builds, currently.

wongyiuhang commented 2 years ago

@JuanIrache, I am open to re-compile the ffprobe, as long as it fixes bugs.

I have had a quick look for the bug. If the bug exists in all architecture platform (which I believe it is, but correct me if I'm wrong), we shall create a new Pull Request, and ask @SavageCore and other maintainers to update all builds.

With git build newer than Feb 3rd 2022, you can use

ffprobe -v 0 -select_streams v:0 -show_entries stream_side_data=rotation -of default=nw=1:nk=1 input.mp4

If it's correct, we could build 4.4.2, 5.0.1 or other versions, as long as they are released after Feb 3, 2022. We may need to have an agreement whether to upgrade to 5.0.1, or maintaining in 4.4.x version. I have not had look into the difference between version 4.4.2 and 5.0.1.🙈

JuanIrache commented 2 years ago

After commenting, I found this great guide you wrote for compiling the binary, which worked wonderfully for building the latest master for my use case. But I generally prefer to rely on builds by more experienced compilers, which often also means they are tested by more users, etc.

The reason for the original question on StackOverflow, was that the previously common method for reading rotation data had been deprecated, but the new one was not working, so I believe the rebuild would be necessary, at least if you need to use the currently accepted method.

SavageCore commented 1 year ago

Sorry, I'm just seeing these now. @wongyiuhang I like to keep up to date with the git master so whenever you feel like providing new binaries, please do!

@all-contributors please add @wongyiuhang for code

allcontributors[bot] commented 1 year ago

@SavageCore

I've put up a pull request to add @wongyiuhang! :tada:

wongyiuhang commented 1 year ago

@JuanIrache, a pull request with ffprobe (5.1.2) has been made.

May you have a try if it extracts rotation? Thank you.