ixlab / vidformer

https://ixlab.github.io/vidformer/
Apache License 2.0
2 stars 0 forks source link

macOS M2 already install ffmpeg 7.0 by homebrew, how to import ffi #2

Open phial3 opened 1 month ago

phial3 commented 1 month ago

platform: MacOS M2 ffmpeg: 7.0

how to build project:

image
dominikWin commented 1 month ago

I am not sure if homebrew includes the libav* libraries and header files. If it does then the env variables should be updated in config.toml to reflect the correct paths. There is also an issue stopping ffmpeg 7.0 from working, but I just pushed a fix for that so 6.x and 7.x should work just fine.

Can you either update the env variables (https://github.com/CCExtractor/rusty_ffmpeg has a guide for that) or try to compile ffmpeg 7.0 from scratch as done here?

dominikWin commented 1 month ago

Actually we require an extra header not exported by default in the built in filters, so the compile option is the only way this will work. Or you could use the docker image. I’ll see if I can fix that tomorrow

phial3 commented 1 month ago

Actually we require an extra header not exported by default in the built in filters, so the compile option is the only way this will work. Or you could use the docker image. I’ll see if I can fix that tomorrow

thank u, i try to compile it

dominikWin commented 1 month ago

I just pushed v0.5.0. This version no longer requires custom ffmpeg builds and should just pick up on system-installed ffmpeg on linux and macOS. At most you may have to point it at the right path (https://github.com/CCExtractor/rusty_ffmpeg has details). If you run into any issues with this version let me know!

phial3 commented 1 month ago

I just pushed v0.5.0. This version no longer requires custom ffmpeg builds and should just pick up on system-installed ffmpeg on linux and macOS. At most you may have to point it at the right path (https://github.com/CCExtractor/rusty_ffmpeg has details). If you run into any issues with this version let me know!

the latest vidformer execute cargo build error that, What additional parameters do I need to set? I will try to set following env, but it doesn't work.

export FFMPEG_BINDING_PATH=/opt/homebrew/opt/ffmpeg
export FFMPEG_DLL_PATH=/opt/homebrew/opt/ffmpeg/lib
export FFMPEG_LIBS_DIR=/opt/homebrew/opt/ffmpeg/lib
export FFMPEG_INCLUDE_DIR=/opt/homebrew/opt/ffmpeg/include
export FFMPEG_PKG_CONFIG_PATH=/opt/homebrew/opt/ffmpeg/lib/pkgconfig
error: failed to run custom build command for `rusty_ffmpeg v0.13.3+ffmpeg.6.1`

Caused by:
  process didn't exit successfully: `/Users/admin/code/rust/github.com/vidformer/target/debug/build/rusty_ffmpeg-4be1f48a8f8a7770/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=DOCS_RS
  cargo:rerun-if-env-changed=OUT_DIR
  cargo:rerun-if-env-changed=FFMPEG_INCLUDE_DIR
  cargo:rerun-if-env-changed=FFMPEG_DLL_PATH
  cargo:rerun-if-env-changed=FFMPEG_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=FFMPEG_LIBS_DIR
  cargo:rerun-if-env-changed=FFMPEG_BINDING_PATH
  cargo:rustc-link-lib=dylib=
  cargo:rustc-link-search=native=/opt/homebrew/opt/ffmpeg

  --- stderr
  thread 'main' panicked at /Users/admin/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/rusty_ffmpeg-0.13.3+ffmpeg.6.1/build.rs:190:24:
  Prebuilt binding file failed to be copied.: Error { kind: InvalidInput, message: "the source path is neither a regular file nor a symlink to a regular file" }
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
    Building [====================>    ] 222/263: opencv(build)
dominikWin commented 1 month ago

Hmm maybe don't set any environment variables and make sure you delete or remove the [env] section in .cargo/config.toml. I think that's what rusty_ffmpeg recommends on macOS. Then it's just a matter of making sure opencv builds.

phial3 commented 1 month ago

Hmm maybe don't set any environment variables and make sure you delete or remove the [env] section in .cargo/config.toml. I think that's what rusty_ffmpeg recommends on macOS. Then it's just a matter of making sure opencv builds.

cargo test error: error: library name must not be empty error: could not compile rusty_ffmpeg (lib) due to 1 previous error