zmwangx / rust-ffmpeg-sys

FFmpeg bindings for Rust.
125 stars 86 forks source link

can not find the h264 encoder by avcodec_find_encoder #69

Open kyrosle opened 7 months ago

kyrosle commented 7 months ago

See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies] ffmpeg-sys-next = { path = "../", features = [ // this example writing inside the ffmpeg-sys-next repo "build", "build-license-gpl", "build-license-nonfree", "build-lib-x264" ] }


console out:

Caused by: process didn't exit successfully: /Users/kyros/MyProject/libs/rust-ffmpeg-sys/target/debug/build/ffmpeg-sys-next-ee8dfd2e99237b2f/build-script-build (exit status: 101) --- stdout cargo:rustc-link-search=native=/Users/kyros/MyProject/libs/rust-ffmpeg-sys/target/debug/build/ffmpeg-sys-next-d76d0e8e39f17cc2/out/dist/lib cargo:rustc-link-lib=static=avcodec cargo:rustc-link-lib=static=avdevice cargo:rustc-link-lib=static=avfilter cargo:rustc-link-lib=static=avformat cargo:rustc-link-lib=static=avutil cargo:rustc-link-lib=static=swresample cargo:rustc-link-lib=static=swscale configure: ERROR: x264 not found using pkg-config

If you think configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to the ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.libera.chat. Include the log file "ffbuild/config.log" produced by configure as this will help solve the problem.

--- stderr Cloning into 'ffmpeg-6.1'... thread 'main' panicked at build.rs:657:21: called Result::unwrap() on an Err value: Custom { kind: Other, error: "configure failed " } note: run with RUST_BACKTRACE=1 environment variable to display a backtrace


rust version:

rustup 1.26.0 (5af9b9484 2023-04-05) info: This is the version for the rustup toolchain manager, not the rustc compiler. info: The currently active rustc version is rustc 1.75.0 (82e1608df 2023-12-21)



platform:
- macos 14.3.1 23D60 arm64
dmtrKovalenko commented 1 month ago

you need to

  1. install all the libraries requied for x264 including nasm checkout full list in ffmpeg compilation guide https://trac.ffmpeg.org/wiki/CompilationGuide/macOS:
brew install automake fdk-aac git lame libass libtool libvorbis libvpx \
opus sdl shtool texi2html theora wget x264 x265 xvid nasm

verify that pkg-config can resolve x264 by running:

pkg-config --libs x264
# -L/opt/homebrew/Cellar/x264/r3108/lib -lx264
  1. You need to build it and in theory it should work but in practice it doesn't because of rust-ffmepg-sys not reading all the linker flags from the ffmpeg output file. I fixed it here https://github.com/zmwangx/rust-ffmpeg-sys/pull/88