Giter Club home page Giter Club logo

ffmpeg-the-third's People

Contributors

abhijeetbhagat avatar ajsyp avatar animeavi avatar baadc0de avatar bacek avatar barzamin avatar ciuncan avatar computersarehard avatar ebarnard avatar emk avatar eroc33 avatar fengalin avatar flmmkch avatar focureneb avatar freezylemon avatar kmaork avatar kornelski avatar lummax avatar main-- avatar meh avatar mkatychev avatar mqudsi avatar panicbit avatar polochon-street avatar retrry avatar shssoichiro avatar tim-hellhake avatar tmm1 avatar yalter avatar zmwangx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ffmpeg-the-third's Issues

Create release checklist

It's not obvious what needs to be changed in this project whenever FFmpeg releases a new version.

Things I know of (some of these won't be caught by CI):

  • Add new API
    • New enums, enum variants, structs, functions
    • New header files
    • diff bindings.rs between the two versions to check for new API
    • Check channel_layout for new members (this is a special case, there's a bug in bindgen that requires us to define some constants manually)
  • Bump crate version in Cargo.toml (ffmpeg and ffmpeg-sys)
  • Update build script
    • Check configure script for new build options
    • Update version_check_info
    • Add new entry in ffmpeg_lavc_versions
    • Update <LIB>_FEATURES list (FF_API_ flags from version.h and version_major.h for each library)

There's probably something missing here. I'll edit this after I'm done with the build script and then add it as a UPDATE.MD or something

Consider annotating FF_API_ features in build.rs with version ranges

These FF_API_<FEATURE> flags come and go often, so the lists inside build.rs will keep growing. I think it makes sense to annotate these with the versions when they first and last appear in their respective version.h/version_major.h headers.

It would

  • make it a lot easier to remove flags whenever support for old versions is dropped
  • make it possible to see which flags are possible in the current version, so that downstream users know which FF_API features they can drop when upgrading FFmpeg version

Implement new/changed 7.0 APIs

Currently diffing the bindings.rs between 6.1 and 7.0, and I found the following things that are not showstoppers, but should be implemented after 7.0 compatibility:

  • av_channel_layout_retype
  • av_frame_side_data_* functions
  • Changes to AVOpt and av_opt
  • AVStreamGroup and related API (AVStreamGroupParamsType, AVStreamGroupTileGrid etc.)
  • The addition of AV_OPT_FLAG_ARRAY means that AVOptionType is no longer a valid Rust enum. It should be a bitflags struct instead.

Subtitle decoding api is inconsistent with video and audio decoding

For subtitles, there is just a decode method instead of the send_packet and receive frame. For that there needs to be a Frame(Subtitle) type in the frames folder I believe.
Is this api design intentional?

I don't have much prior experience working with ffmpeg, I just want to shows subtitles using the egui-video crate in my own app.

Please and Thank you.

Add FFmpeg 7.0 support

7.0 released earlier today.

Not all sources for the CI builds and most package repositories don't have it yet. I'll open this issue to keep track of things, but I'll probably get around to it as soon as the Arch repositories update to 7.0.

sys crate needs a release, too

ffmpeg-the-third 1.1.2 was supposed to include the static build fix, but it actually doesn't since the crate still depends on ffmpeg-sys-the-third v1.0.0+ffmpeg-5.1.2 which doesn't contain the fix.

You need to publish 1.0.1 of the ffmpeg-sys-the-third crate, yank ffmpeg-the-third 1.1.2, then release ffmpeg-the-third 1.1.3 after updating its Cargo.toml to depend on ffmpeg-sys-the-third v1.0.1.

[expanding examples] Please add detail documentation of using the ffmpeg in rust

It is very hard for noob to go through this in rust regarding ffmpeg.

add more real world examples like,

  1. trimming video given video path and duration
  2. convert one format of video to other format
  3. example showing zoom in and out of video

multiple simple example would help for the ref for new rust learners and users

Thank you

Reconsider using `.rustified_enum()` for bindings generation

Due to the ability of enums in C to be treated as basically just an integer with some predefined constants, it's probably not a good idea to treat all of the FFmpeg enums as Rust enums. Rust enums are a lot stricter and there is probably a decent amount of UB in the crate because of .rustifed_enum() atm. They should almost definitely use newtypes around integers for the bindings, and then enums or bitflags structs on the Rust side.

missing `libavutil.pc` build failure on windows

thank you very much for keeping rust ffmpeg support alive.

I have been having a hell of a time trying to get any of the rust ffmpeg bindings to work for me on windows.
I followed the build instructions linked in the readme (installing LLVM and full-shared build of ffmpeg and putting on path).

The issue (apparently) is that pkg-config files don't seem to be included in the Gyan full shared builds although I don't know enough about it to be sure.

Here is the log I keep running into when trying to build/run my crate that has ffmpeg-the-third as a dependency:

 --- stderr
  thread 'main' panicked at C:\Users\anand\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ffmpeg-sys-the-third-1.1.1+ffmpeg-6.0\build.rs:714:14:
  called `Result::unwrap()` on an `Err` value: 
  pkg-config exited with status code 1
  > PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags libavutil

  The system library `libavutil` required by crate `ffmpeg-sys-the-third` was not found.
  The file `libavutil.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
  The PKG_CONFIG_PATH environment variable is not set.

  HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `libavutil.pc`.

  stack backtrace:
     0: std::panicking::begin_panic_handler
               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\std\src\panicking.rs:645
     1: core::panicking::panic_fmt
               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\core\src\panicking.rs:72
     2: core::result::unwrap_failed
               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library\core\src\result.rs:1649
     3: core::result::Result<T,E>::unwrap
     4: build_script_build::link_to_libraries::{{closure}}
     5: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I was able to find someone else that has run into the issue but got no response to the issue of missing .pc
https://www.reddit.com/r/ffmpeg/comments/jr1poj/missing_libavutil_package/

Thanks again!

Add helper tests for missing enum variants

Often, there are enums in the ffmpeg crate that have From<AVEnum> for Enum implementations (and vice versa). These will automatically show missing variants due to non-exhaustive match statements whenever a new FFmpeg version is released.

However, there are some enums where this doesn't work. Those could (and should) have a test, hidden behind a feature flag, to check whether the match statement on the AVEnum is exhaustive. Rough draft:

#[cfg(all(test, feature = "check-enums"))]
mod dev_test {
    fn exhaustive_av_option_type(x: AVOptionType) {
        match x {
            // all variants
        }
    }
}

(AVOptionType is a random example, it currently has an exhaustive match statement in its API). I think bitflags structs mostly benefit from this.

If someone starts adding these, they might aswell add these for all known enums while they're at it (and offload them to a separate test-only file). That would make it easy to just run cargo check -F check-enum or something whenever preparing for a new FFmpeg version.

Check non-avutil headers for holes in auto-generated bindings

ffmpeg-sys already has the avutil subdirectory where some things from libavutil are ported to Rust because bindgen can't find or translate them (e.g. static function implementations in headers, function-like macros etc.).

There are probably things in the other av libraries that are missing in the -sys crate as a result. It's probably a good idea to try to add these, and hide them behind the library's feature flag.

Add to wiki how to ship it staticlly

Sorry for creating an issue for that, you need to enable discussion for this repo in settings.

I would like to ship my desktop app based on tauri with this crate when ffmpeg is staticlly linked or the dylibs shipped with it
so users which use the desktop app won't need to install ffmpeg to use it.
I tried to copy brew deps to the same folder of the executable but it didn't worked.

expose load from io

current video is from path, which implemented called format::input, for example,

    pub fn clip(&self) -> Result<(), Box<dyn std::error::Error>> {
        ffmpeg_next::init()?;
        let _ = self.mkdir();
        let mut ictx = format::input(&self.path)?;
        let input = ictx
                .streams()
                .best(media::Type::Video)
                .ok_or(ffmpeg_next::Error::StreamNotFound)?;

        let idx = input.index();

        let ctx = codec::context::Context::from_parameters(input.parameters())?;
        let mut decoder = ctx.decoder().video()?;

        let fmt = decoder.format();
        let w = decoder.width();
        let h = decoder.height();

        let mut scaler = software::scaling::context::Context::get(
                fmt, 
                w, h,
                format::Pixel::RGB24,
                w, h,
                software::scaling::flag::Flags::BILINEAR,
            )?;
        
        let mut i=0;
        let mut count=0;
        for (stream, packet) in ictx.packets() {
            if stream.index() == idx {
                decoder.send_packet(&packet)?;
                let mut decoded_frame = frame::video::Video::empty();
                while decoder.receive_frame(&mut decoded_frame).is_ok() {
                    if count % 5 == 0{
                        let mut rgb_frame = frame::video::Video::empty();
                        scaler.run(&decoded_frame, &mut rgb_frame)?;
                        let img = RgbImage::from_raw(w, h, rgb_frame.data(0).to_vec()).unwrap(); 
                        img.save(self.local.join(format!("{:04}.jpg", i)))?; 
                        i+=1;
                    }
                    count+=1;
                }
            }
        }

        decoder.send_eof()?;
        Ok(())
    }

if that is possible to expose the API, for example,

let mut ictx = format::from_bytes(&self.buffer)?;

confusion with feature flags and `format::list()` and `format::register_all()`

I was looking to write a script that lists all of the video codecs, and I see both format::register_all() and format::list() https://docs.rs/ffmpeg-the-third/latest/ffmpeg_the_third/format/fn.register_all.html

I noticed in the source that it has the #[cfg(not(feature = "ffmpeg_5_0"))] annotation on it.
But when I run cargo feature ffmpeg-the-third I don't see that in the list of features (shown at bottom).

Rust-analyzer indicated that ffmpeg_5_0 was enabled, so I tried turning off the default features with ffmpeg-the-third = {version = "1.2.2", default-features = false} as the dep entry, but that gives me a build error (shown below).

If I try to verify that the ffmpeg_5_0 feature is really off, the script runs with no issues. There is probably something about feature flags that I don't understand.

use anyhow;
use ffmpeg::{codec, format, media};
use ffmpeg_the_third as ffmpeg;
fn main() -> Result<(), anyhow::Error> {
    ffmpeg::init()?;
    if cfg!(not(feature = "ffmpeg_5_0")) {
        println!("ffmpeg configuration: {}", format::configuration());
    }
    Ok(())
}

The config info is printed just fine, indicating that the feature is not enabled. But if I try format::register_all(); after the init() I get:

PS C:\Users\anand\.rust\streamcam> c r --release
   Compiling streamcam v0.1.0 (C:\Users\anand\.rust\streamcam)
error[E0425]: cannot find function `register_all` in module `format`
  --> src\main.rs:6:13
   |
6  |     format::register_all();
   |             ^^^^^^^^^^^^ not found in `format`
   |
note: found an item that was configured out
  --> C:\Users\anand\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ffmpeg-the-third-1.2.2+ffmpeg-6.0\src\format\mod.rs:29:8

Any advice or help in listing all the codecs would be greatly appreciated. Thank you

no default-features build log
PS C:\Users\anand\.rust\streamcam> c r --release        
   Compiling ffmpeg-the-third v1.2.2+ffmpeg-6.0
   Compiling ffmpeg-sys-the-third v1.1.1+ffmpeg-6.0
error: failed to run custom build command for `ffmpeg-sys-the-third v1.1.1+ffmpeg-6.0`              

Caused by:
  process didn't exit successfully: `C:\Users\anand\.rust\streamcam\target\release\build\ffmpeg-sys-the-third-a83a64ad448b3207\build-script-build` (exit code: 101)
  --- stdout
  vcpkg build helper copied C:\Users/anand/src/cpp/vcpkg/installed\x64-windows\bin\avcodec-60.dll to C:\Users\anand\.rust\streamcam\target\release\build\ffmpeg-sys-the-third-f17c12062f3b1657\out\avcodec-60.dll
  vcpkg build helper copied C:\Users/anand/src/cpp/vcpkg/installed\x64-windows\bin\avdevice-60.dll to C:\Users\anand\.rust\streamcam\target\release\build\ffmpeg-sys-the-third-f17c12062f3b1657\out\avdevice-60.dll
  vcpkg build helper copied C:\Users/anand/src/cpp/vcpkg/installed\x64-windows\bin\avfilter-9.dll to C:\Users\anand\.rust\streamcam\target\release\build\ffmpeg-sys-the-third-f17c12062f3b1657\out\avfilter-9.dll
  vcpkg build helper copied C:\Users/anand/src/cpp/vcpkg/installed\x64-windows\bin\avformat-60.dll to C:\Users\anand\.rust\streamcam\target\release\build\ffmpeg-sys-the-third-f17c12062f3b1657\out\avformat-60.dll
  vcpkg build helper copied C:\Users/anand/src/cpp/vcpkg/installed\x64-windows\bin\avutil-58.dll to C:\Users\anand\.rust\streamcam\target\release\build\ffmpeg-sys-the-third-f17c12062f3b1657\out\avutil-58.dll
  vcpkg build helper copied C:\Users/anand/src/cpp/vcpkg/installed\x64-windows\bin\swresample-4.dll to C:\Users\anand\.rust\streamcam\target\release\build\ffmpeg-sys-the-third-f17c12062f3b1657\out\swresample-4.dll
  vcpkg build helper copied C:\Users/anand/src/cpp/vcpkg/installed\x64-windows\bin\swscale-7.dll to C:\Users\anand\.rust\streamcam\target\release\build\ffmpeg-sys-the-third-f17c12062f3b1657\out\swscale-7.dll
  vcpkg build helper copied C:\Users/anand/src/cpp/vcpkg/installed\x64-windows\bin\pkgconf-5.dll to C:\Users\anand\.rust\streamcam\target\release\build\ffmpeg-sys-the-third-f17c12062f3b1657\out\pkgconf-5.dll
  cargo:rustc-link-search=native=C:\Users/anand/src/cpp/vcpkg/installed\x64-windows\lib
  cargo:rustc-link-search=native=C:\Users/anand/src/cpp/vcpkg/installed\x64-windows\bin
  cargo:rustc-link-lib=avcodec
  cargo:rustc-link-lib=avdevice
  cargo:rustc-link-lib=avfilter
  cargo:rustc-link-lib=avformat
  cargo:rustc-link-lib=avutil
  cargo:rustc-link-lib=swresample
  cargo:rustc-link-lib=swscale
  cargo:rustc-link-lib=pkgconf
  cargo:rustc-link-search=native=C:\Users\anand\.rust\streamcam\target\release\build\ffmpeg-sys-the-third-f17c12062f3b1657\out
  cargo:rustc-link-search=C:\Users\anand\.rust\streamcam\target\release\build\ffmpeg-sys-the-third-f17c12062f3b1657\out
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-pc-windows-msvc")
  cargo:rerun-if-env-changed=CC_x86_64-pc-windows-msvc
  CC_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CC_x86_64_pc_windows_msvc
  CC_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  DEBUG = Some("false")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-pc-windows-msvc
  CFLAGS_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_pc_windows_msvc
  CFLAGS_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  check.c
  C:\Users\anand\src\cpp\vcpkg\installed\x64-windows\include\libavutil\common.h(209): warning C4244: 'return': conversion from 'int' to 'uint8_t', possible loss of data
  C:\Users\anand\src\cpp\vcpkg\installed\x64-windows\include\libavutil\common.h(220): warning C4244: 'return': conversion from 'int' to 'int8_t', possible loss of data
  C:\Users\anand\src\cpp\vcpkg\installed\x64-windows\include\libavutil\common.h(231): warning C4244: 'return': conversion from 'int' to 'uint16_t', possible loss of data
  C:\Users\anand\src\cpp\vcpkg\installed\x64-windows\include\libavutil\common.h(242): warning C4244: 'return': conversion from 'int' to 'int16_t', possible loss of data
  check.c(198): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(198): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(198): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(199): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(199): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(199): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(200): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(200): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(200): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(201): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(201): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(201): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(202): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(202): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(202): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(203): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(203): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(203): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(204): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(204): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(204): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(205): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(205): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(205): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(206): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(206): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(206): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(207): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(207): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(207): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(208): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(208): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(208): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(209): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(209): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(209): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(210): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(210): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(210): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(211): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(211): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(211): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(212): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(212): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(212): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(213): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(213): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(213): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(214): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(214): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(214): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(215): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(215): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(215): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(216): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(216): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(216): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(217): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(217): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(217): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(218): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(218): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(218): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(219): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(219): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(219): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(220): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(220): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(220): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(221): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(221): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(221): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(222): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(222): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(222): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(223): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(223): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(223): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(224): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(224): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(224): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(225): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(225): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(225): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(226): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(226): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(226): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(227): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(227): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(227): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(228): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(228): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(228): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(229): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(229): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(229): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(230): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(230): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(230): error C2065: 'LIBAVCODEC_VERSION_MINOR': undeclared identifier
  check.c(231): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(231): error C2065: 'LIBAVCODEC_VERSION_MAJOR': undeclared identifier
  check.c(231): fatal error C1003: error count exceeds 100; stopping compilation

  --- stderr
  cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
  thread 'main' panicked at C:\Users\anand\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ffmpeg-sys-the-third-1.1.1+ffmpeg-6.0\build.rs:501:9:
  Compile failed
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
ffmpeg-the-third feature list
PS C:\Users\anand\.rust\streamcam> c feature ffmpeg-the-third
   Avaliable features for `ffmpeg-the-third`
default = ["codec", "device", "filter", "format", "software-resampling", "software-scaling", "non-exhaustive-enums"]
build = ["static", "ffmpeg-sys-the-third/build"]
build-lib-aacplus = ["ffmpeg-sys-the-third/build-lib-aacplus"]
build-lib-ass = ["ffmpeg-sys-the-third/build-lib-ass"]
build-lib-avs = ["ffmpeg-sys-the-third/build-lib-avs"]
build-lib-celt = ["ffmpeg-sys-the-third/build-lib-celt"]
build-lib-dav1d = ["ffmpeg-sys-the-third/build-lib-dav1d"]
build-lib-dcadec = ["ffmpeg-sys-the-third/build-lib-dcadec"]
build-lib-faac = ["ffmpeg-sys-the-third/build-lib-faac"]
build-lib-fdk-aac = ["ffmpeg-sys-the-third/build-lib-fdk-aac"]
build-lib-fontconfig = ["ffmpeg-sys-the-third/build-lib-fontconfig"]
build-lib-freebidi = ["ffmpeg-sys-the-third/build-lib-freebidi"]
build-lib-freetype = ["ffmpeg-sys-the-third/build-lib-freetype"]
build-lib-frei0r = ["ffmpeg-sys-the-third/build-lib-frei0r"]
build-lib-gnutls = ["ffmpeg-sys-the-third/build-lib-gnutls"]
build-lib-gsm = ["ffmpeg-sys-the-third/build-lib-gsm"]
build-lib-ilbc = ["ffmpeg-sys-the-third/build-lib-ilbc"]
build-lib-kvazaar = ["ffmpeg-sys-the-third/build-lib-kvazaar"]
build-lib-ladspa = ["ffmpeg-sys-the-third/build-lib-ladspa"]
build-lib-mp3lame = ["ffmpeg-sys-the-third/build-lib-mp3lame"]
build-lib-opencore-amrnb = ["ffmpeg-sys-the-third/build-lib-opencore-amrnb"]
build-lib-opencore-amrwb = ["ffmpeg-sys-the-third/build-lib-opencore-amrwb"]
build-lib-opencv = ["ffmpeg-sys-the-third/build-lib-opencv"]
build-lib-openh264 = ["ffmpeg-sys-the-third/build-lib-openh264"]
build-lib-openjpeg = ["ffmpeg-sys-the-third/build-lib-openjpeg"]
build-lib-openssl = ["ffmpeg-sys-the-third/build-lib-openssl"]
build-lib-opus = ["ffmpeg-sys-the-third/build-lib-opus"]
build-lib-schroedinger = ["ffmpeg-sys-the-third/build-lib-schroedinger"]
build-lib-shine = ["ffmpeg-sys-the-third/build-lib-shine"]
build-lib-smbclient = ["ffmpeg-sys-the-third/build-lib-smbclient"]
build-lib-snappy = ["ffmpeg-sys-the-third/build-lib-snappy"]
build-lib-speex = ["ffmpeg-sys-the-third/build-lib-speex"]
build-lib-ssh = ["ffmpeg-sys-the-third/build-lib-ssh"]
build-lib-stagefright-h264 = ["ffmpeg-sys-the-third/build-lib-stagefright-h264"]
build-lib-theora = ["ffmpeg-sys-the-third/build-lib-theora"]
build-lib-twolame = ["ffmpeg-sys-the-third/build-lib-twolame"]
build-lib-utvideo = ["ffmpeg-sys-the-third/build-lib-utvideo"]
build-lib-vmaf = ["ffmpeg-sys-the-third/build-lib-vmaf"]
build-lib-vo-aacenc = ["ffmpeg-sys-the-third/build-lib-vo-aacenc"]
build-lib-vo-amrwbenc = ["ffmpeg-sys-the-third/build-lib-vo-amrwbenc"]
build-lib-vorbis = ["ffmpeg-sys-the-third/build-lib-vorbis"]
build-lib-vpx = ["ffmpeg-sys-the-third/build-lib-vpx"]
build-lib-wavpack = ["ffmpeg-sys-the-third/build-lib-wavpack"]
build-lib-webp = ["ffmpeg-sys-the-third/build-lib-webp"]
build-lib-x264 = ["ffmpeg-sys-the-third/build-lib-x264"]
build-lib-x265 = ["ffmpeg-sys-the-third/build-lib-x265"]
build-lib-xvid = ["ffmpeg-sys-the-third/build-lib-xvid"]
build-license-gpl = ["ffmpeg-sys-the-third/build-license-gpl"]
build-license-nonfree = ["ffmpeg-sys-the-third/build-license-nonfree"]
build-license-version3 = ["ffmpeg-sys-the-third/build-license-version3"]
build-pic = ["ffmpeg-sys-the-third/build-pic"]
build-zlib = ["ffmpeg-sys-the-third/build-zlib"]
codec = ["ffmpeg-sys-the-third/avcodec"]
device = ["ffmpeg-sys-the-third/avdevice", "format"]
filter = ["ffmpeg-sys-the-third/avfilter"]
format = ["ffmpeg-sys-the-third/avformat", "codec"]
non-exhaustive-enums = ["ffmpeg-sys-the-third/non-exhaustive-enums"]
postprocessing = ["ffmpeg-sys-the-third/postproc"]
resampling = ["ffmpeg-sys-the-third/avresample"]
rpi = []
serialize = ["serde"]
software-resampling = ["ffmpeg-sys-the-third/swresample"]
software-scaling = ["ffmpeg-sys-the-third/swscale", "codec"]
static = ["ffmpeg-sys-the-third/static"]
image (optional)
serde (optional)

Take another look at the `serialize` feature

  1. Does anyone actually use it? If no, can we drop it?
  2. Are there any tests?
  3. Create/expand tests
  4. What are the compatibility guarantees around (de)serialization?

Context is the bitflags crate, which has some serialization changes/breakage between v1 and v2. I guess having no tests is mostly fine if you don't guarantee compatibility between crate versions?

Consider dropping support for older FFmpeg versions

FFmpeg versions in Ubuntu repositories, for reference

Dropping support for older FFmpeg versions would reduce the maintenance burden significantly. 5.0 (early 2022) in particular dropped a lot of legacy cruft, but I can understand if that might be "too much" given that a lot of consumers are still on 4.X.

On the other hand: If someone wants support for older FFmpeg versions, there's always the other fork to fall back on. It's also questionable whether these versions are well-supported at the moment anyways.

[Windows] DLL not found

I get the following error when trying to run the metadata example on windows

C:\Users\brand\repos\ffmpeg-the-third> cargo run --example metadata
    Updating crates.io index
   Compiling ffmpeg-the-third v1.1.0+ffmpeg-5.1.2 (C:\Users\brand\repos\ffmpeg-the-third)
    Finished dev [unoptimized + debuginfo] target(s) in 2.75s
     Running `target\debug\examples\metadata.exe`
error: process didn't exit successfully: `target\debug\examples\metadata.exe` (exit code: 0xc0000135, STATUS_DLL_NOT_FOUND)

I have installed ffmpeg (and shared libraries) using the ffmpeg-shared package from chocolatey.
My FFMPEG_DIR env variable is set to C:\Program Files\FFmpeg.

Here's a tree of my FFMPEG_DIR

C:\PROGRAM FILES\FFMPEG
├───bin
├───doc
├───ffmpeg-5.1.1-full_build-shared
│   ├───bin
│   ├───doc
│   ├───include
│   │   ├───libavcodec
│   │   ├───libavdevice
│   │   ├───libavfilter
│   │   ├───libavformat
│   │   ├───libavutil
│   │   ├───libpostproc
│   │   ├───libswresample
│   │   └───libswscale
│   ├───lib
│   └───presets
├───include
│   ├───libavcodec
│   ├───libavdevice
│   ├───libavfilter
│   ├───libavformat
│   ├───libavutil
│   ├───libpostproc
│   ├───libswresample
│   └───libswscale
├───lib
└───presets

The build script seems to be able to find the header files just fine. in fact, if I run cargo build it compiles just fine.
the contents of FFMPEG_DIR\lib:

 Directory of C:\Program Files\FFmpeg\lib

01/24/2023  07:24 PM    <DIR>          .
01/24/2023  07:24 PM    <DIR>          ..
09/25/2022  09:50 AM             4,229 avcodec-59.def
09/25/2022  09:50 AM           133,376 avcodec.lib
09/25/2022  09:50 AM               544 avdevice-59.def
09/25/2022  09:50 AM            16,444 avdevice.lib
09/25/2022  09:50 AM             1,707 avfilter-8.def
09/25/2022  09:50 AM            50,466 avfilter.lib
09/25/2022  09:50 AM             3,594 avformat-59.def
09/25/2022  09:50 AM           123,914 avformat.lib
09/25/2022  09:50 AM            13,618 avutil-57.def
09/25/2022  09:50 AM           456,536 avutil.lib
09/25/2022  09:50 AM           178,834 libavcodec.dll.a
09/25/2022  09:50 AM            13,518 libavdevice.dll.a
09/25/2022  09:50 AM           164,002 libavfilter.dll.a
09/25/2022  09:50 AM           139,952 libavformat.dll.a
09/25/2022  09:50 AM           384,570 libavutil.dll.a
09/25/2022  09:50 AM             7,514 libpostproc.dll.a
09/25/2022  09:50 AM            17,288 libswresample.dll.a
09/25/2022  09:50 AM            22,050 libswscale.dll.a
09/25/2022  09:50 AM               223 postproc-56.def
09/25/2022  09:50 AM             9,440 postproc.lib
09/25/2022  09:50 AM               519 swresample-4.def
09/25/2022  09:50 AM            21,154 swresample.lib
09/25/2022  09:50 AM               746 swscale-6.def
09/25/2022  09:50 AM            26,726 swscale.lib
              24 File(s)      1,790,964 bytes
               2 Dir(s)  158,021,533,696 bytes free

now I think it's weird that the dll files here have the .a extension, but removing that extension doesn't seem to help.
Also for reference my currently installed ffmpeg version is 5.1.2

avresample is not handled correctly

libavresample is only supported up until FFmpeg 4.4.X and has been removed starting with FFmpeg 5.0.

This is handled in the sys/build.rs by checking ffmpeg_major_version() in a few places.

ffmpeg_major_version is calculated by parsing the CARGO_PKG_VERSION. This means that e.g. 1.2.3+ffmpeg-6.0 will result in a major version of 6, meaning avresample will never get linked. However, even newer crate versions support older FFmpeg linkage, so this doesn't make sense (I can use FFmpeg libraries versioned at 4.4 with a crate version supporting 6.X).

I think the only real fix to this is figuring out the actual FFmpeg version at build.rs-runtime.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.