Open sujaymansingh opened 11 months ago
I have encountered the same problem, have you solved it?
I have found two solutions.
Add extern crate ffmpeg_next;
at the top of your binary.
Or add such .cargo/config.toml
[target.x86_64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]
[target.aarch64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]
Add pkg-config to your build.rs
extern crate pkg_config;
fn main() {
let mut config = pkg_config::Config::new();
config.statik(true).probe("x264").unwrap();
config.statik(true).probe("dav1d").unwrap();
// config.statik(true).probe("aom").unwrap();
// config.statik(true).probe("opencore-amrwb").unwrap();
//
// config.statik(true).probe("snappy").unwrap();
config.statik(true).probe("x265").unwrap();
config.statik(true).probe("vpx").unwrap();
}
This will work on macos.
@dashuai009 I could not get this to work on MacOS Sonoma M1 Pro.
I have found two solutions.
- Add
extern crate ffmpeg_next;
at the top of your binary. https://github.com/huggingface/candle?tab=readme-ov-file#missing-symbols-when-compiling-with-the-mkl-featureOr add such
.cargo/config.toml
[target.x86_64-apple-darwin] rustflags = [ "-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup", ] [target.aarch64-apple-darwin] rustflags = [ "-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup", ]
- Add pkg-config to your build.rs
extern crate pkg_config; fn main() { let mut config = pkg_config::Config::new(); config.statik(true).probe("x264").unwrap(); config.statik(true).probe("dav1d").unwrap(); // config.statik(true).probe("aom").unwrap(); // config.statik(true).probe("opencore-amrwb").unwrap(); // // config.statik(true).probe("snappy").unwrap(); config.statik(true).probe("x265").unwrap(); config.statik(true).probe("vpx").unwrap(); }
This will work on macos.
I have found two solutions.
- Add
extern crate ffmpeg_next;
at the top of your binary. https://github.com/huggingface/candle?tab=readme-ov-file#missing-symbols-when-compiling-with-the-mkl-featureOr add such
.cargo/config.toml
[target.x86_64-apple-darwin] rustflags = [ "-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup", ] [target.aarch64-apple-darwin] rustflags = [ "-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup", ]
- Add pkg-config to your build.rs
extern crate pkg_config; fn main() { let mut config = pkg_config::Config::new(); config.statik(true).probe("x264").unwrap(); config.statik(true).probe("dav1d").unwrap(); // config.statik(true).probe("aom").unwrap(); // config.statik(true).probe("opencore-amrwb").unwrap(); // // config.statik(true).probe("snappy").unwrap(); config.statik(true).probe("x265").unwrap(); config.statik(true).probe("vpx").unwrap(); }
This will work on macos.
First, brew install ffmpeg pkg-config
.
here is cargo.toml
[target.'cfg(windows)'.dependencies]
ffmpeg-next = { version = "7.0.1" }
[target.'cfg(not(windows))'.dependencies]
ffmpeg-next = { version = "7.0.1", default-features = false, features = [
"format", "software-resampling",
"build",
"build-license-gpl", "build-license-nonfree", "build-license-version3"
], optional = true }
I used the feature build
, it will pull ffmpeg source code from github and compile on your local.
Then, recommend to add extern crate ffmpeg_next
on the top of binary/lib file.
This will be worked if you just use the default features of ffmpeg_next
, including format, device, swr and so on.
If you want to use the avcodec, for example, x265. First
brew install x265
Then, add feature build-lib-x265
of ffmpeg_next in cargo.toml.
Then, add pkg-config in buid.rs of your project like this,
extern crate pkg_config;
fn main() {
let mut config = pkg_config::Config::new();
config.statik(true).probe("x265").unwrap();
}
Thanks I'll try these.
I'm on MacOS 13.4 (22F66)
I'm trying to use ffmpeg-next to build a video from a series of image files.
I can get
ffmpeg-next = { version = "6.0.0", features = ["build"] }
to build, but then I don't have any h264 capabilities. (Most examples, and the libraries that sit on top of this, e.g. video-rs, use h264)If I add
ffmpeg-next = { version = "6.0.0", features = ["build", "codec", "build-license-gpl", "build-lib-x264"] }
I get the following when I build:This looks like I have something pretty fundamental missing, but I am not sure where to look. (I have ffmpeg 6 installed via homebrew)
Anyone have any ideas or pointers?