CCExtractor / rusty_ffmpeg

FFI bindings for FFmpeg inner libraries.

Home Page:https://crates.io/crates/rusty_ffmpeg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Automatic Detect ffmpeg Path

prateekmedia opened this issue · comments

See in ubuntu or fedora they have a common path for ffmpeg, so can rusty_ffmpeg do the same by default i.e. if env variable is not set then check in a set of directories, else return error.

Reference: CCExtractor now uses this, but most of the users won't set environment variable and some will except it to detect it automatically just like ffmpeg_sys_next
CCExtractor/ccextractor#1412

cc @ldm0

Originally there was a linking fallback. It's disabled due to possibility of using version-incompatible FFmpeg. Will bring it back gated with a feature.

Will make a release after #86 gets merged

@prateekmedia You can use rsmpeg = { version = "0.14", features = ["link_system_ffmpeg"] } now.

Also ffmpeg5 feature is needed I think @ldm0?

Also ffmpeg5 feature is needed I think @ldm0?

If you drop support for FFmpeg 4, it's needed.

@ldm0 can you look at this error, it is coming after removing env variables:

error[E0425]: cannot find value `AVPixelFormat_AV_PIX_FMT_X2BGR10LE` in this scope
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rusty_ffmpeg-0.13.0+ffmpeg.6.0/src/avutil/pixfmt.rs:104:86
    |
11  |         pub const $def: AVPixelFormat = $le;
    |         ------------------------------------ similarly named constant `AVPixelFormat_AV_PIX_FMT_X2BGR10` defined here

Full log here: https://github.com/CCExtractor/ccextractor/actions/runs/4476277260/jobs/7866479823

@ldm0 can you look at this error, it is coming after removing env variables:

error[E0425]: cannot find value `AVPixelFormat_AV_PIX_FMT_X2BGR10LE` in this scope
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rusty_ffmpeg-0.13.0+ffmpeg.6.0/src/avutil/pixfmt.rs:104:86
    |
11  |         pub const $def: AVPixelFormat = $le;
    |         ------------------------------------ similarly named constant `AVPixelFormat_AV_PIX_FMT_X2BGR10` defined here

Full log here: https://github.com/CCExtractor/ccextractor/actions/runs/4476277260/jobs/7866479823

@prateekmedia AV_PIX_FMT_X2BGR10 was added in FFmpeg 5.0 and gated under ffmpeg5 feature, the ffmpeg inner libs installed by apt in CI should belongs to FFmpeg 4.*.

You can try removing ffmpeg5 feature.

These still come without ffmpeg5 flag

 --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rsmpeg-0.14.0+ffmpeg.6.0/src/avutil/frame.rs:232:29
    |
232 |                 self.size / size_of::<ffi::AVMotionVector>(),
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `usize`

error[E0277]: cannot divide `i32` by `usize`
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rsmpeg-0.14.0+ffmpeg.6.0/src/avutil/frame.rs:232:27
    |
232 |                 self.size / size_of::<ffi::AVMotionVector>(),
    |                           ^ no implementation for `i32 / usize`
    |
    = help: the trait `Div<usize>` is not implemented for `i32`
    = help: the following other types implement trait `Div<Rhs>`:
              <&'a i32 as Div<i32>>
              <&i32 as Div<&i32>>
              <i32 as Div<&i32>>
              <i32 as Div>

error[E0308]: mismatched types
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rsmpeg-0.14.0+ffmpeg.6.0/src/avutil/frame.rs:232:17
    |
230 |             slice::from_raw_parts(
    |             --------------------- arguments to this function are incorrect
231 |                 self.data as *const _ as *const ffi::AVMotionVector,
232 |                 self.size / size_of::<ffi::AVMotionVector>(),
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `i32`
    |
note: function defined here
   --> /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/slice/raw.rs:92:21
help: you can convert an `i32` to a `usize` and panic if the converted value doesn't fit
    |
232 |                 (self.size / size_of::<ffi::AVMotionVector>()).try_into().unwrap(),
    |                 +                                            +++++++++++++++++++++

Yeah, that's a seperate issue. let me check this out.

@prateekmedia Try rsmpeg = { version = "0.14.1", features = ["link_system_ffmpeg"] }