Giter Site home page Giter Site logo

larksuite / rsmpeg Goto Github PK

View Code? Open in Web Editor NEW
582.0 11.0 38.0 102.33 MB

A Rust crate that exposes FFmpeg's power as much as possible.

Home Page: https://docs.rs/rsmpeg/latest/rsmpeg/

License: MIT License

Rust 95.96% GLSL 1.56% Shell 2.49%
ffmpeg rust ffi bindings video

rsmpeg's Introduction

Rsmpeg

Doc Crates.io CI

rsmpeg is a thin&safe layer above the FFmpeg's Rust bindings, it's main goal is safely exposing FFmpeg inner APIs in Rust as much as possible.

Taking advantage of Rust's language design, you can build robust multi-media projects even quicker than using FFmpeg's C API.

Dependency requirements

Supported FFmpeg versions are 6.*, 7.*.

Minimum Supported Rust Version is 1.70.0(stable channel).

Getting started

FFmpeg compilation

To use your first rsmpeg demo, you need to compile your FFmpeg:

  1. https://github.com/ffmpeg/ffmpeg.
  2. https://trac.ffmpeg.org/wiki/CompilationGuide

If you find the compilation complicated, there are some helpful compiling scripts for you (under the utils folder).

To build a FFmpeg with some common parameters: (don't forget to install the build dependencies)

# macOS
zsh utils/mac_ffmpeg.rs
# Linux
bash utils/linux_ffmpeg.rs
# Windows
# You need a Linux machine for cross compiling, then copy the artifact to your
# Windows machine.
bash utils/windows_ffmpeg.rs

These scripts build latest stable FFmpeg by default. You can build specific FFmpeg version explicitly:

# macOS & FFmpeg 7.0
zsh utils/mac_ffmpeg.rs release/7.0

Compiling FFmpeg through cargo-vcpkg

Using vcpkg to manage ffmpeg dependencies may be easier as all the configuration is included in your Cargo.toml. This is especially handy for users who download your project as they can build all necessary dependencies by running a single command. Care that by using this method building ffmpeg may take a lot of time, although after the first time the generated library files may be cached.

To begin, install the cargo-vcpkg tool:

cargo install cargo-vcpkg

Add vcpkg dependencies:

[package.metadata.vcpkg]
dependencies = ["ffmpeg"]
git = "https://github.com/microsoft/vcpkg"
rev = "4a600e9" // Although it is possible to link to the master branch of vcpkg, it may be better to fix a specific revision in order to avoid unwanted breaking changes.

You may want to specify a subset of features based on the modules of FFmpeg you need. For instance, if your code makes use of x264 and VPX codecs the dependency should look like:

dependencies = ["ffmpeg[x264,vpx]"]

In some cases you may need to specify the triplet and/or additional dependencies. For instance, on Windows the above section would look similar to the following:

[package.metadata.vcpkg]
dependencies = ["ffmpeg[x264,vpx]:x64-windows-static-md"]
git = "https://github.com/microsoft/vcpkg"
rev = "4a600e9"

The features may vary depending on your application, in our case to build the demo we need x264.

Setup the environment:

# *nix (the path of the folder named after the triplet may change)
export FFMPEG_PKG_CONFIG_PATH=${PWD}/target/vcpkg/installed/x64-linux/lib/pkgconfig
# Windows(CMD)
set FFMPEG_PKG_CONFIG_PATH=%CD%\target\vcpkg\installed\x64-windows-static-md\lib\pkgconfig
# Windows(PowerShell)
$env:FFMPEG_PKG_CONFIG_PATH="$(($PWD).path)\target\vcpkg\installed\x64-windows-static-md\lib\pkgconfig"

Run the vcpkg build:

cargo vcpkg --verbose build

The --verbose option is not mandatory but may help to recognize any error in case the build fails.

After those steps you are able to build and run your project. A full working example with the demo code presented in the next section is available at https://github.com/aegroto/rsmpeg-vcpkg-demo.

Rsmpeg demo

Ensure that you have compiled the FFmpeg.

Start by adding rsmpeg to your Cargo.toml file:

[dependencies]
# Add this if you are using ffmpeg 6.*
rsmpeg = { version = "0.15.0", default-features = false, features = ["ffmpeg6"] }
# Add this if you are using ffmpeg 7.* (feature `ffmpeg7` is enabled by default)
rsmpeg = "0.15.0"

Write your simple media file info dumper:

use std::ffi::{CStr, CString};
use std::error::Error;
use rsmpeg::avformat::AVFormatContextInput;

fn dump_av_info(path: &CStr) -> Result<(), Box<dyn Error>> {
    let mut input_format_context = AVFormatContextInput::open(path, None, &mut None)?;
    input_format_context.dump(0, path)?;
    Ok(())
}

fn main() {
    dump_av_info(&CString::new("./test.jpg").unwrap()).unwrap();
}

Prepare a simple image in your current folder:

test.jpg

Run with FFMPEG_PKG_CONFIG_PATH set to the pkgconfig file path (Absolute path!) in your artifact folder (xxx/ffmpeg_build/lib/pkgconfig).

# macOS & Linux
export FFMPEG_PKG_CONFIG_PATH=xxx/ffmpeg_build/lib/pkgconfig
# Windows
set FFMPEG_PKG_CONFIG_PATH=xxx/ffmpeg_build/lib/pkgconfig

cargo run

Then it works:

Input #0, image2, from './test.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 1390 kb/s
  Stream #0:0: Video: mjpeg, none, 25 fps, 25 tbr, 25 tbn, 25 tbc

(A single image's duration under 25fps is 0.04s)

You can also put any video or audio file here, this program will dump the media info for you.

Advanced usage

  1. FFmpeg linking: refer to rusty_ffmpeg's documentation for how to use environment variables to statically or dynamically link FFmpeg.

  2. Advanced usage of rsmpeg: Check out the tests folder.

Contributors

Thanks for your contributions!

rsmpeg's People

Contributors

aegroto avatar fallingsnow avatar imxood avatar jamyw7g avatar ldm0 avatar nanpuyue avatar nxtn avatar vnghia 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rsmpeg's Issues

Getting data in multithread / async context

Although I've add some getter for the data, I ended up using this where Sender/Receiver is from a channel crate of your choice.

fn make_output_io_context(buffer_size: usize, tx: Sender<Vec<u8>>) -> AVIOContextContainer {
    AVIOContextContainer::Custom(AVIOContextCustom::alloc_context(
        AVMem::new(buffer_size),
        true,
        vec![],
        None,
        Some(Box::new(move |_, data| match tx.send(data.to_vec()) {
            Ok(()) => data.len() as i32,
            Err(_) => ffi::AVERROR_EXTERNAL,
        })),
        None,
    ))
}

With this and something like std::thread::spawn(|| transcode(tx)) // no join here!!!, we can pull the data as soon as it is available. Which is a lot better than waiting for processing ends.

Do you think we should add this example to somewhere in the doc @ldm0 ?

AVBitStreamFilter

I'm trying to implement AVBitStreamFilter in this library. I have a little code so far but I'm not sure if I'm working in the right direction. AVBitStreamFilter was easy but AVBSFContext has a bit of a strange allocation method and I couldn't find another example like it in your code.

Would you mind taking a look and letting me know if I'm doing anything wrong? This is what I have so far.

use std::{ffi::CStr, mem::MaybeUninit, ptr::NonNull};

use crate::{
    error::{Result, RsmpegError},
    ffi,
    shared::PointerUpgrade,
};

wrap!(AVBitStreamFilter: ffi::AVBitStreamFilter);

impl AVBitStreamFilter {
    /// Find a bitstream filter instance with it's short name.
    pub fn find_decoder_by_name(name: &CStr) -> Option<AVBitStreamFilter> {
        unsafe { ffi::av_bsf_get_by_name(name.as_ptr()) }
            .upgrade()
            .map(|x| unsafe { AVBitStreamFilter::from_raw(x) })
    }
}

wrap!(AVBSFContext: ffi::AVBSFContext);

impl AVBSFContext {
    /// Create a new [`AVBSFContext`] instance, allocate private data and
    /// initialize defaults for the given [`AVBitStreamFilter`].
    pub fn new(filter: &AVBitStreamFilter) -> Result<Self> {
        let mut bsfc_raw: MaybeUninit<ffi::AVBSFContext> = MaybeUninit::uninit();

        match unsafe { ffi::av_bsf_alloc(filter.as_ptr(), &mut bsfc_raw.as_mut_ptr()) } {
            0 => {
                let bsfc = unsafe {
                    AVBSFContext::from_raw(NonNull::new(&mut bsfc_raw.assume_init()).unwrap())
                };
                Ok(bsfc)
            }
            e => Err(RsmpegError::AVError(e)),
        }
    }
}

调用ffi::avdevice_register_all()报错?

调用unsafe { ffi::avdevice_register_all() }运行cargo run后输出如下错误?这个是由于ffmpeg版本的问题吗?目前使用版本是master分支。

PATH="/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin:/Users/huwence/.cargo/bin:/usr/local/opt/ruby/bin:/Users/huwence/.pyenv/plugins/pyenv-virtualenv/shims:/Users/huwence/.pyenv/shims:/Users/huwence/.pyenv/bin:/Users/huwence/Programs/flutter/bin:/usr/local/go/bin:/usr/local/mysql-shell/bin:/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/bin:/Users/huwence/.nvm/versions/node/v14.4.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:.:/Users/huwence/Programs/apache-maven-3.6.3/bin:/Users/huwence/Programs/gradle-6.2.1/bin:/Users/huwence/Programs/go/bin" VSLANG="1033" ZERO_AR_DATE="1" "cc" "-arch" "x86_64" "-m64" "/var/folders/x0/cxv0_n_s4jg0pl5v22q9fpdc0000gn/T/rustcg4r3fQ/symbols.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.12gemx3laohztdaf.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.18ziewmwgpus1btx.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.1grr2my2gqupk1uh.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.1zbhmsgy15nd4co8.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.2524smjp3prycprs.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.25a5rrq39ocikp5u.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.26iwibpc4uie0ixa.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.2dgji9j1r1w9qwzb.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.2f5trmy8mnhgk4bu.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.2jc5cxwrgp5jxajs.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.3ky3givln27ku7hx.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.3mp32qhw7hzmwelg.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.3ume9y3xo9a68ycu.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.48m0ostoesz6fism.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.53czpw59hpftlzx1.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.57dqabvq0f5sypw1.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.737kn7cqmtf5yi8.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.a9omjz09i3k87t.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.xxpxqje77on9h6q.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.y7bhfmpvcof8qt.rcgu.o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f.9mjpg0k3uz57s76.rcgu.o" "-L" "/Users/huwence/Projects/dk_screen/target/debug/deps" "-L" "/Users/huwence/Projects/rsmpeg/tmp/ffmpeg_build/lib" "-L" "/usr/local/Cellar/libvpx/1.13.0/lib" "-L" "/usr/local/Cellar/x264/r3095/lib" "-L" "/Users/huwence/Projects/rsmpeg/tmp/ffmpeg_build/lib" "-L" "/usr/local/Cellar/libx11/1.8.6/lib" "-L" "/Users/huwence/Projects/rsmpeg/tmp/ffmpeg_build/lib" "-L" "/usr/local/Cellar/libxcb/1.15_1/lib" "-L" "/usr/local/lib" "-L" "/Users/huwence/Projects/rsmpeg/tmp/ffmpeg_build/lib" "-L" "/usr/local/Cellar/libvpx/1.13.0/lib" "-L" "/usr/local/Cellar/x264/r3095/lib" "-L" "/Users/huwence/Projects/rsmpeg/tmp/ffmpeg_build/lib" "-L" "/usr/local/Cellar/libx11/1.8.6/lib" "-L" "/Users/huwence/Projects/rsmpeg/tmp/ffmpeg_build/lib" "-L" "/usr/local/Cellar/libvpx/1.13.0/lib" "-L" "/usr/local/Cellar/x264/r3095/lib" "-L" "/Users/huwence/Projects/rsmpeg/tmp/ffmpeg_build/lib" "-L" "/usr/local/Cellar/libx11/1.8.6/lib" "-L" "/Users/huwence/Projects/rsmpeg/tmp/ffmpeg_build/lib" "-L" "/usr/local/Cellar/libvpx/1.13.0/lib" "-L" "/usr/local/Cellar/x264/r3095/lib" "-L" "/Users/huwence/Projects/rsmpeg/tmp/ffmpeg_build/lib" "-L" "/usr/local/Cellar/libx11/1.8.6/lib" "-L" "/Users/huwence/Projects/rsmpeg/tmp/ffmpeg_build/lib" "-L" "/usr/local/Cellar/libx11/1.8.6/lib" "-L" "/Users/huwence/Projects/rsmpeg/tmp/ffmpeg_build/lib" "-L" "/usr/local/Cellar/libx11/1.8.6/lib" "-L" "/Users/huwence/Projects/rsmpeg/tmp/ffmpeg_build/lib" "-L" "/usr/local/Cellar/libx11/1.8.6/lib" "-L" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/huwence/Projects/dk_screen/target/debug/deps/libanyhow-ea96a921cba7808a.rlib" "/Users/huwence/Projects/dk_screen/target/debug/deps/librsmpeg-1200272c80ab71a4.rlib" "/Users/huwence/Projects/dk_screen/target/debug/deps/libthiserror-75a61a26749a1a30.rlib" "/Users/huwence/Projects/dk_screen/target/debug/deps/librusty_ffmpeg-a6b07af02367db64.rlib" "/Users/huwence/Projects/dk_screen/target/debug/deps/liblibc-834b2509d79ca77a.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-8c7ba4cb14921aed.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-90e9ca565b042945.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libobject-464a0586d0933b26.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libmemchr-db3d1e5a32355b36.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-74798b95a0884a59.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgimli-d7b0a7d172fdaf84.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-c50e314035d07ff6.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-ed447ed716cd0465.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-4f8aa5a213a4f4a6.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libminiz_oxide-2c711c9d26ddd542.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libadler-ab666c0d9447875d.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-711ae8c2777323b0.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-dac435ef9b9ec5bd.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-16d13d5a3e9202fe.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-6817e59b6d2f2f20.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-316b477d50fb0f01.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-7ba55cce4735e904.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-399e1f4c06861f02.rlib" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-8bb525c7516034b0.rlib" "-framework" "Foundation" "-framework" "CoreAudio" "-framework" "AVFoundation" "-framework" "CoreGraphics" "-framework" "OpenGL" "-framework" "Metal" "-framework" "CoreImage" "-framework" "AppKit" "-lbz2" "-liconv" "-lz" "-framework" "Security" "-framework" "AudioToolbox" "-lm" "-framework" "VideoToolbox" "-framework" "CoreFoundation" "-framework" "CoreMedia" "-framework" "CoreVideo" "-framework" "CoreServices" "-liconv" "-lSystem" "-lc" "-lm" "-L" "/Users/huwence/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "-o" "/Users/huwence/Projects/dk_screen/target/debug/deps/dk_screen-9db57a68ab095d2f" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: Undefined symbols for architecture x86_64:
            "_CHHapticDynamicParameterIDHapticIntensityControl", referenced from:
                -[SDL_RumbleMotor setIntensity:] in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_CHHapticEventParameterIDHapticIntensity", referenced from:
                -[SDL_RumbleMotor setIntensity:] in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_CHHapticEventTypeHapticContinuous", referenced from:
                -[SDL_RumbleMotor setIntensity:] in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_FFCreateDevice", referenced from:
                _DARWIN_JoystickRumble in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
                _SDL_SYS_HapticOpenFromService in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_FFDeviceCreateEffect", referenced from:
                _DARWIN_JoystickRumble in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
                _SDL_SYS_HapticNewEffect in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_FFDeviceGetForceFeedbackCapabilities", referenced from:
                _SDL_SYS_HapticOpenFromService in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_FFDeviceGetForceFeedbackProperty", referenced from:
                _SDL_SYS_HapticOpenFromService in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_FFDeviceReleaseEffect", referenced from:
                _JoystickDeviceWasRemovedCallback in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
                _SDL_SYS_HapticDestroyEffect in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_FFDeviceSendForceFeedbackCommand", referenced from:
                _DARWIN_JoystickRumble in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
                _SDL_SYS_HapticOpenFromService in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
                _SDL_SYS_HapticPause in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
                _SDL_SYS_HapticUnpause in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
                _SDL_SYS_HapticStopAll in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_FFDeviceSetForceFeedbackProperty", referenced from:
                _SDL_SYS_HapticSetGain in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
                _SDL_SYS_HapticSetAutocenter in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_FFEffectGetEffectStatus", referenced from:
                _SDL_SYS_HapticGetEffectStatus in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_FFEffectSetParameters", referenced from:
                _DARWIN_JoystickRumble in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
                _SDL_SYS_HapticUpdateEffect in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_FFEffectStart", referenced from:
                _DARWIN_JoystickRumble in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
                _SDL_SYS_HapticRunEffect in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_FFEffectStop", referenced from:
                _SDL_SYS_HapticStopEffect in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_FFIsForceFeedback", referenced from:
                _JoystickDeviceWasAddedCallback in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
                _MacHaptic_MaybeAddDevice in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_FFReleaseDevice", referenced from:
                _JoystickDeviceWasRemovedCallback in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
                _SDL_SYS_HapticOpenFromService in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
                _SDL_SYS_HapticClose in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_GCControllerDidConnectNotification", referenced from:
                _IOS_JoystickInit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
                _IOS_JoystickQuit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCControllerDidDisconnectNotification", referenced from:
                _IOS_JoystickInit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
                _IOS_JoystickQuit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCHapticDurationInfinite", referenced from:
                -[SDL_RumbleMotor setIntensity:] in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCHapticsLocalityHandles", referenced from:
                _IOS_JoystickGetCapabilities in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCHapticsLocalityLeftHandle", referenced from:
                _IOS_JoystickInitRumble in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCHapticsLocalityLeftTrigger", referenced from:
                _IOS_JoystickInitRumble in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCHapticsLocalityRightHandle", referenced from:
                _IOS_JoystickInitRumble in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCHapticsLocalityRightTrigger", referenced from:
                _IOS_JoystickInitRumble in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCHapticsLocalityTriggers", referenced from:
                _IOS_JoystickGetCapabilities in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputButtonA", referenced from:
                _IOS_GameControllerGetAppleSFSymbolsNameForButton in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputButtonB", referenced from:
                _IOS_GameControllerGetAppleSFSymbolsNameForButton in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputButtonHome", referenced from:
                _IOS_GameControllerGetAppleSFSymbolsNameForButton in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputButtonMenu", referenced from:
                _IOS_GameControllerGetAppleSFSymbolsNameForButton in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputButtonOptions", referenced from:
                _IOS_GameControllerGetAppleSFSymbolsNameForButton in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputButtonX", referenced from:
                _IOS_GameControllerGetAppleSFSymbolsNameForButton in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputButtonY", referenced from:
                _IOS_GameControllerGetAppleSFSymbolsNameForButton in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputDualShockTouchpadButton", referenced from:
                _IOS_GameControllerGetAppleSFSymbolsNameForButton in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
                _IOS_AddJoystickDevice in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
                _IOS_MFIJoystickUpdate in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputDualShockTouchpadOne", referenced from:
                _IOS_MFIJoystickUpdate in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputDualShockTouchpadTwo", referenced from:
                _IOS_MFIJoystickUpdate in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputLeftShoulder", referenced from:
                _IOS_GameControllerGetAppleSFSymbolsNameForButton in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputLeftThumbstick", referenced from:
                l_switch.table.IOS_GameControllerGetAppleSFSymbolsNameForAxis in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputLeftThumbstickButton", referenced from:
                _IOS_GameControllerGetAppleSFSymbolsNameForButton in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputLeftTrigger", referenced from:
                l_switch.table.IOS_GameControllerGetAppleSFSymbolsNameForAxis in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputRightShoulder", referenced from:
                _IOS_GameControllerGetAppleSFSymbolsNameForButton in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputRightThumbstick", referenced from:
                l_switch.table.IOS_GameControllerGetAppleSFSymbolsNameForAxis in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputRightThumbstickButton", referenced from:
                _IOS_GameControllerGetAppleSFSymbolsNameForButton in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputRightTrigger", referenced from:
                l_switch.table.IOS_GameControllerGetAppleSFSymbolsNameForAxis in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputXboxPaddleFour", referenced from:
                _IOS_GameControllerGetAppleSFSymbolsNameForButton in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
                _IOS_AddJoystickDevice in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
                _IOS_MFIJoystickUpdate in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputXboxPaddleOne", referenced from:
                _IOS_GameControllerGetAppleSFSymbolsNameForButton in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
                _IOS_AddJoystickDevice in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
                _IOS_MFIJoystickUpdate in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputXboxPaddleThree", referenced from:
                _IOS_GameControllerGetAppleSFSymbolsNameForButton in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
                _IOS_AddJoystickDevice in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
                _IOS_MFIJoystickUpdate in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_GCInputXboxPaddleTwo", referenced from:
                _IOS_GameControllerGetAppleSFSymbolsNameForButton in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
                _IOS_AddJoystickDevice in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
                _IOS_MFIJoystickUpdate in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_IODispatchCalloutFromMessage", referenced from:
                _SDL_hid_device_change_count_REAL in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
            "_IODisplayCreateInfoDictionary", referenced from:
                _Cocoa_InitModes in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_cocoamodes.o)
            "_IOHIDDeviceClose", referenced from:
                _PLATFORM_hid_close in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
            "_IOHIDDeviceCopyMatchingElements", referenced from:
                _JoystickDeviceWasAddedCallback in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDDeviceGetProperty", referenced from:
                _get_int_property in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _PLATFORM_make_path in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _get_string_property in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _JoystickDeviceWasAddedCallback in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDDeviceGetReport", referenced from:
                _PLATFORM_hid_get_feature_report in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
            "_IOHIDDeviceGetService", referenced from:
                _JoystickDeviceWasAddedCallback in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDDeviceGetValue", referenced from:
                _GetHIDElementState in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDDeviceOpen", referenced from:
                _PLATFORM_hid_open_path in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
            "_IOHIDDeviceRegisterInputReportCallback", referenced from:
                _PLATFORM_hid_open_path in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _PLATFORM_hid_close in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
            "_IOHIDDeviceRegisterRemovalCallback", referenced from:
                _JoystickDeviceWasAddedCallback in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDDeviceScheduleWithRunLoop", referenced from:
                _PLATFORM_read_thread in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _PLATFORM_hid_close in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _JoystickDeviceWasAddedCallback in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDDeviceSetReport", referenced from:
                _set_report in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
            "_IOHIDDeviceUnscheduleFromRunLoop", referenced from:
                _PLATFORM_hid_close in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _FreeDevice in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDElementGetChildren", referenced from:
                _AddHIDElement in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDElementGetCookie", referenced from:
                _AddHIDElement in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDElementGetLogicalMax", referenced from:
                _AddHIDElement in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDElementGetLogicalMin", referenced from:
                _AddHIDElement in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDElementGetType", referenced from:
                _AddHIDElement in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDElementGetTypeID", referenced from:
                _AddHIDElement in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDElementGetUsage", referenced from:
                _AddHIDElement in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDElementGetUsagePage", referenced from:
                _AddHIDElement in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDManagerClose", referenced from:
                _PLATFORM_hid_exit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _DARWIN_JoystickQuit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDManagerCopyDevices", referenced from:
                _PLATFORM_hid_enumerate in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _PLATFORM_hid_open_path in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
            "_IOHIDManagerCreate", referenced from:
                _PLATFORM_hid_init in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _DARWIN_JoystickInit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDManagerOpen", referenced from:
                _DARWIN_JoystickInit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDManagerRegisterDeviceMatchingCallback", referenced from:
                _DARWIN_JoystickInit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDManagerRegisterDeviceRemovalCallback", referenced from:
                _PLATFORM_hid_init in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
            "_IOHIDManagerScheduleWithRunLoop", referenced from:
                _PLATFORM_hid_init in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _DARWIN_JoystickInit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDManagerSetDeviceMatchingMultiple", referenced from:
                _PLATFORM_hid_init in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _DARWIN_JoystickInit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDManagerUnscheduleFromRunLoop", referenced from:
                _DARWIN_JoystickQuit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOHIDValueGetIntegerValue", referenced from:
                _GetHIDElementState in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_iokitjoystick.o)
            "_IOIteratorIsValid", referenced from:
                _SDL_SYS_HapticInit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_IOIteratorNext", referenced from:
                _SDL_hid_device_change_count_REAL in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _CallbackIOServiceFunc in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _SDL_SYS_HapticInit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_IONotificationPortCreate", referenced from:
                _SDL_hid_device_change_count_REAL in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
            "_IONotificationPortDestroy", referenced from:
                _SDL_hid_exit_REAL in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _SDL_hid_device_change_count_REAL in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
            "_IONotificationPortGetMachPort", referenced from:
                _SDL_hid_device_change_count_REAL in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
            "_IOObjectIsEqualTo", referenced from:
                _MacHaptic_MaybeAddDevice in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
                _MacHaptic_MaybeRemoveDevice in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
                _SDL_SYS_JoystickSameHaptic in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
                _SDL_SYS_HapticOpenFromJoystick in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_IOObjectRelease", referenced from:
                _SDL_hid_device_change_count_REAL in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _CallbackIOServiceFunc in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _SDL_SYS_HapticInit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
                _MacHaptic_MaybeAddDevice in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
                _MacHaptic_MaybeRemoveDevice in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
                _SDL_SYS_HapticQuit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_IOObjectRetain", referenced from:
                _MacHaptic_MaybeAddDevice in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_IOPMAssertionCreateWithDescription", referenced from:
                _Cocoa_SuspendScreenSaver in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_cocoaevents.o)
            "_IOPMAssertionRelease", referenced from:
                _Cocoa_SuspendScreenSaver in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_cocoaevents.o)
            "_IOPSCopyPowerSourcesInfo", referenced from:
                _SDL_GetPowerInfo_MacOSX in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syspower.o)
            "_IOPSCopyPowerSourcesList", referenced from:
                _SDL_GetPowerInfo_MacOSX in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syspower.o)
            "_IOPSGetPowerSourceDescription", referenced from:
                _SDL_GetPowerInfo_MacOSX in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syspower.o)
            "_IORegistryEntryCreateCFProperties", referenced from:
                _MacHaptic_MaybeAddDevice in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_IORegistryEntryGetParentEntry", referenced from:
                _MacHaptic_MaybeAddDevice in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_IOServiceAddMatchingNotification", referenced from:
                _SDL_hid_device_change_count_REAL in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
            "_IOServiceGetMatchingServices", referenced from:
                _SDL_SYS_HapticInit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_IOServiceMatching", referenced from:
                _SDL_hid_device_change_count_REAL in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _SDL_SYS_HapticInit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_KBGetLayoutType", referenced from:
                _UpdateKeymap in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_cocoakeyboard.o)
                _Cocoa_HandleKeyEvent in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_cocoakeyboard.o)
            "_LMGetKbdType", referenced from:
                _UpdateKeymap in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_cocoakeyboard.o)
                _Cocoa_HandleKeyEvent in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_cocoakeyboard.o)
            "_OBJC_CLASS_$_CHHapticDynamicParameter", referenced from:
                objc-class-ref in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_OBJC_CLASS_$_CHHapticEvent", referenced from:
                objc-class-ref in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_OBJC_CLASS_$_CHHapticEventParameter", referenced from:
                objc-class-ref in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_OBJC_CLASS_$_CHHapticPattern", referenced from:
                objc-class-ref in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_OBJC_CLASS_$_GCColor", referenced from:
                objc-class-ref in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_OBJC_CLASS_$_GCController", referenced from:
                objc-class-ref in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_mfijoystick.o)
            "_TISCopyCurrentKeyboardLayoutInputSource", referenced from:
                _UpdateKeymap in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_cocoakeyboard.o)
            "_TISGetInputSourceProperty", referenced from:
                _UpdateKeymap in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_cocoakeyboard.o)
            "_XauDisposeAuth", referenced from:
                __xcb_get_auth_info in librusty_ffmpeg-a6b07af02367db64.rlib(xcb_auth.o)
            "_XauGetBestAuthByAddr", referenced from:
                __xcb_get_auth_info in librusty_ffmpeg-a6b07af02367db64.rlib(xcb_auth.o)
            "_XdmcpWrap", referenced from:
                __xcb_get_auth_info in librusty_ffmpeg-a6b07af02367db64.rlib(xcb_auth.o)
            "_kIOMainPortDefault", referenced from:
                _SDL_hid_device_change_count_REAL in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_hidapi.o)
                _SDL_SYS_HapticInit in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_syshaptic.o)
            "_kTISPropertyUnicodeKeyLayoutData", referenced from:
                _UpdateKeymap in librusty_ffmpeg-a6b07af02367db64.rlib(SDL_cocoakeyboard.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

target cross platform support

hello, it looks like you do not support different targets, like, I want to support cross compiling for linux, android, windows, etc, so, currently I'm doing

FFMPEG_LIBS_DIR=/home/dev/project/deps/ffmpeg/build/linux/x86_64/lib/pkgconfig \
FFMPEG_INCLUDE_DIR=/home/dev/project/deps/ffmpeg/build/linux/x86_64/include

I could set each one before building, but wouldn't it be better to make something more automated where it can support all types?

mutable `data_mut` and `linesize_mut`

at https://github.com/larksuite/rsmpeg/blob/master/src/avutil/frame.rs#L76, these two

    pub fn data_mut(&mut self) -> &mut [*mut u8; 8] {
        unsafe { &mut self.deref_mut().data }
    }

    pub fn linesize_mut(&mut self) -> &mut [libc::c_int; 8] {
        unsafe { &mut self.deref_mut().linesize }
    }

are mutable. Can I do versions for &self? Also, why it returns &mut [*mut u8; 8] and not &mut [&mut[u8]]? I have to rely on usafe outside of the library to do std::slice::from_raw_parts (is it even safe?)

某个 mp4 生成缩略图失败

video.mp4

下载这个 mp4,替换 tests/assets/vids/bear.mp4,然后执行 thumbnail 测试:

wget https://user-images.githubusercontent.com/1524609/131678290-c6b90aee-d018-4078-99b4-45cc410bd67b.mp4 -O video.mp4
cp video.mp4 tests/assets/vids/bear.mp4
cargo test --test thumbnail

会得到如下错误:

    Finished test [unoptimized + debuginfo] target(s) in 0.04s
     Running tests/thumbnail.rs (target/debug/deps/thumbnail-fb8cd98fade3377b)

running 1 test
test thumbnail_test ... FAILED

failures:

---- thumbnail_test stdout ----
thread 'thumbnail_test' panicked at 'called `Result::unwrap()` on an `Err` value: Cannnot find video cover packet', tests/thumbnail.rs:132:6
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    thumbnail_test

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

error: test failed, to rerun pass '--test thumbnail'

fatal error LNK1181: cannot open input file 'bin.lib' in win10

Run “cargo build” is ok
The following error occurred when running "cargo run --example shadertoy"

..."C:\Users\w\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcompiler_builtins-0f3806ca1d72c7be.rlib" "bin.lib" "opengl32.lib" "gdi32.lib" "user32.lib" "shell32.lib" "advapi32.lib" "cfgmgr32.lib" "credui.lib" "gdi32.lib" "kernel32.lib" "msimg32.lib" "opengl32.lib" "secur32.lib" "user32.lib" "winspool.lib" "kernel32.lib" "ws2_32.lib" "advapi32.lib" "userenv.lib" "kernel32.lib" "libcmt.lib" "/NXCOMPAT" "/LIBPATH:C:\Users\w\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib" "/OUT:C:\other\rsmpeg\target\debug\examples\shadertoy.exe" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\Users\w\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\intrinsic.natvis" "/NATVIS:C:\Users\w\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\liballoc.natvis" "/NATVIS:C:\Users\w\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\libcore.natvis" "/NATVIS:C:\Users\w\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\libstd.natvis"
= note: LINK : fatal error LNK1181: cannot open input file 'bin.lib'

error: aborting due to previous error

error: could not compile rsmpeg

Caused by:
process didn't exit successfully: rustc --crate-name shadertoy --edition=2018 examples\shadertoy.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=a6c024520f0f1717 --out-dir C:\other\rsmpeg\target\debug\examples -C incremental=C:\other\rsmpeg\target\debug\incremental -L dependency=C:\other\rsmpeg\target\debug\deps --extern anyhow=C:\other\rsmpeg\target\debug\deps\libanyhow-aac36a585e39dec0.rlib --extern cstr=C:\other\rsmpeg\target\debug\deps\cstr-bd7a940b0e069e57.dll --extern env_logger=C:\other\rsmpeg\target\debug\deps\libenv_logger-4d58fb072faef0cd.rlib --extern gl=C:\other\rsmpeg\target\debug\deps\libgl-a6a63575228fb3f7.rlib --extern glfw=C:\other\rsmpeg\target\debug\deps\libglfw-0dec44ffa560978f.rlib --extern libc=C:\other\rsmpeg\target\debug\deps\liblibc-40c4f9b1ccf0e38b.rlib --extern log=C:\other\rsmpeg\target\debug\deps\liblog-e0d660174d079955.rlib --extern once_cell=C:\other\rsmpeg\target\debug\deps\libonce_cell-74b4d97d099287d3.rlib --extern paste=C:\other\rsmpeg\target\debug\deps\paste-c0de4a0431d89d62.dll --extern rsmpeg=C:\other\rsmpeg\target\debug\deps\librsmpeg-c8af3314532851e3.rlib --extern rusty_ffmpeg=C:\other\rsmpeg\target\debug\deps\librusty_ffmpeg-b2d3c1caf20494e4.rlib --extern tempdir=C:\other\rsmpeg\target\debug\deps\libtempdir-79b947ca5a5a7811.rlib --extern thiserror=C:\other\rsmpeg\target\debug\deps\libthiserror-c66c5cfd5369a7cf.rlib -Ctarget-feature=+crt-static -L native=C:\other\rsmpeg\target\debug\build\glfw-sys-d6813c780a0799e8\out\lib -L native=C:\other\vcpkg\packages\ffmpeg_x64-windows (exit code: 1)

重新封装,不做解编码

想用rsmpeg 实现下面的功能,因为ffmpeg 是lgpl 协议所有没有libx264 依赖。
./ffmpeg -r 30 -i xxxx.h264 -c:v copy -f mp4 xxxxx.mp4

基于tests/avio_writing.rs 删除了decode 和encode 部分, 但是无法通过 AVframe去设置 pts 时间,导致程序报错,请给一些建议。
image

图片来自此连接-章节2-重新封装

添加了rustflags后,运行示例代码还是出现链接错误。

一开始运行示例代码出现链接错误后,我看到issues里也有类似情况,需要在cargo.toml里添加rustflag链接需要的库,但是我按照说明修改后,依然不起作用,还是同样的错误。我试着自己捣鼓了一天还是无果,只能来这里问了,希望大佬能解答一下。

这是我的cargo.toml文件内容:

name = "mpp"
version = "0.1.0"
edition = "2021"

[target.x86_64-pc-windows-msvc]
rustflags = [
    "-C", "link-arg=Mfplat.lib",
    "-C", "link-arg=Strmiids.lib",
    "-C", "link-arg=Mfuuid.lib",
    "-C", "link-arg=Bcrypt.lib",
    "-C", "link-arg=Secur32.lib",
    "-C", "link-arg=Ole32.lib",
    "-C", "link-arg=User32.lib"
]

[package.metadata.vcpkg]
dependencies = ["ffmpeg[x264,vpx]:x64-windows-static-md"]
git = "https://github.com/microsoft/vcpkg"
rev = "4a600e9"

[dependencies]
rsmpeg = "0.14.1"

但是还是出现了链接错误:

warning: unused manifest key: target.x86_64-pc-windows-msvc.rustflags
   Compiling mpp v0.1.0 (C:\code\mpp)
error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\kingc\\AppData\\Local\\Temp\\rustc0nc0qa\\symbols.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.10jfcsiaohwsu7cy.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.1dwaetaehtiebkcu.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.1ed1ptovfh1zsixm.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.1hzpawfxlu5lp3a2.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.1iewuom7lyfjb8fq.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.1y5vlv8aaw348wqu.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.23zz3tt4b91iucnp.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.29b3duq5ue6lg260.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.2gz7pe9298fgv2q6.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.30nxobijqurwnf47.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.36x9phlhh8s6c4pm.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.3k7mw3lhlwihw0eg.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.4aq327kwfuohyj43.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.4k70t6unlscoiv4i.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.4mn3q0dp8trvidb2.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.4rpuwgstct9jq33s.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.4v4xoyuimyttc4jd.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.7k1nj8zrix8f36j.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.e49rv0g5d6gs6ft.rcgu.o" "C:\\code\\mpp\\target\\debug\\deps\\mpp.1tbkblyq3dbj18l6.rcgu.o" "/LIBPATH:C:\\code\\mpp\\target\\debug\\deps" "/LIBPATH:C:\\code\\mpp\\target\\vcpkg\\installed\\x64-windows-static-md\\lib" "/LIBPATH:C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\code\\mpp\\target\\debug\\deps\\librsmpeg-8a0e3a4cbd4d6468.rlib" "C:\\code\\mpp\\target\\debug\\deps\\libthiserror-1b34f2ea5416241a.rlib" "C:\\code\\mpp\\target\\debug\\deps\\librusty_ffmpeg-7bdaa30b8b9fde02.rlib" "C:\\code\\mpp\\target\\debug\\deps\\liblibc-eca98e9b7510f5a2.rlib" "C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-e493bcbfdc66a475.rlib" "C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-467acea86c440d1f.rlib" "C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-8bcec20f8d868561.rlib" "C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_detect-e75d865d889e433e.rlib" "C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-cd24a5810f58b720.rlib" "C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-44b4ecbbc95939b2.rlib" "C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-ff93d2b34eb6aecc.rlib" "C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-17346c417f0e9166.rlib" "C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-ff5a06ebf4571d10.rlib" "C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-cb2478631e21007b.rlib" "C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-58d59322b34f2b51.rlib" "C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-c192803e6895f627.rlib" "C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-20106e86b5dab94f.rlib" "avdevice.lib" "avfilter.lib" "avformat.lib" "avcodec.lib" "swresample.lib" "swscale.lib" "avutil.lib" "libx264.lib" "vpx.lib" "legacy_stdio_definitions.lib" "kernel32.lib" "advapi32.lib" "bcrypt.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "kernel32.lib" "ws2_32.lib" "kernel32.lib" "ntdll.lib" "kernel32.lib" "msvcrt.lib" "/NXCOMPAT" "/LIBPATH:C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "/OUT:C:\\code\\mpp\\target\\debug\\deps\\mpp.exe" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\kingc\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis"
  = note: avformat.lib(tls_schannel.o) : error LNK2019: 无法解析的外部符号 AcquireCredentialsHandleA,函数 tls_open 中引用了该符号
          avformat.lib(tls_schannel.o) : error LNK2019: 无法解析的外部符号 __imp_FreeCredentialsHandle,函数 tls_close 中引用了该符号
          avformat.lib(tls_schannel.o) : error LNK2019: 无法解析的外部符号 InitializeSecurityContextA,函数 tls_close 中引用了该符号
          avformat.lib(tls_schannel.o) : error LNK2019: 无法解析的外部符号 __imp_DeleteSecurityContext,函数 tls_close 中引用了该符号
          avformat.lib(tls_schannel.o) : error LNK2019: 无法解析的外部符号 __imp_ApplyControlToken,函数 tls_close 中引用了该符号
          avformat.lib(tls_schannel.o) : error LNK2019: 无法解析的外部符号 QueryContextAttributesA,函数 tls_write 中引用了该符号
          avformat.lib(tls_schannel.o) : error LNK2019: 无法解析的外部符号 FreeContextBuffer,函数 tls_close 中引用了该符号
          avformat.lib(tls_schannel.o) : error LNK2019: 无法解析的外部符号 EncryptMessage,函数 tls_write 中引用了该符号
          avformat.lib(tls_schannel.o) : error LNK2019: 无法解析的外部符号 DecryptMessage,函数 tls_read 中引用了该符号
          avcodec.lib(mfenc.o) : error LNK2001: 无法解析的外部符号 IID_ICodecAPI
          avcodec.lib(mfenc.o) : error LNK2001: 无法解析的外部符号 IID_IMFMediaEventGenerator
          avcodec.lib(mf_utils.o) : error LNK2019: 无法解析的外部符号 __imp_CoUninitialize,函数 ff_free_mf 中引用了该符号
          avcodec.lib(mf_utils.o) : error LNK2019: 无法解析的外部符号 __imp_CoInitializeEx,函数 ff_instantiate_mf 中引用了该符号
          avcodec.lib(mf_utils.o) : error LNK2019: 无法解析的外部符号 __imp_CoTaskMemFree,函数 ff_instantiate_mf 中引用了该符号
          avcodec.lib(dxva2.o) : error LNK2001: 无法解析的外部符号 __imp_CoTaskMemFree
          avcodec.lib(mf_utils.o) : error LNK2001: 无法解析的外部符号 IID_IMFTransform
          avutil.lib(hwcontext_dxva2.o) : error LNK2019: 无法解析的外部符号 __imp_GetDesktopWindow,函数 dxva2_device_create 中引用了该符号
          C:\code\mpp\target\debug\deps\mpp.exe : fatal error LNK1120: 16 个无法解析的外部命令


error: could not compile `mpp` (bin "mpp") due to 1 previous error

Can the AVformatContextInput::from_io_context interface add an optional AVdictionary parameter?

pub fn open_memory_file(data: Arc<Vec<u8>>) -> Result<AVFormatContextInput> {
    let mut current = 0;
    let io_context = AVIOContextCustom::alloc_context(
        AVMem::new(1048576),
        false,
        vec![],
        Some(Box::new(move |_, buf| {
            let right = data.len().min(current + buf.len());
            if right <= current {
                return ffi::AVERROR_EOF;
            }
            let read_len = right - current;
            buf[0..read_len].copy_from_slice(&data[current..right]);
            current = right;
            read_len as i32
        })),
        None,
        None,
    );
    let input_format_context = match AVFormatContextInput::from_io_context(
        rsmpeg::avformat::AVIOContextContainer::Custom(io_context),
    ) {
        Ok(x) => x,
        Err(e) => {
            bail!("open file default:{}", e);
        }
    };
    Ok(input_format_context)
}

The above code will have the following output for some files

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ffff0000f40] stream 0, offset 0x30: partial file
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ffff0000f40] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none(tv, bt709), 720x1280, 11185 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options

But if I use AVformatContextInput::open() to open a file that exists on disk it works fine.

incorrect framerate and duration

use image::ImageResult;
use rsmpeg::avcodec::{AVCodec, AVCodecContext};
use rsmpeg::avformat::AVFormatContextOutput;
use rsmpeg::avutil::{AVFrame, AVRational};
use rsmpeg::ffi::{
    AVCodecID_AV_CODEC_ID_H264, AVPixelFormat_AV_PIX_FMT_RGB24, AVPixelFormat_AV_PIX_FMT_YUV420P,
    SWS_BILINEAR,
};
use rsmpeg::swscale::SwsContext;

use cstr::cstr;

fn main() -> ImageResult<()> {
    let img = image::open("./stodownload-0031.png")?.to_rgb8();
    let width = img.width();
    let height = img.height();
    let data = img.into_raw();

    let codec = AVCodec::find_encoder(AVCodecID_AV_CODEC_ID_H264).unwrap();
    let mut encoder = AVCodecContext::new(&codec);
    encoder.set_width(width as i32);
    encoder.set_height(height as i32);
    encoder.set_pix_fmt(AVPixelFormat_AV_PIX_FMT_YUV420P);
    encoder.set_bit_rate(400_000);
    encoder.set_time_base(AVRational { num: 1, den: 25 });
    encoder.set_framerate(AVRational { num: 25, den: 1 });
    encoder.set_gop_size(10);
    encoder.open(None).unwrap();

    let mut rgb_frame = AVFrame::new();
    rgb_frame.set_width(width as _);
    rgb_frame.set_height(height as _);
    rgb_frame.set_format(AVPixelFormat_AV_PIX_FMT_RGB24);

    unsafe {
        rgb_frame
            .fill_arrays(
                data.as_ptr(),
                AVPixelFormat_AV_PIX_FMT_RGB24,
                width as _,
                height as _,
            )
            .unwrap();
    }
    let mut yuv_frame = AVFrame::new();
    yuv_frame.set_width(encoder.width);
    yuv_frame.set_height(encoder.height);
    yuv_frame.set_format(encoder.pix_fmt);
    yuv_frame.alloc_buffer().unwrap();

    let mut sws_context = SwsContext::get_context(
        rgb_frame.width,
        rgb_frame.height,
        AVPixelFormat_AV_PIX_FMT_RGB24,
        yuv_frame.width,
        yuv_frame.height,
        AVPixelFormat_AV_PIX_FMT_YUV420P,
        SWS_BILINEAR,
    )
    .unwrap();
    sws_context
        .scale_frame(&rgb_frame, 0, rgb_frame.height, &mut yuv_frame)
        .unwrap();

    let mut output = AVFormatContextOutput::create(cstr!("./png_mov.mp4")).unwrap();
    output
        .new_stream(None)
        .set_codecpar(encoder.extract_codecpar());
    output.write_header().unwrap();
    for i in 0..=25 {
        yuv_frame.set_pts(i * 10);

        if i == 25 {
            encoder.send_frame(None).unwrap();
        } else {
            encoder.send_frame(Some(&yuv_frame)).unwrap();
        }
        loop {
            let mut pkt = match encoder.receive_packet() {
                Ok(pkt) => pkt,
                _ => break,
            };
            output.interleaved_write_frame(&mut pkt).unwrap();
        }
    }

    output.write_trailer().unwrap();

    Ok(())
}

The encoder has set the relevant information, but the framerate and duration of the output video are not correct.

tests示例transcode.rs中有一些方法在文档中找不到,无法通过编译

我正在看tests中的示例代码transcode.rs学习怎么转码视频,但是编译器报错有几个方法找不到,我在文档中也没有找到,所以想请问一下:
一个是196行:

  if dec_ctx.ch_layout.order == ffi::AVChannelOrder_AV_CHANNEL_ORDER_UNSPEC {
      dec_ctx.set_ch_layout(
          AVChannelLayout::from_nb_channels(dec_ctx.ch_layout.nb_channels).into_inner(),
      );
  }

在结构体AVChannelLayout上,找不到方法from_nb_channels
还有一个是362行:

    loop {
        let mut filtered_frame = match buffersink_ctx.buffersink_get_frame(None) {
            Ok(frame) => frame,
            Err(RsmpegError::BufferSinkDrainError) | Err(RsmpegError::BufferSinkEofError) => break,
            Err(_) => bail!("Get frame from buffer sink failed."),
        };

        filtered_frame.set_time_base(buffersink_ctx.get_time_base());
        filtered_frame.set_pict_type(ffi::AVPictureType_AV_PICTURE_TYPE_NONE);

        encode_write_frame(Some(filtered_frame), enc_ctx, ofmt_ctx, stream_index)?;
    }

filtered_frame类型是AVFrame,上面没有set_time_base方法
buffersink_ctx类型是AVFilterContextMut,上面也没有get_time_base方法

Running Example Error

Code:
git: rsmpeg-vcpkg-demo

C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master>echo %FFMPEG_PKG_CONFIG_PATH%
D:\vcpkg\installed\x64-windows-static-md\lib\pkgconfig

C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master>cargo vcpkg --verbose build
vcpkg root is D:\vcpkg
Fetching vcpkg

Message::

error: linking with link.exe failed: exit code: 1120
|
= note: "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\bin\HostX64\x64\link.exe" "/NOLOGO" "C:\Users\AA\AppData\Local\Temp\rustcUDebEn\symbols.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.14x009273zxltdzv.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.19ii64hvjq260mbw.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.265vt5w16atk6yqt.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.3hmyt0n3tadbqiqn.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.45z8zrhtcgwwtyrv.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.4amt6abzq6la6yx6.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.4n4c25295805ecq2.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.4petkjx744kw5ie5.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.5gpvfka59ser635i.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.pgoc93qhmn1nszl.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.ypkxbmvjwho5n88.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.3l5ane5fnmp7mtza.rcgu.o" "/LIBPATH:C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps" "/LIBPATH:D:\vcpkg\installed\x64-windows-static-md\lib" "/LIBPATH:C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\librsmpeg-a432ad4d72d4fcbc.rlib" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\libthiserror-203060b4736bfe63.rlib" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\librusty_ffmpeg-e40ef72c28dc502c.rlib" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\liblibc-d8595f7c09b145ad.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libstd-0f357f0f8e8eb48f.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libpanic_unwind-57325150de1d69ac.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\librustc_demangle-7a221d01d4c27fb2.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libstd_detect-7bffc6b402bc9229.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libhashbrown-3fd39796b57f4908.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\librustc_std_workspace_alloc-8572e8a98839f6d6.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libminiz_oxide-6e930372a69395c9.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libadler-ad696ea66c589e9d.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libunwind-0a3e7125dc6e7fef.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcfg_if-7d7ae0874b44dfcc.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\liblibc-2e82681b8e87518e.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\liballoc-5ed5a0d27d7423da.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\librustc_std_workspace_core-e970d604d303b37d.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcore-e73f27a013927059.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcompiler_builtins-fbb34b1faced902f.rlib" "avdevice.lib" "avfilter.lib" "avformat.lib" "avcodec.lib" "swresample.lib" "swscale.lib" "avutil.lib" "libx264.lib" "vpx.lib" "legacy_stdio_definitions.lib" "kernel32.lib" "advapi32.lib" "bcrypt.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "kernel32.lib" "ws2_32.lib" "kernel32.lib" "msvcrt.lib" "/NXCOMPAT" "/LIBPATH:C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib" "/OUT:C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.exe" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\intrinsic.natvis" "/NATVIS:C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\liballoc.natvis" "/NATVIS:C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\libcore.natvis" "/NATVIS:C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\libstd.natvis"
= note: avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol AcquireCredentialsHandleA referenced in function tls_open
avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol __imp_FreeCredentialsHandle referenced in function tls_close
avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol InitializeSecurityContextA referenced in function tls_close
avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol __imp_DeleteSecurityContext referenced in function tls_close
avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol __imp_ApplyControlToken referenced in function tls_close
avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol QueryContextAttributesA referenced in function tls_write
avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol FreeContextBuffer referenced in function tls_close
avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol EncryptMessage referenced in function tls_write
avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol DecryptMessage referenced in function tls_read
avcodec.lib(mfenc.o) : error LNK2001: unresolved external symbol IID_ICodecAPI
avcodec.lib(mfenc.o) : error LNK2001: unresolved external symbol IID_IMFMediaEventGenerator
avcodec.lib(mf_utils.o) : error LNK2019: unresolved external symbol __imp_CoUninitialize referenced in function ff_free_mf
avcodec.lib(mf_utils.o) : error LNK2019: unresolved external symbol __imp_CoInitializeEx referenced in function ff_instantiate_mf
avcodec.lib(mf_utils.o) : error LNK2019: unresolved external symbol __imp_CoTaskMemFree referenced in function ff_instantiate_mf
avcodec.lib(dxva2.o) : error LNK2001: unresolved external symbol __imp_CoTaskMemFree
avcodec.lib(mf_utils.o) : error LNK2001: unresolved external symbol IID_IMFTransform
avutil.lib(hwcontext_dxva2.o) : error LNK2019: unresolved external symbol __imp_GetDesktopWindow referenced in function dxva2_device_create
C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.exe : fatal error LNK1120: 16 unresolved externals

error: could not compile rsmpeg-vcpkg-demo (bin "rsmpeg-vcpkg-demo") due to previous error

C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master>
C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master>
C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master>cargo vcpkg --verbose build
vcpkg root is D:\vcpkg
Fetching vcpkg
POST git-upload-pack (165 bytes)
From https://github.com/microsoft/vcpkg
= [up to date] master -> origin/master
Checkout rev 4a600e9
HEAD is now at 4a600e9fe [google-cloud-cpp] update to latest release (v2.14.0) (#33503)
-- stdout --
Using local portfile versions. To update the local portfiles, use git pull.
No packages need updating.

-- stderr --

ExitStatus(ExitStatus(0))
Installing ffmpeg[x264,vpx]:x64-windows-static-md
Computing installation plan...
The following packages are already installed:
ffmpeg[core,x264,vpx,swscale,swresample,gpl,avformat,avfilter,avdevice,avcodec]:x64-windows-static-md -> 5.1.2#7
ffmpeg:x64-windows-static-md is already installed
Total install time: 8.9 us
To use ffmpeg add the following to your CMake project:

find_package(FFMPEG REQUIRED)
target_include_directories(main PRIVATE ${FFMPEG_INCLUDE_DIRS})
target_link_directories(main PRIVATE ${FFMPEG_LIBRARY_DIRS})
target_link_libraries(main PRIVATE ${FFMPEG_LIBRARIES})

Finished in 2.23s

C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master>
C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master>
C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master>cargo run
Compiling rsmpeg-vcpkg-demo v0.1.0 (C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master)
error: linking with link.exe failed: exit code: 1120
|
= note: "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\bin\HostX64\x64\link.exe" "/NOLOGO" "C:\Users\AA\AppData\Local\Temp\rustcmIgHqY\symbols.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.14x009273zxltdzv.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.19ii64hvjq260mbw.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.265vt5w16atk6yqt.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.3hmyt0n3tadbqiqn.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.45z8zrhtcgwwtyrv.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.4amt6abzq6la6yx6.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.4n4c25295805ecq2.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.4petkjx744kw5ie5.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.5gpvfka59ser635i.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.pgoc93qhmn1nszl.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.ypkxbmvjwho5n88.rcgu.o" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.3l5ane5fnmp7mtza.rcgu.o" "/LIBPATH:C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps" "/LIBPATH:D:\vcpkg\installed\x64-windows-static-md\lib" "/LIBPATH:C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\librsmpeg-a432ad4d72d4fcbc.rlib" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\libthiserror-203060b4736bfe63.rlib" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\librusty_ffmpeg-e40ef72c28dc502c.rlib" "C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\liblibc-d8595f7c09b145ad.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libstd-0f357f0f8e8eb48f.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libpanic_unwind-57325150de1d69ac.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\librustc_demangle-7a221d01d4c27fb2.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libstd_detect-7bffc6b402bc9229.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libhashbrown-3fd39796b57f4908.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\librustc_std_workspace_alloc-8572e8a98839f6d6.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libminiz_oxide-6e930372a69395c9.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libadler-ad696ea66c589e9d.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libunwind-0a3e7125dc6e7fef.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcfg_if-7d7ae0874b44dfcc.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\liblibc-2e82681b8e87518e.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\liballoc-5ed5a0d27d7423da.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\librustc_std_workspace_core-e970d604d303b37d.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcore-e73f27a013927059.rlib" "C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcompiler_builtins-fbb34b1faced902f.rlib" "avdevice.lib" "avfilter.lib" "avformat.lib" "avcodec.lib" "swresample.lib" "swscale.lib" "avutil.lib" "libx264.lib" "vpx.lib" "legacy_stdio_definitions.lib" "kernel32.lib" "advapi32.lib" "bcrypt.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "kernel32.lib" "ws2_32.lib" "kernel32.lib" "msvcrt.lib" "/NXCOMPAT" "/LIBPATH:C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib" "/OUT:C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.exe" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\intrinsic.natvis" "/NATVIS:C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\liballoc.natvis" "/NATVIS:C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\libcore.natvis" "/NATVIS:C:\Users\AA\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\libstd.natvis"
= note: avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol AcquireCredentialsHandleA referenced in function tls_open
avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol __imp_FreeCredentialsHandle referenced in function tls_close
avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol InitializeSecurityContextA referenced in function tls_close
avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol __imp_DeleteSecurityContext referenced in function tls_close
avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol __imp_ApplyControlToken referenced in function tls_close
avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol QueryContextAttributesA referenced in function tls_write
avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol FreeContextBuffer referenced in function tls_close
avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol EncryptMessage referenced in function tls_write
avformat.lib(tls_schannel.o) : error LNK2019: unresolved external symbol DecryptMessage referenced in function tls_read
avcodec.lib(mfenc.o) : error LNK2001: unresolved external symbol IID_ICodecAPI
avcodec.lib(mfenc.o) : error LNK2001: unresolved external symbol IID_IMFMediaEventGenerator
avcodec.lib(mf_utils.o) : error LNK2019: unresolved external symbol __imp_CoUninitialize referenced in function ff_free_mf
avcodec.lib(mf_utils.o) : error LNK2019: unresolved external symbol __imp_CoInitializeEx referenced in function ff_instantiate_mf
avcodec.lib(mf_utils.o) : error LNK2019: unresolved external symbol __imp_CoTaskMemFree referenced in function ff_instantiate_mf
avcodec.lib(dxva2.o) : error LNK2001: unresolved external symbol __imp_CoTaskMemFree
avcodec.lib(mf_utils.o) : error LNK2001: unresolved external symbol IID_IMFTransform
avutil.lib(hwcontext_dxva2.o) : error LNK2019: unresolved external symbol __imp_GetDesktopWindow referenced in function dxva2_device_create
C:\Users\AA\Desktop\rsmpeg-vcpkg-demo-master\target\debug\deps\rsmpeg_vcpkg_demo.exe : fatal error LNK1120: 16 unresolved externals

error: could not compile rsmpeg-vcpkg-demo (bin "rsmpeg-vcpkg-demo") due to previous error

Static link ffmpeg

How can I statically link ffmpeg into executable when compiling in windows inside msys2 ucrt64?
(windows-gnu rustc)

运行例子报错

cargo run
   Compiling rusty_ffmpeg v0.13.1+ffmpeg.6.0
error: failed to run custom build command for `rusty_ffmpeg v0.13.1+ffmpeg.6.0`

Caused by:
  process didn't exit successfully: `C:\workspace\rust\rsmpeg-vcpkg-demo\target\debug\build\rusty_ffmpeg-116f84f5a5ff1b98\build-script-build` (exit code: 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-search=native=C:\workspace\rust\rsmpeg-vcpkg-demo\target\vcpkg\installed\x64-windows-static-md\lib
  cargo:rustc-link-lib=avdevice
  cargo:rustc-link-lib=avfilter
  cargo:rustc-link-lib=avformat
  cargo:rustc-link-lib=avcodec
  cargo:rustc-link-lib=swresample
  cargo:rustc-link-lib=swscale
  cargo:rustc-link-lib=avutil
  cargo:rustc-link-lib=libx264
  cargo:rustc-link-lib=vpx

  --- stderr
  thread 'main' panicked at 'Unable to find libclang: "couldn't find any valid shared libraries matching: ['clang.dll', 'libclang.dll'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', C:\Users\HavocZ\.cargo\registry\src\rsproxy.cn-8f6827c7555bfaf8\bindgen-0.64.0\./lib.rs:2393:31
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Define certain types as `enum`s

As an example, AVMediaType could be enum-ified as such:

#[repr(C)]
enum AVMediaType {
    Unknown = rusty_ffmpeg::ffi::AVMediaType_AVMEDIA_TYPE_UNKNOWN,
    Video = rusty_ffmpeg::ffi::AVMediaType_AVMEDIA_TYPE_VIDEO,
    Audio = rusty_ffmpeg::ffi::AVMediaType_AVMEDIA_TYPE_AUDIO,
    Data = rusty_ffmpeg::ffi::AVMediaType_AVMEDIA_TYPE_DATA,
    Subtitle = rusty_ffmpeg::ffi::AVMediaType_AVMEDIA_TYPE_SUBTITLE,
    Attachment = rusty_ffmpeg::ffi::AVMediaType_AVMEDIA_TYPE_ATTACHMENT,
}

希望改进 AVFormatContextOutput::create 函数, 可以轻松实现 output format 的 custom io

现在接口还不是很完善, 由于我需要 output format 的 custom io, 需要实现: 不输出到文件(即文件名是null), 指定format 比如为mp4, 我需要用 custom io, 在输出format时, 拿到输出的所有数据做别的处理.
现在我的做法是修改了rsmpeg源码, 可以满足我的需求, 但是希望源码可以直接可以满足需求:
image

我的用法:
image
image

非常感谢这个库, 整体还是很好用~

SwrContext同样代码和音频,Mac中运行正常,Win报错SwrConvertError(-1668179713)

你好
SwrContext同样代码和音频,Mac中运行正常,WIndow报错SwrConvertError(-1668179713)

除此函数的其它函数,如图像转换的'sws_getContext' ,以及视频输出,在Mac、Windows同一份代码均能正常运行:

let mut audio_resample_context = SwrContext::new(
            av_get_default_channel_layout(encode_context.channels),
            encode_context.sample_fmt,
            encode_context.sample_rate,
            av_get_default_channel_layout(decode_context.channels),
            decode_context.sample_fmt,
            decode_context.sample_rate,
        ).context("Could not allocate resample context").unwrap();

// 此处报错
audio_resample_context.convert_frame(Some(&_frame), &mut new_frame).unwrap();

No examples folder

The README mentions checking out the tests and examples folder (

2. Advanced usage of rsmpeg: Check out the `tests` and `examples` folder.
), but there is no examples folder.

Perhaps somewhere there is an examples folder that someone forgot to commit?

请问怎么才能生成Fragmented MP4

想生成FMP4 方便在游览器上观看:
实现类似的效果:
ffmpeg.exe -i test.264 -f mp4 -movflags frag_keyframe+empty_moov output.mp4
我看其他教程,用C语言时候,写入文件格式头信息的时候设置AVDictionary结构体

AVDictionary *opts = NULL;
av_dict_set(&opts, "movflags", "frag_keyframe+empty_moov", 0);
avformat_write_header(o_fmt_ctx, &opts);
av_dict_free(&opts);

但是,我看了源码rsmpeg的话默认设置null

pub fn write_header(&mut self) -> Result<()> {
        unsafe { ffi::avformat_write_header(self.as_mut_ptr(), ptr::null_mut()) }
            .upgrade()
            .map_err(RsmpegError::WriteHeaderError)?;

        Ok(())
    }

我对ffmpeg不是很了解,是不是还有其他方法呢?请教一下。

使用send_frame方法发生SendFrameError(-22)

use rsmpeg::avcodec::{AVCodec, AVCodecContext};
use rsmpeg::avutil::{AVDictionary, AVFrame, AVRational};
use rsmpeg::ffi::AVPixelFormat_AV_PIX_FMT_YUV420P;

use cstr::cstr;

use std::fs::File;
use std::io::{BufWriter, Write};
use std::slice;

fn main() {
    let mut avcc = AVCodecContext::new(&AVCodec::find_decoder_by_name(cstr!("h264")).unwrap());
    avcc.set_bit_rate(400_000);
    avcc.set_width(352);
    avcc.set_height(288);
    avcc.set_time_base(AVRational { num: 1, den: 25 });
    avcc.set_framerate(AVRational { num: 25, den: 1 });
    avcc.set_gop_size(10);
    avcc.set_max_b_frames(1);
    avcc.set_pix_fmt(AVPixelFormat_AV_PIX_FMT_YUV420P);

    let dict = AVDictionary::new(cstr!("preset"), cstr!("slow"), 0);
    avcc.open(Some(dict)).unwrap();

    let mut frame = AVFrame::new();
    frame.set_format(avcc.pix_fmt);
    frame.set_width(avcc.width);
    frame.set_height(avcc.height);
    frame.alloc_buffer().unwrap();

    let mut out_bufwriter = BufWriter::new(File::create("out.mp4").unwrap());

    for i in 0..25 {
        for y in 0..avcc.height as isize {
            for x in 0..avcc.width as isize {
                unsafe {
                    frame.data_mut()[0]
                        .offset(y * frame.linesize[0] as isize + x)
                        .write((x + y + i * 3) as u8);
                }
            }
        }

        for y in 0..avcc.height as isize / 2 {
            for x in 0..avcc.width as isize / 2 {
                unsafe {
                    frame.data_mut()[1]
                        .offset(y * frame.linesize[1] as isize + x)
                        .write((128 + y + i * 2) as u8);

                    frame.data_mut()[2]
                        .offset(y * frame.linesize[2] as isize + x)
                        .write((64 + x + i * 5) as u8);
                }
            }
        }
        frame.set_pts(i as i64);

        avcc.send_frame(Some(&frame)).unwrap();
        loop {
            let pkt = match avcc.receive_packet() {
                Ok(pkt) => pkt,
                _ => break,
            };
            let data = unsafe { slice::from_raw_parts_mut(pkt.data, pkt.size as usize) };
            out_bufwriter.write(data).unwrap();
        }
    }
    avcc.send_frame(None).unwrap();
    println!("Done!");
}

错误信息:thread 'main' panicked at 'called Result::unwrap() on an Err value: SendFrameError(-22)', src/main.rs:59:39

Compilation error

Hello,

The last version of rsmpeg (0.6.0) doesn't seem to compile:


error[E0425]: cannot find function `av_gcd_q` in module `ffi`
    --> /home/lorenzo/.cargo/registry/src/github.com-1ecc6299db9ec823/rsmpeg-0.6.0/src/avutil/rational.rs:65:19
     |
65   |     unsafe { ffi::av_gcd_q(a, b, max_den, def) }
     |                   ^^^^^^^^
     |
    ::: /home/lorenzo/Scrivania/Varie/repo/remotia/target/debug/build/rusty_ffmpeg-f322e92cb20dcce1/out/binding.rs:6392:5
     |
6392 |     pub fn av_add_q(b: AVRational, c: AVRational) -> AVRational;
     |     ------------------------------------------------------------ similarly named function `av_add_q` defined here
     |
help: a function with a similar name exists
     |
65   |     unsafe { ffi::av_add_q(a, b, max_den, def) }
     |                   ~~~~~~~~
help: consider importing this function
     |
1    | use crate::avutil::av_gcd_q;error[E0425]: cannot find function `av_gcd_q` in module `ffi`
    --> /home/lorenzo/.cargo/registry/src/github.com-1ecc6299db9ec823/rsmpeg-0.6.0/src/avutil/rational.rs:65:19
     |
65   |     unsafe { ffi::av_gcd_q(a, b, max_den, def) }
     |                   ^^^^^^^^
     |
    ::: /home/lorenzo/Scrivania/Varie/repo/remotia/target/debug/build/rusty_ffmpeg-f322e92cb20dcce1/out/binding.rs:6392:5
     |
6392 |     pub fn av_add_q(b: AVRational, c: AVRational) -> AVRational;
     |     ------------------------------------------------------------ similarly named function `av_add_q` defined here
     |
help: a function with a similar name exists
     |
65   |     unsafe { ffi::av_add_q(a, b, max_den, def) }
     |                   ~~~~~~~~
help: consider importing this function
     |
1    | use crate::avutil::av_gcd_q;
     |
     |

I've tried downgrading the ffmpeg release to 4.3 but it doesn't seem to work.

rustc --version output is:

rustc 1.56.1 (59eed8a2a 2021-11-01)

No metadata returned while probing opus/ogg

I compiled ffmpeg with the options below, but while using the metadata in the AVFormatContextInput it returns a None.

"--enable-libmp3lame",
"--enable-libopus",
"--enable-libvorbis",
"--disable-programs",
"--disable-decoder=exr,phm",

Then I decided to compile the same binary this time without the --disable-programs option so I could access ffprobe within it, which returned the desired output.

Confusingly, other formats like mp3 and flac works in the same rsmpeg implementation.

Output:
ffprobe version n6.1.1 Copyright (c) 2007-2023 the FFmpeg developers
  built with gcc 13.2.1 (GCC) 20230801
  configuration: --prefix=/home/Curstantine/Code/Personal/melody/target/build_dependencies/pp/ffmpeg_build --enable-libmp3lame --enable-libopus --enable-libvorbis
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
Input #0, ogg, from '/home/Curstantine/Music/TempLib/Duster/Stratosphere/05 Docking the Pod.opus':
  Duration: 00:01:50.65, start: 0.000000, bitrate: 247 kb/s
  Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
    Metadata:
      encoder         : Lavc60.3.100 libopus
      album_artist    : Duster
      track           : 5
      UPC             : 825764121033
      ARTIST          : Duster
      ALBUM           : Stratosphere
      DATE            : 1998-02-24
      TITLE           : Docking the Pod
      disc            : 1
      TOTALTRACKS     : 17
      YEAR            : 2010
      GENRE           : Рок
      TOTALDISCS      : 1
      ORGANIZATION    : Numero Group
      COPYRIGHT       : 2018 Numero Group
      comment         : NUM210.1dig1
      ISRC            : US68F0505005
      MUSICBRAINZ_RELEASEGROUPID: 764a8c35-aacc-3269-8b10-5972e051815a
      ORIGINALDATE    : 1998-02-24
      ORIGINALYEAR    : 1998
      RELEASETYPE     : album
      MUSICBRAINZ_ALBUMID: 79acc86e-b12b-4a4a-ad7d-7c9f928438a3
      RELEASECOUNTRY  : US
      MUSICBRAINZ_ALBUMARTISTID: 879d43c6-13a8-42f6-b8df-a9b7d50aa9e2
      ALBUMARTISTSORT : Duster
      SCRIPT          : Latn
      BARCODE         : 796818005022
      LABEL           : Up Records
      CATALOGNUMBER   : UP 050
      ASIN            : B0000065H3
      RELEASESTATUS   : official
      MEDIA           : CD
      MUSICBRAINZ_TRACKID: b3972dbf-fba8-41db-832e-47bde3c4b161
      MUSICBRAINZ_ARTISTID: 879d43c6-13a8-42f6-b8df-a9b7d50aa9e2
      ARTISTSORT      : Duster
      ARTISTS         : Duster
      MUSICBRAINZ_RELEASETRACKID: c238a105-8c12-37ef-9e16-df80bcdbd698
      TRACKTOTAL      : 17
      DISCTOTAL       : 1
Code snippet
pub fn read_track_meta(path: &Path) -> Result<()> {
   let path_str = path.to_str().unwrap().to_string();
   let path_cstr = CString::new(path_str.as_bytes()).unwrap();

   let format = AVFormatContextInput::open(&path_cstr, None, &mut None).unwrap();
   let meta = format.metadata().ok_or_else(errors::pre::probe_no_meta)?;

   let tags = traverse_tags(meta, path_str)?;
   unimplemented!()
}

Sample File: 05 Docking the Pod.zip

Compilation through vcpkg

Would you consider the addition of a compilation guide which uses https://github.com/mcgoo/cargo-vcpkg? I have successfully built some personal projects that use rsmpeg by compiling FFMpeg with vcpkg, both on Windows and Linux. The process itself has revealed to be much simpler as after everything is set up you just need to run "cargo vcpkg build" instead of cloning the ffmpeg source by hand, although it may be more difficult to choose a specific ffmpeg version.

Forgot to tell that I am more than willing to help by adding the guide and testing it myself on the current examples.

How do I associate multiple inputs in the filter

I want to achieve split screen effect, at the beginning, I will associate multiple inputs in the filter.
but I can't do it, because of the wrong

outputs.next = video1_outputs.as_mut_ptr();

cannot assign to data in a dereference of `rsmpeg::avfilter::AVFilterInOut`
trait `DerefMut` is required to modify through a dereference, but it is not implemented for `rsmpeg::avfilter::AVFilterInOut`

the main code:

// 创建buffer, 用于接收输入
let buffer_src = AVFilter::get_by_name(cstr!("buffer")).unwrap();

// video0: 创建 filter 上下文, 关联 输入的 buffer
let mut buffer_src_context =
  filter_graph.create_filter_context(&buffer_src, cstr!("video0"), Some(args))?;
// video0: 分配 filter 的输入, 关联 创建的 filter 上下文
let mut outputs = AVFilterInOut::new(cstr!("video0"), &mut buffer_src_context, 0);

// video1: 创建 filter 上下文, 关联 输入的 buffer
let mut buffer_src_context =
  filter_graph.create_filter_context(&buffer_src, cstr!("video1"), Some(args))?;
// video1: 分配 filter 的输入, 关联 创建的 filter 上下文
let mut video1_outputs = AVFilterInOut::new(cstr!("video1"), &mut buffer_src_context, 0);

// 关联 多个输入
outputs.next = video1_outputs.as_mut_ptr();
// outputs.next = video1_outputs.into_raw().as_ptr();

in rsmpeg:
wrap!(AVFilterInOut: ffi::AVFilterInOut);
this is:
wrap_pure!(($name): $ffi_type $(,$attach: $attach_type = $attach_default)*);
and this implements

pub fn as_mut_ptr(&mut self) -> *mut $ffi_type {
   self.something_should_not_be_touched_directly.as_ptr()
}

but why can't it --> outputs.next = video1_outputs.as_mut_ptr();

cargo run error

I'm new to rust.
I ran cargo build like in the resp example.
Could you tell me why i had this error and how to fix.
Thanks in advance!

Screen Shot 2021-05-25 at 16 33 49

May we have an example for showing how to get input device for image capturing on Mac?

Hi all,
May we have an example for showing how to get input device for image capturing on Apple MAC ?
I've tried several code snippets but it always failed on either building or finding the correct video input device.
"Thank you very much!"

e.g.

unsafe {rsmpeg::ffi::avdevice_register_all();}
let s = cstr!("rawvideo");  // avfoundation ?
let mut inf = AVInputFormat::find(s);

let file=cstr!("0:0");

let mut input_format_context = AVFormatContextInput::open(file, inf, &mut None)?;

#117

why not export "mod shared"?

mod shared; in src/lib.rs
why isn't it pub mod shared;

sometimes, i need use ffi function, so i need write custom safe function to call unsafe ffi function.

for example:

if there is pub mod shared; I can use rsmpeg::shared::{RetUpgrade, RsmpegPointerUpgrade};

image

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.