Git Product home page Git Product logo

rust-ffmpeg's People

Contributors

ajsyp avatar andidog avatar attackgoat avatar bacek avatar barzamin avatar chrox avatar ebarnard avatar encounter avatar fengalin avatar geovex avatar inrustwetrust avatar kornelski avatar kryptan avatar ldm0 avatar lummax avatar main-- avatar marcantoine-arnaud avatar meh avatar netcrns avatar panicbit avatar pkubaj avatar redzic avatar retrry avatar sethdusek avatar stephaneyfx avatar tilpner avatar wictory avatar xd009642 avatar yalter avatar zmwangx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

rust-ffmpeg's Issues

Mismatched types

On nightly, against either v0.1.1 or master I get a lot of E0308s.

0 chaptrs master λ cargo build
   Compiling ffmpeg v0.1.1 (https://github.com/meh/rust-ffmpeg#62ebd122)
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:30:26: 30:43 error: mismatched types:
 expected `*mut libc::c_void`,
    found `*mut libc::types::common::c95::c_void`
(expected enum `libc::c_void`,
    found enum `libc::types::common::c95::c_void`) [E0308]
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:30          check!(av_opt_set_bin(self.as_mut_ptr(),
                                                                                                                                                              ^~~~~~~~~~~~~~~~~
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:30:4: 33:29 note: in this expansion of check! (defined in /Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs)
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:30:26: 30:43 help: run `rustc --explain E0308` to see a detailed explanation
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:42:22: 42:39 error: mismatched types:
 expected `*mut libc::c_void`,
    found `*mut libc::types::common::c95::c_void`
(expected enum `libc::c_void`,
    found enum `libc::types::common::c95::c_void`) [E0308]
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:42          check!(av_opt_set(self.as_mut_ptr(),
                                                                                                                                                          ^~~~~~~~~~~~~~~~~
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:42:4: 45:29 note: in this expansion of check! (defined in /Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs)
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:42:22: 42:39 help: run `rustc --explain E0308` to see a detailed explanation
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:53:26: 53:43 error: mismatched types:
 expected `*mut libc::c_void`,
    found `*mut libc::types::common::c95::c_void`
(expected enum `libc::c_void`,
    found enum `libc::types::common::c95::c_void`) [E0308]
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:53          check!(av_opt_set_int(self.as_mut_ptr(),
                                                                                                                                                              ^~~~~~~~~~~~~~~~~
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:53:4: 56:29 note: in this expansion of check! (defined in /Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs)
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:53:26: 53:43 help: run `rustc --explain E0308` to see a detailed explanation
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:64:29: 64:46 error: mismatched types:
 expected `*mut libc::c_void`,
    found `*mut libc::types::common::c95::c_void`
(expected enum `libc::c_void`,
    found enum `libc::types::common::c95::c_void`) [E0308]
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:64          check!(av_opt_set_double(self.as_mut_ptr(),
                                                                                                                                                                 ^~~~~~~~~~~~~~~~~
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:64:4: 67:29 note: in this expansion of check! (defined in /Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs)
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:64:29: 64:46 help: run `rustc --explain E0308` to see a detailed explanation
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:75:24: 75:41 error: mismatched types:
 expected `*mut libc::c_void`,
    found `*mut libc::types::common::c95::c_void`
(expected enum `libc::c_void`,
    found enum `libc::types::common::c95::c_void`) [E0308]
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:75          check!(av_opt_set_q(self.as_mut_ptr(),
                                                                                                                                                            ^~~~~~~~~~~~~~~~~
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:75:4: 78:29 note: in this expansion of check! (defined in /Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs)
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:75:24: 75:41 help: run `rustc --explain E0308` to see a detailed explanation
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:86:33: 86:50 error: mismatched types:
 expected `*mut libc::c_void`,
    found `*mut libc::types::common::c95::c_void`
(expected enum `libc::c_void`,
    found enum `libc::types::common::c95::c_void`) [E0308]
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:86          check!(av_opt_set_image_size(self.as_mut_ptr(),
                                                                                                                                                                     ^~~~~~~~~~~~~~~~~
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:86:4: 89:29 note: in this expansion of check! (defined in /Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs)
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:86:33: 86:50 help: run `rustc --explain E0308` to see a detailed explanation
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:97:32: 97:49 error: mismatched types:
 expected `*mut libc::c_void`,
    found `*mut libc::types::common::c95::c_void`
(expected enum `libc::c_void`,
    found enum `libc::types::common::c95::c_void`) [E0308]
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:97          check!(av_opt_set_pixel_fmt(self.as_mut_ptr(),
                                                                                                                                                                    ^~~~~~~~~~~~~~~~~
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:97:4: 100:29 note: in this expansion of check! (defined in /Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs)
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:97:32: 97:49 help: run `rustc --explain E0308` to see a detailed explanation
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:108:33: 108:50 error: mismatched types:
 expected `*mut libc::c_void`,
    found `*mut libc::types::common::c95::c_void`
(expected enum `libc::c_void`,
    found enum `libc::types::common::c95::c_void`) [E0308]
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:108             check!(av_opt_set_sample_fmt(self.as_mut_ptr(),
                                                                                                                                                                         ^~~~~~~~~~~~~~~~~
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:108:4: 111:29 note: in this expansion of check! (defined in /Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs)
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:108:33: 108:50 help: run `rustc --explain E0308` to see a detailed explanation
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:119:37: 119:54 error: mismatched types:
 expected `*mut libc::c_void`,
    found `*mut libc::types::common::c95::c_void`
(expected enum `libc::c_void`,
    found enum `libc::types::common::c95::c_void`) [E0308]
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:119             check!(av_opt_set_channel_layout(self.as_mut_ptr(),
                                                                                                                                                                             ^~~~~~~~~~~~~~~~~
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:119:4: 122:29 note: in this expansion of check! (defined in /Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs)
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/util/option/traits.rs:119:37: 119:54 help: run `rustc --explain E0308` to see a detailed explanation
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/codec/subtitle/mod.rs:104:5: 104:84 error: mismatched types:
 expected `usize`,
    found `u64`
(expected usize,
    found u64) [E0308]
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/codec/subtitle/mod.rs:104                 (mem::size_of::<*const AVSubtitleRect>() * self.0.num_rects as usize) as size_t)
                                                                                                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/codec/subtitle/mod.rs:104:5: 104:84 help: run `rustc --explain E0308` to see a detailed explanation
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/codec/subtitle/mod.rs:107:30: 107:72 error: mismatched types:
 expected `usize`,
    found `u64`
(expected usize,
    found u64) [E0308]
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/codec/subtitle/mod.rs:107             let mut rect = av_mallocz(mem::size_of::<AVSubtitleRect>() as size_t) as *mut AVSubtitleRect;
                                                                                                                                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/codec/subtitle/mod.rs:107:30: 107:72 help: run `rustc --explain E0308` to see a detailed explanation
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/codec/picture.rs:56:24: 56:61 error: mismatched types:
 expected `usize`,
    found `u64`
(expected usize,
    found u64) [E0308]
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/codec/picture.rs:56           let ptr = av_malloc(mem::size_of::<AVPicture>() as size_t) as *mut AVPicture;
                                                                                                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/pete/.multirust/toolchains/nightly/cargo/git/checkouts/rust-ffmpeg-670207b16d3baa52/master/src/codec/picture.rs:56:24: 56:61 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to 12 previous errors
Could not compile `ffmpeg`.

To learn more, run the command again with --verbose.
0 chaptrs master λ rustc -vV
rustc 1.6.0-nightly (1a2eaffb6 2015-10-31)
binary: rustc
commit-hash: 1a2eaffb63aefba666f55abd992c5e2900654f06
commit-date: 2015-10-31
host: x86_64-apple-darwin
release: 1.6.0-nightly

Do I need to update something? Or pick a different libc somehow?

Build failed: thread 'main' panicked at 'Command failed: Error { repr: Os { code: 2, message: "The system cannot find the file specified." } }', src\libcore\result.rs:906:4

I just added ffmpeg = "0.1.1" to my Cargo.toml and rebuilt.

I'm new to Rust, so I might be missing something obvious.

   Compiling ffmpeg-sys v2.8.9
error: failed to run custom build command for `ffmpeg-sys v2.8.9`
process didn't exit successfully: `C:\dev-projects\rust-test\ffmpegtest\target\debug\build\ffmpeg-sys-38b9d1a12d8b6df5\build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Command failed: Error { repr: Os { code: 2, message: "The system cannot find the file specified." } }', src\libcore\result.rs:906:4
stack backtrace:
   0:        0x13f76c991 - std::sys_common::backtrace::_print
                               at C:\projects\rust\src\libstd\sys_common\backtrace.rs:92
   1:        0x13f77627c - std::panicking::default_hook::{{closure}}
                               at C:\projects\rust\src\libstd\panicking.rs:380
   2:        0x13f775f65 - std::panicking::default_hook
                               at C:\projects\rust\src\libstd\panicking.rs:397
   3:        0x13f7767c5 - std::panicking::rust_panic_with_hook
                               at C:\projects\rust\src\libstd\panicking.rs:577
   4:        0x13f776658 - std::panicking::begin_panic<alloc::string::String>
                               at C:\projects\rust\src\libstd\panicking.rs:538
   5:        0x13f776531 - std::panicking::begin_panic_fmt
                               at C:\projects\rust\src\libstd\panicking.rs:522
   6:        0x13f77649f - std::panicking::rust_begin_panic
                               at C:\projects\rust\src\libstd\panicking.rs:498
   7:        0x13f77a04e - core::panicking::panic_fmt
                               at C:\projects\rust\src\libcore\panicking.rs:71
   8:        0x13f75b517 - core::result::unwrap_failed<std::io::error::Error>
                               at C:\projects\rust\src\libcore\macros.rs:23
   9:        0x13f75a52b - core::result::Result<std::process::ExitStatus, std::io::error::Error>::expect<std::process::ExitStatus,std::io::error::Error>
                               at C:\projects\rust\src\libcore\result.rs:799
  10:        0x13f74cdd6 - build_script_build::check_features
                               at c:\dev\rust\cargo\registry\src\github.com-1ecc6299db9ec823\ffmpeg-sys-2.8.9\build.rs:262
  11:        0x13f7513b4 - build_script_build::main
                               at c:\dev\rust\cargo\registry\src\github.com-1ecc6299db9ec823\ffmpeg-sys-2.8.9\build.rs:345
  12:        0x13f777821 - panic_unwind::__rust_maybe_catch_panic
                               at C:\projects\rust\src\libpanic_unwind\lib.rs:99
  13:        0x13f776f61 - std::rt::lang_start
                               at C:\projects\rust\src\libstd\rt.rs:52
  14:        0x13f7518e6 - main
  15:        0x13f77e6f8 - __scrt_common_main_seh
                               at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253
  16:         0x775b59cc - BaseThreadInitThunk

Frame is leaking memory

examples/transcode-audio.rs is leaking memory. Im encoding music files in batches (transcoding one directory structure and all music files in that directory into an other directory). I was using rayon for concurrent transcoding and i could see ~100mb/s memory increase in htop. The memory usage never went down.

I workarounded/fixed that by calling av_frame_unref on the frame in the encode-loop: https://github.com/chpio/audio_conv/blob/d9b9ce739703282e92114ec58bfc3b5b0b8fe590/src/main.rs#L200

But that shouldn't be required as

  1. ffmpeg should reuse the allocated memory in the frame (i would assume that as a user)
  2. the frame shouldn't leak memory because it gets destroyed at the end of the encoding process

format::open_with consumes options dictionary

I'm trying to port over some C++ code that opens an input with options and then ensures all the options were understood:

    int ret = avformat_open_input(&stream->ctx_, source.c_str(), nullptr, dict);
    if (ret != 0) {
      *error_message = AvError2Str("avformat_open_input", ret);
      return std::unique_ptr<InputVideoPacketStream>();
    }

    if (av_dict_count(*dict) != 0) {
      std::vector<std::string> ignored;
      AVDictionaryEntry *ent = nullptr;
      while ((ent = av_dict_get(*dict, "", ent, AV_DICT_IGNORE_SUFFIX)) !=
             nullptr) {
        ignored.push_back(StrCat(ent->key, "=", ent->value));
      }
      LOG(WARNING) << "avformat_open_input ignored " << ignored.size()
                   << " options: " << Join(ignored, ", ");
    }

See also the doxygen for avformat_open_input which describes the options parameter as follows:

A dictionary filled with AVFormatContext and demuxer-private options. On return this parameter will be destroyed and replaced with a dict containing options that were not found. May be NULL.

Unfortunately format::open_with consumes the supplied dictionary without returning the new one:

pub fn input_with<P: AsRef<Path>>(path: &P, options: Dictionary) -> Result<context::Input, Error> { ... }

so as far as I can tell, it's not possible to duplicate this functionality.

In my case, I'd like to warn if the stimeout option is ignored, as I've seen with libav and older versions of ffmpeg. I'd imagine there are other options in a similar situation; only supported by some versions of ffmpeg or under some circumstances.

Too many things are called Video

Although Rust's namespacing makes it absolutely possible to have different structs called Video, it is confusing in practice, especially in Rustdoc. Rustdoc does not show module name when displaying types in function signatures, so the API reference is unclear when something takes/returns frames or codecs. Same with structs called Input. Rustdoc's search also doesn't search module names, so it's not possible to search for video frame specifically.

ffmpeg::codec::decoder::video::Video
ffmpeg::codec::encoder::video::Video
ffmpeg::codec::video::Video
ffmpeg::util::frame::video::Video

Another problem is that since ffmpeg-rs doesn't have its own documentation, it's necessary to read ffmpeg's C documentation instead. However, renamed/namespaced Rust names don't match ffmpeg's C names (e.g. AVFrame and AVCodec are both called Video here), which makes it extra difficult to cross-reference documentation with this crate.

I suggest using C names, just without the AV prefix.

MinGW generated executable gives "Decoder not found" on Windows 10

In short: stream.codec().decoder().video() returns error Decoder not found on Win10 through MinGW linux build with target x86_64-pc-windows-gnu.


First of all, thanks to all contributors for making such projects possible! I'll try to be concise.

This code runs well on my linux but not on Win 10 through mingw:

    ffmpeg::init()?;
    let input_path = std::env::current_dir().unwrap().join("video.mp4");
    let input_str = input_path.to_string_lossy().into_owned();
    let mut input = ffmpeg::format::input(&input_str)?;
    let (video_stream_id, mut video_decoder) = {
        let stream = input
            .streams()
            .best(ffmpeg::util::media::Type::Video)
            .ok_or(anyhow!("Failed to get video stream"))?;
        (stream.index(), stream.codec().decoder().video()?)
    };

Features (because can't find libavresample):

[dependencies.ffmpeg]
version = "^0.2.0-alpha"
default-features = false
features = ["codec", "format", "software-resampling", "software-scaling"]

The linking lib and dll are 4.2.1 and come from here: https://ffmpeg.zeranoe.com/builds/

build.rs:

use std::env;
use std::path::PathBuf;

fn main() {
    let target = env::var("TARGET").unwrap();
    if target.contains("pc-windows") {
        let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
        let mut lib_dir = manifest_dir.clone();
        lib_dir.push("lib");
        lib_dir.push(&target);
        lib_dir.push("lib");
        println!("cargo:rustc-link-search=all={}", lib_dir.display());
    }
}

I'm trying to open this video.

Output of the exe with wine64:

0009:fixme:thread:SetThreadStackGuarantee (0x33fbf0): stub
Error: Decoder not found

I'm also having the issue on a real Windows 10 installed on dual boot. I've tried many tweaks and seemingly searched the whole internet DuckDuckGo in order to find some sort of solution with no clue. I started to have cold sweats when I realized the complex story of ffmpeg and libav and that I might have just used the wrong libs or something.

Any help is welcome, thanks a lot for reading me! 🙏

Edit: forgot to mention target = x86_64-pc-windows-gnu

Build failing on ubuntu 14.04

I'm running Ubuntu 14.04, rustc 1.9.0-nightly (a43eb4e77 2016-04-12), and ffmpeg version 2.4.3-1ubuntu1~trusty6

I clone and run cargo build to get the following errors:

   Compiling ffmpeg v0.2.0-alpha.2 (file:///home/teddy/code/rust/rust-ffmpeg)
src/util/format/pixel.rs:588:25: 588:45 error: unresolved name `AV_PIX_FMT_VAAPI_VLD` [E0425]
src/util/format/pixel.rs:588            Pixel::VAAPI      => AV_PIX_FMT_VAAPI_VLD,
                                                             ^~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:588:25: 588:45 help: run `rustc --explain E0425` to see a detailed explanation
src/codec/encoder/video.rs:127:4: 127:34 error: attempted access of field `me_method` on type `sys::AVCodecContext`, but no field with that name was found
src/codec/encoder/video.rs:127          (*self.as_mut_ptr()).me_method = value.into();
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/codec/encoder/video.rs:127:25: 127:34 help: did you mean `me_cmp`?
src/codec/encoder/video.rs:127          (*self.as_mut_ptr()).me_method = value.into();
                                                             ^~~~~~~~~
src/codec/encoder/video.rs:296:5: 296:42 error: attempted access of field `intra_quant_bias` on type `sys::AVCodecContext`, but no field with that name was found
src/codec/encoder/video.rs:296              (*self.as_mut_ptr()).intra_quant_bias = value as c_int;
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/codec/encoder/video.rs:296:26: 296:42 help: did you mean `intra_matrix`?
src/codec/encoder/video.rs:296              (*self.as_mut_ptr()).intra_quant_bias = value as c_int;
                                                                 ^~~~~~~~~~~~~~~~
src/codec/encoder/video.rs:299:5: 299:42 error: attempted access of field `intra_quant_bias` on type `sys::AVCodecContext`, but no field with that name was found
src/codec/encoder/video.rs:299              (*self.as_mut_ptr()).intra_quant_bias = FF_DEFAULT_QUANT_BIAS;
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/codec/encoder/video.rs:299:26: 299:42 help: did you mean `intra_matrix`?
src/codec/encoder/video.rs:299              (*self.as_mut_ptr()).intra_quant_bias = FF_DEFAULT_QUANT_BIAS;
                                                                 ^~~~~~~~~~~~~~~~
src/codec/encoder/video.rs:308:5: 308:42 error: attempted access of field `inter_quant_bias` on type `sys::AVCodecContext`, but no field with that name was found
src/codec/encoder/video.rs:308              (*self.as_mut_ptr()).inter_quant_bias = value as c_int;
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/codec/encoder/video.rs:308:26: 308:42 help: did you mean `inter_matrix`?
src/codec/encoder/video.rs:308              (*self.as_mut_ptr()).inter_quant_bias = value as c_int;
                                                                 ^~~~~~~~~~~~~~~~
src/codec/encoder/video.rs:311:5: 311:42 error: attempted access of field `inter_quant_bias` on type `sys::AVCodecContext`, but no field with that name was found
src/codec/encoder/video.rs:311              (*self.as_mut_ptr()).inter_quant_bias = FF_DEFAULT_QUANT_BIAS;
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/codec/encoder/video.rs:311:26: 311:42 help: did you mean `inter_matrix`?
src/codec/encoder/video.rs:311              (*self.as_mut_ptr()).inter_quant_bias = FF_DEFAULT_QUANT_BIAS;
                                                                 ^~~~~~~~~~~~~~~~
error: aborting due to 5 previous errors
error: Could not compile `ffmpeg`.

It looks like some features aren't getting propagated to rust-ffmpeg-sys, so I forked and added the features:

https://github.com/tedsta/rust-ffmpeg-sys/blob/master/Cargo.toml#L90-L92

I then tried using the features from rust-ffmpeg:

codec = ["ffmpeg-sys/avcodec", "ffmpeg-sys/ff_api_quant_bias", "ffmpeg-sys/ff_api_motion_est"]

Then ran into these errors, which have me stumped:

   Compiling ffmpeg v0.2.0-alpha.1 (file:///home/teddy/code/pisces/rust-ffmpeg)
src/util/format/pixel.rs:368:4: 368:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:368            AV_PIX_FMT_YUV420P16LE => Pixel::YUV420P16LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:368:4: 368:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:369:4: 369:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:369            AV_PIX_FMT_YUV420P16BE => Pixel::YUV420P16BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:369:4: 369:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:370:4: 370:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:370            AV_PIX_FMT_YUV422P16LE => Pixel::YUV422P16LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:370:4: 370:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:371:4: 371:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:371            AV_PIX_FMT_YUV422P16BE => Pixel::YUV422P16BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:371:4: 371:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:372:4: 372:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:372            AV_PIX_FMT_YUV444P16LE => Pixel::YUV444P16LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:372:4: 372:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:373:4: 373:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:373            AV_PIX_FMT_YUV444P16BE => Pixel::YUV444P16BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:373:4: 373:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:375:4: 375:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:375            AV_PIX_FMT_VDPAU_MPEG4 => Pixel::VDPAU_MPEG4,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:375:4: 375:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:376:4: 376:24 error: unreachable pattern [E0001]
src/util/format/pixel.rs:376            AV_PIX_FMT_DXVA2_VLD   => Pixel::DXVA2_VLD,
                                        ^~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:376:4: 376:24 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:378:4: 378:23 error: unreachable pattern [E0001]
src/util/format/pixel.rs:378            AV_PIX_FMT_RGB444LE => Pixel::RGB444LE,
                                        ^~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:378:4: 378:23 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:379:4: 379:23 error: unreachable pattern [E0001]
src/util/format/pixel.rs:379            AV_PIX_FMT_RGB444BE => Pixel::RGB444BE,
                                        ^~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:379:4: 379:23 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:380:4: 380:23 error: unreachable pattern [E0001]
src/util/format/pixel.rs:380            AV_PIX_FMT_BGR444LE => Pixel::BGR444LE,
                                        ^~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:380:4: 380:23 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:381:4: 381:23 error: unreachable pattern [E0001]
src/util/format/pixel.rs:381            AV_PIX_FMT_BGR444BE => Pixel::BGR444BE,
                                        ^~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:381:4: 381:23 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:382:4: 382:18 error: unreachable pattern [E0001]
src/util/format/pixel.rs:382            AV_PIX_FMT_YA8      => Pixel::YA8,
                                        ^~~~~~~~~~~~~~
src/util/format/pixel.rs:382:4: 382:18 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:384:4: 384:22 error: unreachable pattern [E0001]
src/util/format/pixel.rs:384            AV_PIX_FMT_BGR48BE => Pixel::BGR48BE,
                                        ^~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:384:4: 384:22 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:385:4: 385:22 error: unreachable pattern [E0001]
src/util/format/pixel.rs:385            AV_PIX_FMT_BGR48LE => Pixel::BGR48LE,
                                        ^~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:385:4: 385:22 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:387:4: 387:25 error: unreachable pattern [E0001]
src/util/format/pixel.rs:387            AV_PIX_FMT_YUV420P9BE  => Pixel::YUV420P9BE,
                                        ^~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:387:4: 387:25 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:388:4: 388:25 error: unreachable pattern [E0001]
src/util/format/pixel.rs:388            AV_PIX_FMT_YUV420P9LE  => Pixel::YUV420P9LE,
                                        ^~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:388:4: 388:25 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:389:4: 389:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:389            AV_PIX_FMT_YUV420P10BE => Pixel::YUV420P10BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:389:4: 389:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:390:4: 390:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:390            AV_PIX_FMT_YUV420P10LE => Pixel::YUV420P10LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:390:4: 390:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:391:4: 391:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:391            AV_PIX_FMT_YUV422P10BE => Pixel::YUV422P10BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:391:4: 391:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:392:4: 392:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:392            AV_PIX_FMT_YUV422P10LE => Pixel::YUV422P10LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:392:4: 392:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:393:4: 393:25 error: unreachable pattern [E0001]
src/util/format/pixel.rs:393            AV_PIX_FMT_YUV444P9BE  => Pixel::YUV444P9BE,
                                        ^~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:393:4: 393:25 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:394:4: 394:25 error: unreachable pattern [E0001]
src/util/format/pixel.rs:394            AV_PIX_FMT_YUV444P9LE  => Pixel::YUV444P9LE,
                                        ^~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:394:4: 394:25 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:395:4: 395:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:395            AV_PIX_FMT_YUV444P10BE => Pixel::YUV444P10BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:395:4: 395:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:396:4: 396:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:396            AV_PIX_FMT_YUV444P10LE => Pixel::YUV444P10LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:396:4: 396:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:397:4: 397:25 error: unreachable pattern [E0001]
src/util/format/pixel.rs:397            AV_PIX_FMT_YUV422P9BE  => Pixel::YUV422P9BE,
                                        ^~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:397:4: 397:25 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:398:4: 398:25 error: unreachable pattern [E0001]
src/util/format/pixel.rs:398            AV_PIX_FMT_YUV422P9LE  => Pixel::YUV422P9LE,
                                        ^~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:398:4: 398:25 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:399:4: 399:22 error: unreachable pattern [E0001]
src/util/format/pixel.rs:399            AV_PIX_FMT_VDA_VLD     => Pixel::VDA_VLD,
                                        ^~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:399:4: 399:22 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:401:4: 401:19 error: unreachable pattern [E0001]
src/util/format/pixel.rs:401            AV_PIX_FMT_GBRP     => Pixel::GBRP,
                                        ^~~~~~~~~~~~~~~
src/util/format/pixel.rs:401:4: 401:19 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:402:4: 402:22 error: unreachable pattern [E0001]
src/util/format/pixel.rs:402            AV_PIX_FMT_GBRP9BE  => Pixel::GBRP9BE,
                                        ^~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:402:4: 402:22 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:403:4: 403:22 error: unreachable pattern [E0001]
src/util/format/pixel.rs:403            AV_PIX_FMT_GBRP9LE  => Pixel::GBRP9LE,
                                        ^~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:403:4: 403:22 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:404:4: 404:23 error: unreachable pattern [E0001]
src/util/format/pixel.rs:404            AV_PIX_FMT_GBRP10BE => Pixel::GBRP10BE,
                                        ^~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:404:4: 404:23 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:405:4: 405:23 error: unreachable pattern [E0001]
src/util/format/pixel.rs:405            AV_PIX_FMT_GBRP10LE => Pixel::GBRP10LE,
                                        ^~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:405:4: 405:23 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:406:4: 406:23 error: unreachable pattern [E0001]
src/util/format/pixel.rs:406            AV_PIX_FMT_GBRP16BE => Pixel::GBRP16BE,
                                        ^~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:406:4: 406:23 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:407:4: 407:23 error: unreachable pattern [E0001]
src/util/format/pixel.rs:407            AV_PIX_FMT_GBRP16LE => Pixel::GBRP16LE,
                                        ^~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:407:4: 407:23 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:409:4: 409:29 error: unreachable pattern [E0001]
src/util/format/pixel.rs:409            AV_PIX_FMT_YUVA422P_LIBAV => Pixel::YUVA422P_LIBAV,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:409:4: 409:29 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:410:4: 410:29 error: unreachable pattern [E0001]
src/util/format/pixel.rs:410            AV_PIX_FMT_YUVA444P_LIBAV => Pixel::YUVA444P_LIBAV,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:410:4: 410:29 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:412:4: 412:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:412            AV_PIX_FMT_YUVA420P9BE  => Pixel::YUVA420P9BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:412:4: 412:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:413:4: 413:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:413            AV_PIX_FMT_YUVA420P9LE  => Pixel::YUVA420P9LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:413:4: 413:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:414:4: 414:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:414            AV_PIX_FMT_YUVA422P9BE  => Pixel::YUVA422P9BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:414:4: 414:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:415:4: 415:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:415            AV_PIX_FMT_YUVA422P9LE  => Pixel::YUVA422P9LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:415:4: 415:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:416:4: 416:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:416            AV_PIX_FMT_YUVA444P9BE  => Pixel::YUVA444P9BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:416:4: 416:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:417:4: 417:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:417            AV_PIX_FMT_YUVA444P9LE  => Pixel::YUVA444P9LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:417:4: 417:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:418:4: 418:27 error: unreachable pattern [E0001]
src/util/format/pixel.rs:418            AV_PIX_FMT_YUVA420P10BE => Pixel::YUVA420P10BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:418:4: 418:27 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:419:4: 419:27 error: unreachable pattern [E0001]
src/util/format/pixel.rs:419            AV_PIX_FMT_YUVA420P10LE => Pixel::YUVA420P10LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:419:4: 419:27 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:420:4: 420:27 error: unreachable pattern [E0001]
src/util/format/pixel.rs:420            AV_PIX_FMT_YUVA422P10BE => Pixel::YUVA422P10BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:420:4: 420:27 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:421:4: 421:27 error: unreachable pattern [E0001]
src/util/format/pixel.rs:421            AV_PIX_FMT_YUVA422P10LE => Pixel::YUVA422P10LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:421:4: 421:27 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:422:4: 422:27 error: unreachable pattern [E0001]
src/util/format/pixel.rs:422            AV_PIX_FMT_YUVA444P10BE => Pixel::YUVA444P10BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:422:4: 422:27 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:423:4: 423:27 error: unreachable pattern [E0001]
src/util/format/pixel.rs:423            AV_PIX_FMT_YUVA444P10LE => Pixel::YUVA444P10LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:423:4: 423:27 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:424:4: 424:27 error: unreachable pattern [E0001]
src/util/format/pixel.rs:424            AV_PIX_FMT_YUVA420P16BE => Pixel::YUVA420P16BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:424:4: 424:27 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:425:4: 425:27 error: unreachable pattern [E0001]
src/util/format/pixel.rs:425            AV_PIX_FMT_YUVA420P16LE => Pixel::YUVA420P16LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:425:4: 425:27 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:426:4: 426:27 error: unreachable pattern [E0001]
src/util/format/pixel.rs:426            AV_PIX_FMT_YUVA422P16BE => Pixel::YUVA422P16BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:426:4: 426:27 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:427:4: 427:27 error: unreachable pattern [E0001]
src/util/format/pixel.rs:427            AV_PIX_FMT_YUVA422P16LE => Pixel::YUVA422P16LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:427:4: 427:27 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:428:4: 428:27 error: unreachable pattern [E0001]
src/util/format/pixel.rs:428            AV_PIX_FMT_YUVA444P16BE => Pixel::YUVA444P16BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:428:4: 428:27 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:429:4: 429:27 error: unreachable pattern [E0001]
src/util/format/pixel.rs:429            AV_PIX_FMT_YUVA444P16LE => Pixel::YUVA444P16LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:429:4: 429:27 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:431:4: 431:20 error: unreachable pattern [E0001]
src/util/format/pixel.rs:431            AV_PIX_FMT_VDPAU => Pixel::VDPAU,
                                        ^~~~~~~~~~~~~~~~
src/util/format/pixel.rs:431:4: 431:20 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:433:4: 433:22 error: unreachable pattern [E0001]
src/util/format/pixel.rs:433            AV_PIX_FMT_XYZ12LE => Pixel::XYZ12LE,
                                        ^~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:433:4: 433:22 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:434:4: 434:22 error: unreachable pattern [E0001]
src/util/format/pixel.rs:434            AV_PIX_FMT_XYZ12BE => Pixel::XYZ12BE,
                                        ^~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:434:4: 434:22 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:435:4: 435:19 error: unreachable pattern [E0001]
src/util/format/pixel.rs:435            AV_PIX_FMT_NV16    => Pixel::NV16,
                                        ^~~~~~~~~~~~~~~
src/util/format/pixel.rs:435:4: 435:19 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:436:4: 436:21 error: unreachable pattern [E0001]
src/util/format/pixel.rs:436            AV_PIX_FMT_NV20LE  => Pixel::NV20LE,
                                        ^~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:436:4: 436:21 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:437:4: 437:21 error: unreachable pattern [E0001]
src/util/format/pixel.rs:437            AV_PIX_FMT_NV20BE  => Pixel::NV20BE,
                                        ^~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:437:4: 437:21 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:439:4: 439:29 error: unreachable pattern [E0001]
src/util/format/pixel.rs:439            AV_PIX_FMT_RGBA64BE_LIBAV => Pixel::RGBA64BE_LIBAV,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:439:4: 439:29 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:440:4: 440:29 error: unreachable pattern [E0001]
src/util/format/pixel.rs:440            AV_PIX_FMT_RGBA64LE_LIBAV => Pixel::RGBA64LE_LIBAV,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:440:4: 440:29 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:441:4: 441:29 error: unreachable pattern [E0001]
src/util/format/pixel.rs:441            AV_PIX_FMT_BGRA64BE_LIBAV => Pixel::BGRA64BE_LIBAV,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:441:4: 441:29 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:442:4: 442:29 error: unreachable pattern [E0001]
src/util/format/pixel.rs:442            AV_PIX_FMT_BGRA64LE_LIBAV => Pixel::BGRA64LE_LIBAV,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:442:4: 442:29 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:444:4: 444:22 error: unreachable pattern [E0001]
src/util/format/pixel.rs:444            AV_PIX_FMT_YVYU422 => Pixel::YVYU422,
                                        ^~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:444:4: 444:22 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:446:4: 446:18 error: unreachable pattern [E0001]
src/util/format/pixel.rs:446            AV_PIX_FMT_VDA => Pixel::VDA,
                                        ^~~~~~~~~~~~~~
src/util/format/pixel.rs:446:4: 446:18 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:448:4: 448:21 error: unreachable pattern [E0001]
src/util/format/pixel.rs:448            AV_PIX_FMT_YA16BE => Pixel::YA16BE,
                                        ^~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:448:4: 448:21 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:449:4: 449:21 error: unreachable pattern [E0001]
src/util/format/pixel.rs:449            AV_PIX_FMT_YA16LE => Pixel::YA16LE,
                                        ^~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:449:4: 449:21 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:451:4: 451:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:451            AV_PIX_FMT_GBRAP_LIBAV     => Pixel::GBRAP_LIBAV,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:451:4: 451:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:452:4: 452:30 error: unreachable pattern [E0001]
src/util/format/pixel.rs:452            AV_PIX_FMT_GBRAP16BE_LIBAV => Pixel::GBRAP16BE_LIBAV,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:452:4: 452:30 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:453:4: 453:30 error: unreachable pattern [E0001]
src/util/format/pixel.rs:453            AV_PIX_FMT_GBRAP16LE_LIBAV => Pixel::GBRAP16LE_LIBAV,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:453:4: 453:30 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:454:4: 454:18 error: unreachable pattern [E0001]
src/util/format/pixel.rs:454            AV_PIX_FMT_QSV             => Pixel::QSV,
                                        ^~~~~~~~~~~~~~
src/util/format/pixel.rs:454:4: 454:18 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:455:4: 455:19 error: unreachable pattern [E0001]
src/util/format/pixel.rs:455            AV_PIX_FMT_MMAL            => Pixel::MMAL,
                                        ^~~~~~~~~~~~~~~
src/util/format/pixel.rs:455:4: 455:19 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:457:4: 457:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:457            AV_PIX_FMT_D3D11VA_VLD => Pixel::D3D11VA_VLD,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:457:4: 457:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:459:4: 459:19 error: unreachable pattern [E0001]
src/util/format/pixel.rs:459            AV_PIX_FMT_0RGB     => Pixel::ZRGB,
                                        ^~~~~~~~~~~~~~~
src/util/format/pixel.rs:459:4: 459:19 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:460:4: 460:19 error: unreachable pattern [E0001]
src/util/format/pixel.rs:460            AV_PIX_FMT_RGB0     => Pixel::RGBZ,
                                        ^~~~~~~~~~~~~~~
src/util/format/pixel.rs:460:4: 460:19 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:461:4: 461:19 error: unreachable pattern [E0001]
src/util/format/pixel.rs:461            AV_PIX_FMT_0BGR     => Pixel::ZBGR,
                                        ^~~~~~~~~~~~~~~
src/util/format/pixel.rs:461:4: 461:19 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:462:4: 462:19 error: unreachable pattern [E0001]
src/util/format/pixel.rs:462            AV_PIX_FMT_BGR0     => Pixel::BGRZ,
                                        ^~~~~~~~~~~~~~~
src/util/format/pixel.rs:462:4: 462:19 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:463:4: 463:23 error: unreachable pattern [E0001]
src/util/format/pixel.rs:463            AV_PIX_FMT_YUVA444P => Pixel::YUVA444P,
                                        ^~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:463:4: 463:23 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:464:4: 464:23 error: unreachable pattern [E0001]
src/util/format/pixel.rs:464            AV_PIX_FMT_YUVA422P => Pixel::YUVA422P,
                                        ^~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:464:4: 464:23 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:466:4: 466:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:466            AV_PIX_FMT_YUV420P12BE => Pixel::YUV420P12BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:466:4: 466:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:467:4: 467:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:467            AV_PIX_FMT_YUV420P12LE => Pixel::YUV420P12LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:467:4: 467:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:468:4: 468:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:468            AV_PIX_FMT_YUV420P14BE => Pixel::YUV420P14BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:468:4: 468:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:469:4: 469:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:469            AV_PIX_FMT_YUV420P14LE => Pixel::YUV420P14LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:469:4: 469:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:470:4: 470:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:470            AV_PIX_FMT_YUV422P12BE => Pixel::YUV422P12BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:470:4: 470:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:471:4: 471:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:471            AV_PIX_FMT_YUV422P12LE => Pixel::YUV422P12LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:471:4: 471:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:472:4: 472:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:472            AV_PIX_FMT_YUV422P14BE => Pixel::YUV422P14BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:472:4: 472:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:473:4: 473:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:473            AV_PIX_FMT_YUV422P14LE => Pixel::YUV422P14LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:473:4: 473:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:474:4: 474:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:474            AV_PIX_FMT_YUV444P12BE => Pixel::YUV444P12BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:474:4: 474:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:475:4: 475:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:475            AV_PIX_FMT_YUV444P12LE => Pixel::YUV444P12LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:475:4: 475:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:476:4: 476:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:476            AV_PIX_FMT_YUV444P14BE => Pixel::YUV444P14BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:476:4: 476:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:477:4: 477:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:477            AV_PIX_FMT_YUV444P14LE => Pixel::YUV444P14LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:477:4: 477:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:478:4: 478:23 error: unreachable pattern [E0001]
src/util/format/pixel.rs:478            AV_PIX_FMT_GBRP12BE    => Pixel::GBRP12BE,
                                        ^~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:478:4: 478:23 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:479:4: 479:23 error: unreachable pattern [E0001]
src/util/format/pixel.rs:479            AV_PIX_FMT_GBRP12LE    => Pixel::GBRP12LE,
                                        ^~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:479:4: 479:23 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:480:4: 480:23 error: unreachable pattern [E0001]
src/util/format/pixel.rs:480            AV_PIX_FMT_GBRP14BE    => Pixel::GBRP14BE,
                                        ^~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:480:4: 480:23 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:481:4: 481:23 error: unreachable pattern [E0001]
src/util/format/pixel.rs:481            AV_PIX_FMT_GBRP14LE    => Pixel::GBRP14LE,
                                        ^~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:481:4: 481:23 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:482:4: 482:20 error: unreachable pattern [E0001]
src/util/format/pixel.rs:482            AV_PIX_FMT_GBRAP       => Pixel::GBRAP,
                                        ^~~~~~~~~~~~~~~~
src/util/format/pixel.rs:482:4: 482:20 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:483:4: 483:24 error: unreachable pattern [E0001]
src/util/format/pixel.rs:483            AV_PIX_FMT_GBRAP16BE   => Pixel::GBRAP16BE,
                                        ^~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:483:4: 483:24 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:484:4: 484:24 error: unreachable pattern [E0001]
src/util/format/pixel.rs:484            AV_PIX_FMT_GBRAP16LE   => Pixel::GBRAP16LE,
                                        ^~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:484:4: 484:24 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:485:4: 485:23 error: unreachable pattern [E0001]
src/util/format/pixel.rs:485            AV_PIX_FMT_YUVJ411P    => Pixel::YUVJ411P,
                                        ^~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:485:4: 485:23 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:487:4: 487:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:487            AV_PIX_FMT_BAYER_BGGR8    => Pixel::BAYER_BGGR8,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:487:4: 487:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:488:4: 488:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:488            AV_PIX_FMT_BAYER_RGGB8    => Pixel::BAYER_RGGB8,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:488:4: 488:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:489:4: 489:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:489            AV_PIX_FMT_BAYER_GBRG8    => Pixel::BAYER_GBRG8,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:489:4: 489:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:490:4: 490:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:490            AV_PIX_FMT_BAYER_GRBG8    => Pixel::BAYER_GRBG8,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:490:4: 490:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:491:4: 491:29 error: unreachable pattern [E0001]
src/util/format/pixel.rs:491            AV_PIX_FMT_BAYER_BGGR16LE => Pixel::BAYER_BGGR16LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:491:4: 491:29 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:492:4: 492:29 error: unreachable pattern [E0001]
src/util/format/pixel.rs:492            AV_PIX_FMT_BAYER_BGGR16BE => Pixel::BAYER_BGGR16BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:492:4: 492:29 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:493:4: 493:29 error: unreachable pattern [E0001]
src/util/format/pixel.rs:493            AV_PIX_FMT_BAYER_RGGB16LE => Pixel::BAYER_RGGB16LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:493:4: 493:29 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:494:4: 494:29 error: unreachable pattern [E0001]
src/util/format/pixel.rs:494            AV_PIX_FMT_BAYER_RGGB16BE => Pixel::BAYER_RGGB16BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:494:4: 494:29 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:495:4: 495:29 error: unreachable pattern [E0001]
src/util/format/pixel.rs:495            AV_PIX_FMT_BAYER_GBRG16LE => Pixel::BAYER_GBRG16LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:495:4: 495:29 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:496:4: 496:29 error: unreachable pattern [E0001]
src/util/format/pixel.rs:496            AV_PIX_FMT_BAYER_GBRG16BE => Pixel::BAYER_GBRG16BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:496:4: 496:29 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:497:4: 497:29 error: unreachable pattern [E0001]
src/util/format/pixel.rs:497            AV_PIX_FMT_BAYER_GRBG16LE => Pixel::BAYER_GRBG16LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:497:4: 497:29 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:498:4: 498:29 error: unreachable pattern [E0001]
src/util/format/pixel.rs:498            AV_PIX_FMT_BAYER_GRBG16BE => Pixel::BAYER_GRBG16BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:498:4: 498:29 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:500:4: 500:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:500            AV_PIX_FMT_YUV440P10LE => Pixel::YUV440P10LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:500:4: 500:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:501:4: 501:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:501            AV_PIX_FMT_YUV440P10BE => Pixel::YUV440P10BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:501:4: 501:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:502:4: 502:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:502            AV_PIX_FMT_YUV440P12LE => Pixel::YUV440P12LE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:502:4: 502:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:503:4: 503:26 error: unreachable pattern [E0001]
src/util/format/pixel.rs:503            AV_PIX_FMT_YUV440P12BE => Pixel::YUV440P12BE,
                                        ^~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:503:4: 503:26 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:504:4: 504:23 error: unreachable pattern [E0001]
src/util/format/pixel.rs:504            AV_PIX_FMT_AYUV64LE    => Pixel::AYUV64LE,
                                        ^~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:504:4: 504:23 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:505:4: 505:23 error: unreachable pattern [E0001]
src/util/format/pixel.rs:505            AV_PIX_FMT_AYUV64BE    => Pixel::AYUV64BE,
                                        ^~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:505:4: 505:23 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:507:4: 507:27 error: unreachable pattern [E0001]
src/util/format/pixel.rs:507            AV_PIX_FMT_VIDEOTOOLBOX => Pixel::VIDEOTOOLBOX,
                                        ^~~~~~~~~~~~~~~~~~~~~~~
src/util/format/pixel.rs:507:4: 507:27 help: run `rustc --explain E0001` to see a detailed explanation
src/util/format/pixel.rs:509:4: 509:17 error: unreachable pattern [E0001]
src/util/format/pixel.rs:509            AV_PIX_FMT_NB => Pixel::None
                                        ^~~~~~~~~~~~~
src/util/format/pixel.rs:509:4: 509:17 help: run `rustc --explain E0001` to see a detailed explanation
error: aborting due to 121 previous errors
error: Could not compile `ffmpeg`.

PacketIter ignores errors

It would be better if this iterator returned Result<(Stream<'a>, Packet), Error> instead, so that the caller can handle errors (other than EOF).

With Err(..) => () I'm worried that this could end up being an infinite loop if ffmpeg can't skip over the error.

ffmpeg 4.0 build failure

==> Downloading https://github.com/ImageOptim/gifski/archive/0.8.2.tar.gz
Already downloaded: /Users/joe/Library/Caches/Homebrew/gifski-0.8.2.tar.gz
==> Verifying gifski-0.8.2.tar.gz checksum
tar xzf /Users/joe/Library/Caches/Homebrew/gifski-0.8.2.tar.gz
==> cargo build --release --features=video
    Updating registry `https://github.com/rust-lang/crates.io-index`
    Updating git repository `https://github.com/kornelski/rust-ffmpeg.git`
    Updating git repository `https://github.com/meh/rust-ffmpeg-sys`
 Downloading pbr v1.0.0
 Downloading rayon v0.9.0
 Downloading imagequant v2.11.9
 Downloading gif-dispose v2.1.0
 Downloading lodepng v2.1.2
 Downloading error-chain v0.11.0
 Downloading wild v0.1.1
 Downloading imgref v1.3.3
 Downloading rgb v0.8.7
 Downloading clap v2.30.0
 Downloading gif v0.9.2
 Downloading resize v0.3.0
 Downloading glob v0.2.11
 Downloading kernel32-sys v0.2.2
 Downloading winapi v0.2.8
 Downloading libc v0.2.37
 Downloading time v0.1.39
 Downloading winapi-build v0.1.1
 Downloading rayon-core v1.4.0
 Downloading either v1.4.0
 Downloading rand v0.4.2
 Downloading lazy_static v1.0.0
 Downloading crossbeam-deque v0.2.0
 Downloading num_cpus v1.8.0
 Downloading crossbeam-utils v0.2.2
 Downloading crossbeam-epoch v0.3.0
 Downloading cfg-if v0.1.2
 Downloading nodrop v0.1.12
 Downloading scopeguard v0.3.3
 Downloading arrayvec v0.4.7
 Downloading memoffset v0.2.1
 Downloading lazy_static v0.2.11
 Downloading imagequant-sys v2.11.9
 Downloading cc v1.0.4
 Downloading lzw v0.10.0
 Downloading color_quant v1.0.0
 Downloading backtrace v0.3.5
 Downloading rustc-demangle v0.1.7
 Downloading bitflags v0.9.1
 Downloading pkg-config v0.3.9
 Downloading bindgen v0.32.3
 Downloading regex v0.2.6
 Downloading log v0.3.9
 Downloading cexpr v0.2.3
 Downloading proc-macro2 v0.2.3
 Downloading quote v0.4.2
 Downloading which v1.0.5
 Downloading env_logger v0.4.3
 Downloading clang-sys v0.21.2
 Downloading peeking_take_while v0.1.2
 Downloading log v0.4.1
 Downloading strsim v0.7.0
 Downloading atty v0.2.6
 Downloading unicode-width v0.1.4
 Downloading textwrap v0.9.0
 Downloading bitflags v1.0.1
 Downloading vec_map v0.8.0
 Downloading nom v3.2.1
 Downloading memchr v1.0.2
 Downloading utf8-ranges v1.0.0
 Downloading aho-corasick v0.6.4
 Downloading thread_local v0.3.5
 Downloading regex-syntax v0.4.2
 Downloading memchr v2.0.1
 Downloading unreachable v1.0.0
 Downloading void v1.0.2
 Downloading unicode-xid v0.1.0
 Downloading libloading v0.4.3
 Downloading ansi_term v0.10.2
   Compiling libloading v0.4.3
   Compiling either v1.4.0
   Compiling ffmpeg v0.2.0-alpha.2 (https://github.com/kornelski/rust-ffmpeg.git#0eea6d01)
   Compiling cc v1.0.4
   Compiling rgb v0.8.7
   Compiling winapi v0.2.8
   Compiling libc v0.2.37
   Compiling strsim v0.7.0
   Compiling regex-syntax v0.4.2
   Compiling utf8-ranges v1.0.0
   Compiling bindgen v0.32.3
   Compiling void v1.0.2
   Compiling bitflags v1.0.1
   Compiling vec_map v0.8.0
   Compiling scopeguard v0.3.3
   Compiling unicode-width v0.1.4
   Compiling nodrop v0.1.12
   Compiling peeking_take_while v0.1.2
   Compiling resize v0.3.0
   Compiling rayon-core v1.4.0
   Compiling winapi-build v0.1.1
   Compiling wild v0.1.1
   Compiling imgref v1.3.3
   Compiling bitflags v0.9.1
   Compiling pkg-config v0.3.9
   Compiling glob v0.2.11
   Compiling unicode-xid v0.1.0
   Compiling lazy_static v1.0.0
   Compiling rustc-demangle v0.1.7
   Compiling memoffset v0.2.1
   Compiling color_quant v1.0.0
   Compiling cfg-if v0.1.2
   Compiling ansi_term v0.10.2
   Compiling lzw v0.10.0
   Compiling lazy_static v0.2.11
   Compiling atty v0.2.6
   Compiling which v1.0.5
   Compiling time v0.1.39
   Compiling memchr v1.0.2
   Compiling rand v0.4.2
   Compiling lodepng v2.1.2
   Compiling memchr v2.0.1
   Compiling num_cpus v1.8.0
   Compiling unreachable v1.0.0
   Compiling textwrap v0.9.0
   Compiling arrayvec v0.4.7
   Compiling kernel32-sys v0.2.2
   Compiling proc-macro2 v0.2.3
   Compiling backtrace v0.3.5
   Compiling log v0.4.1
   Compiling crossbeam-utils v0.2.2
   Compiling clang-sys v0.21.2
   Compiling imagequant-sys v2.11.9
   Compiling gif v0.9.2
   Compiling nom v3.2.1
   Compiling thread_local v0.3.5
   Compiling aho-corasick v0.6.4
   Compiling clap v2.30.0
   Compiling crossbeam-epoch v0.3.0
   Compiling log v0.3.9
   Compiling error-chain v0.11.0
   Compiling gif-dispose v2.1.0
   Compiling regex v0.2.6
   Compiling quote v0.4.2
   Compiling crossbeam-deque v0.2.0
   Compiling pbr v1.0.0
   Compiling imagequant v2.11.9
   Compiling cexpr v0.2.3
   Compiling rayon v0.9.0
   Compiling env_logger v0.4.3
   Compiling ffmpeg-sys v3.4.1 (https://github.com/meh/rust-ffmpeg-sys#9056485f)
error[E0425]: cannot find value `AV_PIX_FMT_VDA_VLD` in this scope
   --> .brew_home/.cargo/git/checkouts/rust-ffmpeg-4e2fa0d809f646b8/0eea6d0/src/util/format/pixel.rs:696:26
    |
696 |             Pixel::VDA_VLD     => AV_PIX_FMT_VDA_VLD,
    |                                   ^^^^^^^^^^^^^^^^^^ did you mean `AV_PIX_FMT_VAAPI_VLD`?

error[E0425]: cannot find value `AV_PIX_FMT_VDA` in this scope
   --> .brew_home/.cargo/git/checkouts/rust-ffmpeg-4e2fa0d809f646b8/0eea6d0/src/util/format/pixel.rs:740:18
    |
740 |             Pixel::VDA => AV_PIX_FMT_VDA,
    |                           ^^^^^^^^^^^^^^ did you mean `AV_PIX_FMT_CUDA`?

error[E0425]: cannot find value `AVFMT_RAWPICTURE` in this scope
 --> .brew_home/.cargo/git/checkouts/rust-ffmpeg-4e2fa0d809f646b8/0eea6d0/src/format/format/flag.rs:9:25
  |
9 |         const RAW_PICTURE   = AVFMT_RAWPICTURE;
  |                               ^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `AV_CODEC_ID_VIMA` in this scope
    --> .brew_home/.cargo/git/checkouts/rust-ffmpeg-4e2fa0d809f646b8/0eea6d0/src/codec/id.rs:1252:33
     |
1252 |             Id::VIMA                  => AV_CODEC_ID_VIMA,
     |                                          ^^^^^^^^^^^^^^^^ did you mean `AV_CODEC_ID_IMC`?

error[E0425]: cannot find value `AV_CODEC_CAP_HWACCEL_VDPAU` in this scope
  --> .brew_home/.cargo/git/checkouts/rust-ffmpeg-4e2fa0d809f646b8/0eea6d0/src/codec/capabilities.rs:11:31
   |
11 |         const HWACCEL_VDPAU       = AV_CODEC_CAP_HWACCEL_VDPAU;
   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `FF_DEBUG_MV` in this scope
  --> .brew_home/.cargo/git/checkouts/rust-ffmpeg-4e2fa0d809f646b8/0eea6d0/src/codec/debug.rs:11:23
   |
11 |         const MV          = FF_DEBUG_MV;
   |                             ^^^^^^^^^^^ did you mean `FF_DEBUG_ER`?

error[E0425]: cannot find value `FF_DEBUG_PTS` in this scope
  --> .brew_home/.cargo/git/checkouts/rust-ffmpeg-4e2fa0d809f646b8/0eea6d0/src/codec/debug.rs:15:23
   |
15 |         const PTS         = FF_DEBUG_PTS;
   |                             ^^^^^^^^^^^^ did you mean `FF_FDEBUG_TS`?

error[E0425]: cannot find value `FF_DEBUG_VIS_QP` in this scope
  --> .brew_home/.cargo/git/checkouts/rust-ffmpeg-4e2fa0d809f646b8/0eea6d0/src/codec/debug.rs:19:23
   |
19 |         const VIS_QP      = FF_DEBUG_VIS_QP;
   |                             ^^^^^^^^^^^^^^^ did you mean `FF_DEBUG_QP`?

error[E0425]: cannot find value `FF_DEBUG_VIS_MB_TYPE` in this scope
  --> .brew_home/.cargo/git/checkouts/rust-ffmpeg-4e2fa0d809f646b8/0eea6d0/src/codec/debug.rs:20:23
   |
20 |         const VIS_MB_TYPE = FF_DEBUG_VIS_MB_TYPE;
   |                             ^^^^^^^^^^^^^^^^^^^^ did you mean `FF_DEBUG_MB_TYPE`?

error[E0599]: no variant named `XVMC` found for type `util::format::pixel::Pixel` in the current scope
   --> .brew_home/.cargo/git/checkouts/rust-ffmpeg-4e2fa0d809f646b8/0eea6d0/src/util/format/pixel.rs:803:4
    |
10  | pub enum Pixel {
    | -------------- variant `XVMC` not found here
...
803 |             Pixel::XVMC   => AV_PIX_FMT_XVMC,
    |             ^^^^^^^^^^^ variant not found in `util::format::pixel::Pixel`

error[E0308]: mismatched types
  --> .brew_home/.cargo/git/checkouts/rust-ffmpeg-4e2fa0d809f646b8/0eea6d0/src/filter/mod.rs:64:22
   |
64 |             Some(Filter::wrap(ptr))
   |                               ^^^ types differ in mutability
   |
   = note: expected type `*mut sys::AVFilter`
              found type `*const sys::AVFilter`

error: aborting due to 11 previous errors

error: Could not compile `ffmpeg`.

To learn more, run the command again with --verbose.

regressed by
FFmpeg/FFmpeg@2b32031
FFmpeg/FFmpeg@693a11b
and more

Thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: CrossCompilation'

Hello! Could you explain the nature of this bug? I can't find any info about that. So I try to build my app with cargo-raze and bazel. The trace below was given after try with fork, called ffmpeg4_sys, but I had the same result with any version of original library higher than 2.8.9.

ERROR: /home/skr/.cache/bazel/_bazel_skr/e43c6ea3a3e0071d84f6a78f03fdfca4/external/raze__ffmpeg4_sys__4_2_2/BUILD.bazel:54:1: Executing genrule @raze__ffmpeg4_sys__4_2_2//:ffmpeg4_sys_build_script_executor failed (Exit 101) thread 'main' panicked at 'called Result::unwrap()on anErr value: CrossCompilation', src/libcore/result.rs:997:5 stack backtrace: 0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39 1: std::sys_common::backtrace::_print at src/libstd/sys_common/backtrace.rs:71 2: std::panicking::default_hook::{{closure}} at src/libstd/sys_common/backtrace.rs:59 at src/libstd/panicking.rs:197 3: std::panicking::default_hook at src/libstd/panicking.rs:211 4: std::panicking::rust_panic_with_hook at src/libstd/panicking.rs:474 5: std::panicking::continue_panic_fmt at src/libstd/panicking.rs:381 6: rust_begin_unwind at src/libstd/panicking.rs:308 7: core::panicking::panic_fmt at src/libcore/panicking.rs:85 8: core::result::unwrap_failed 9: ffmpeg4_sys_build_script::main 10: std::rt::lang_start::{{closure}} 11: std::panicking::try::do_call at src/libstd/rt.rs:49 at src/libstd/panicking.rs:293 12: __rust_maybe_catch_panic at src/libpanic_unwind/lib.rs:87 13: std::rt::lang_start_internal at src/libstd/panicking.rs:272 at src/libstd/panic.rs:388 at src/libstd/rt.rs:48 14: main 15: __libc_start_main 16: _start Target //stalin/rtp_handler:server failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 0.699s, Critical Path: 0.06s INFO: 0 processes. FAILED: Build did NOT complete successfully

Cargo toml with raze

[package]
name = "cargo_deps"
version = "1.0.0"
authors = ["Dmitrii <[email protected]>"]
edition = "2018"

[lib]
path = "fake_lib"

[dependencies]
ffmpeg4 = "0.4.0"


[raze]
workspace_path = "//third_party/cargo"
target = "x86_64-unknown-linux-gnu"
genmode = "Remote"

[raze.crates.ffmpeg4-sys.'4.2.2']
gen_buildrs = true

[raze.crates.clang-sys.'0.28.1']
gen_buildrs = true
skipped_deps = [
  "libloading-0.5.2"
]
additional_deps = [
  "@//third_party/cargo/overrides/libloading-0.5.2:libloading",
]

[raze.crates.env_logger.'0.6.2']
additional_flags = [
    "--cfg=atomic_cas"
]

[raze.crates.bindgen.'0.51.1']
gen_buildrs = true
extra_aliased_targets = ["cargo_bin_bindgen"]

[raze.crates.libloading.'0.5.2']
custom_build_file_path = "//bindgen/raze:libloading.BUILD"

[raze.crates.log.'0.4.8']
additional_flags = [
    "--cfg=atomic_cas"
]

[raze.crates.proc-macro2.'1.0.8']
additional_flags = [
    "--cfg=use_proc_macro",
]

Improve state transitions of codec::* structs

Current

The current state transitions in the codec module are as follows:

1 context
2 └── opened
3     ├── decoder
      │   ├── audio
      │   ├── subtitles
      │   └── video
4     └── encoder
          ├── audio
          ├── subtitles
          └── video
  1. A Context is obtained from a Stream object (or created anew).
  2. This context is opened using the right Codec with avcodec_open2().
  3. A possible Decoder is created from the opened Context.
  4. A possible Encoder is created from the opened Context.

Fields from AVCodecContext are exposed with getter/setter methods (primarily) from step 3/4 onwards.

This scheme works great for decoding as we are intrested in the fields in AVCodecContext set by the demuxer (avformat_find_stream_info()) or the encoder (avcodec_open2()).

However this does not work for encoding. libavcodec seems to expect certain fields in AVCodecContext set before calling avcodec_open2() (for example the time_base field, see here). The current architecture does not allow this, as the setters are defined below the Encoder state (and avcodec_open2() needs to be called in step 2.).

New

I propose the following new schema:

1   context
2   ├── decoder_context
2.1 │   └── opened_context
2.2 │       ├── audio
2.3 │       ├── subtitles
2.4 │       └── video
3   └── encoder_context
3.1     ├── audio
        │   └── opened
3.2     ├── subtitles
        │   └── opened
3.3     └── video
           └── opened
  1. A Context is obtained from a Stream object (or created anew).
    Common setters (like set_threading()) are defined here.
  2. A 'Decoder' can be created by state transition. This decoder exposes getter methods for fields set by the demuxer (like bits_per_coded_sample see here).
    1. The Decoder can be opened (avcodec_open2() in the background plus state transition). This opened decoder exposes more getter functions for fields set by the decoder common to all streams.
    2. An opened Audio decoder exposes getter functions for audio-specific fields and a decode() function.
    3. An opened Subtitles decoder exposes getter functions for subtitle-specific fields and a decode() function.
    4. An opened Video decoder exposes getter functions for video-specific fields and a decode() function.
  3. An Encoder can be created by state transition.
    1. An Audio encoder can be created by state transition which exposes audio encoder specific setter functions. This can be opened with avcodec_open2() and a state transition to expose a encode() function.
    2. An Subtitles encoder can be created by state transition which exposes subtitle encoder specific setter functions. This can be opened with avcodec_open2() and a state transition to expose a encode() function.
    3. An Video encoder can be created by state transition which exposes video encoder specific setter functions. This can be opened with avcodec_open2() and a state transition to expose a encode() function.

I would start on implementing this to see if its possible and ergonomic. Feedback is welcome :).

ffmpeg::Error(1313558101: Unknown error occurred) when playing wav in rust-openal play example

I changed the build.rs script of ffmpeg-sys so that it builds on windows msvc 32bit
and I had to change this line:
https://github.com/meh/rust-ffmpeg/blob/master/src/codec/encoder/encoder.rs#L73
to:

(*self.as_mut_ptr()).bit_rate = value as int64_t;

to get rust-ffmpeg to compile. Because it's the same here:
https://github.com/meh/rust-ffmpeg-sys/blob/master/src/avcodec/codec.rs#L935
and here: https://ffmpeg.org/doxygen/3.1/structAVCodecContext.html
ffmpeg requires version 2.8 of ffmpeg-sys, but the one in git is 3.0.0.
So I changed ffmpeg so it requires ffmpeg-sys 3.0.0 but when I tried to build ffmpeg with the path override, it said:
error: no matching package named ffmpeg-sys found (required by ffmpeg)
location searched: registry https://github.com/rust-lang/crates.io-index
version required: ^3.0.0
versions found: 2.8.9, 2.8.8, 2.8.7
So then I changed the requirement back to 2.8 and in ffmpeg-sys I changed the version to 2.8.0, then both built.
Is this the wrong thing to do?

Now I tried to run the play example of rust-openal which uses ffmpeg and it crashes:

D:\3rdparty\rust-openal>cargo run --example play "D:\samples\air-horn.wav"
warning: path override for crate `ffmpeg` has altered the original list of
dependencies; the dependency on `image` was either added or
modified to not match the previously resolved version

This is currently allowed but is known to produce buggy behavior with spurious
recompiles and changes to the crate graph. Path overrides unfortunately were
never intended to support this feature, so for now this message is just a
warning. In the future, however, this message will become a hard error.

To change the dependency graph via an override it's recommended to use the
`[replace]` feature of Cargo instead of the path override feature. This is
documented online at the url below for more information.

http://doc.crates.io/specifying-dependencies.html#overriding-dependencies

    Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target\debug\examples\play.exe D:\samples\air-horn.wav`
[SWR @ 00829b20] Input channel count and layout are unset
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: ffm
peg::Error(1313558101: Unknown error occurred)', ../src/libcore\result.rs:799
stack backtrace:
   0:    0x7b298 - std::rt::lang_start::h14cbded5fe3cd915
   1:    0x7bb0a - std::panicking::rust_panic_with_hook::hcd9d05f53fa0dafc
   2:    0x7b9a6 - std::panicking::begin_panic_fmt::hb0a7126ee57cdd27
   3:    0x7b85b - rust_begin_unwind
   4:    0x486c5 - core::result::Result<ffmpeg::software::resampling::context::C
ontext, ffmpeg::util::error::Error>::unwrap<ffmpeg::software::resampling::contex
t::Context,ffmpeg::util::error::Error>
                at C:\bot\slave\nightly-dist-rustc-win-msvc-32\build\src\libcore
\result.rs:737
   5:    0x5c733 - play::decoder::{{closure}}<&collections::string::String>
                at D:\3rdparty\rust-openal\examples\play.rs:32
   6:    0x5a8cc - std::panic::{{impl}}::call_once<(),closure>
                at C:\bot\slave\nightly-dist-rustc-win-msvc-32\build\src\libstd\
panic.rs:255
   7:    0x458ea - std::panicking::try::do_call<std::panic::AssertUnwindSafe<clo
sure>,()>
                at C:\bot\slave\nightly-dist-rustc-win-msvc-32\build\src\libstd\
panicking.rs:356
   8:    0x7ecfb - __rust_maybe_catch_panic
   9:    0x45571 - std::panicking::try<(),std::panic::AssertUnwindSafe<closure>>

                at C:\bot\slave\nightly-dist-rustc-win-msvc-32\build\src\libstd\
panicking.rs:332
  10:    0x44697 - std::panic::catch_unwind<std::panic::AssertUnwindSafe<closure
>,()>
                at C:\bot\slave\nightly-dist-rustc-win-msvc-32\build\src\libstd\
panic.rs:311
  11:    0x5c236 - std::thread::{{impl}}::spawn::{{closure}}<closure,()>
                at C:\bot\slave\nightly-dist-rustc-win-msvc-32\build\src\libstd\
thread\mod.rs:277
  12:    0x54eac - alloc::boxed::{{impl}}::call_box<(),closure>
                at C:\bot\slave\nightly-dist-rustc-win-msvc-32\build\src\liballo
c\boxed.rs:595
  13:    0x79e6c - std::sys::thread::Thread::new::hf599b376c47e7cb9
  14: 0x76e07c03 - BaseThreadInitThunk
  15: 0x775bad1e - RtlInitializeExceptionChain
error: receiving on a closed channel

When I pass a mp3 instead, I get this:

D:\3rdparty\rust-openal>cargo run --example play "R:\data\music\D-music\vaporwav
e\Ford & Lopatin- Joey Rogers.mp3"
warning: path override for crate `ffmpeg` has altered the original list of
dependencies; the dependency on `image` was either added or
modified to not match the previously resolved version

This is currently allowed but is known to produce buggy behavior with spurious
recompiles and changes to the crate graph. Path overrides unfortunately were
never intended to support this feature, so for now this message is just a
warning. In the future, however, this message will become a hard error.

To change the dependency graph via an override it's recommended to use the
`[replace]` feature of Cargo instead of the path override feature. This is
documented online at the url below for more information.

http://doc.crates.io/specifying-dependencies.html#overriding-dependencies

    Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target\debug\examples\play.exe "R:\data\music\D-music\vaporwave\Fo
rd & Lopatin- Joey Rogers.mp3"`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: openal::
Error(Invalid enum parameter value.)', ../src/libcore\result.rs:799
stack backtrace:
   0:  0x109b298 - std::rt::lang_start::h14cbded5fe3cd915
   1:  0x109bb0a - std::panicking::rust_panic_with_hook::hcd9d05f53fa0dafc
   2:  0x109b9a6 - std::panicking::begin_panic_fmt::hb0a7126ee57cdd27
   3:  0x109b85b - rust_begin_unwind
   4:  0x106808a - core::result::Result<(), openal::error::Error>::unwrap<(),ope
nal::error::Error>
                at C:\bot\slave\nightly-dist-rustc-win-msvc-32\build\src\libcore
\result.rs:737
   5:  0x107b892 - play::main
                at D:\3rdparty\rust-openal\examples\play.rs:98
   6:  0x109ecfb - __rust_maybe_catch_panic
   7:  0x109ad10 - std::rt::lang_start::h14cbded5fe3cd915
   8:  0x107cd80 - main
   9: 0x76e07c03 - BaseThreadInitThunk
  10: 0x775bad1e - RtlInitializeExceptionChain
error: process didn't exit successfully: `target\debug\examples\play.exe R:\data
\music\D-music\vaporwave\Ford & Lopatin- Joey Rogers.mp3` (exit code: 101)

What am I doing wrong?

Release to crates.io

The version from master (apart from blocker #97) works well for me, but the same code ran with version on crates.io crashes with:

Assertion desc failed at libswscale/swscale_internal.h:668
Abort trap: 6

Could you release the latest version to crates.io? I'd like to publish my crate as well, and can't with a git URL.

Would you add a license?

Greetings!

I'd like to use this library in an application but am unable to until it has a license, would you consider adding a license?

I'm personally hoping for/support MIT Licensing but it is up to you of course.

Invalid values for the duration and the frame count of streams

Both my code and the examples/metadata.rs provided in this repository are giving me erroneous values for the duration of the streams and the count of frames in the streams.

A count of 0 frames and a duration of -9223372036854775808 seconds(?) is returned for all inputs.

Aside from these two values everything seems to work so far, examples/metadata.rs outputs correct information and I was able to create thumbnails successfully from the video files. (Although not from the correct timestamps for the reason above)

Ffprobe, however, displays the correct figures for these fields. Ffmpeg and associated libraries' versions are listed below:

ffmpeg version 3.3.1 Copyright (c) 2000-2017 the FFmpeg developers                                                                                             
built with gcc 7.1.1 (GCC) 20170516
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxvid --enable-shared --enable-version3
libavutil      55. 58.100 / 55. 58.100
libavcodec     57. 89.100 / 57. 89.100
libavformat    57. 71.100 / 57. 71.100
libavdevice    57.  6.100 / 57.  6.100
libavfilter     6. 82.100 /  6. 82.100
libavresample   3.  5.  0 /  3.  5.  0
libswscale      4.  6.100 /  4.  6.100
libswresample   2.  7.100 /  2.  7.100
libpostproc    54.  5.100 / 54.  5.100

If needed, I put my own code up in a gist here, but beware that it is the aftermath of tons of trial and error and debugging with println! and so it is rather crude.

building master fails

building ffmpeg master + ffmpeg sys master results in build errors. They're pretty much the same as are showing up on travis.

Building retrry/rust-ffmpeg@db95408164d278809b12e2e77ed90025ed6431ec works.

maybe @retrry forgot to make a PR for that?

Audio Example error

Hi,

I have tried the audio encoding example but when I try to have a different output format from mp3 to wmv (as it is documented in the rust file) I get the following error message:

[mp3 @ 0x7fa4b8959040] Skipping 0 bytes of junk at 253.
[wmav2 @ 0x7fa4b895bd40] Specified sample format -1 is invalid or not supported
An unknown error occurred

I used the following parameters:
e1.mp3 out.wmv anull

Example fails -- no method named `set_parameters`

examples/transcode-audio.rs fails:

error[E0599]: no method named `set_parameters` found for type `ffmpeg::decoder::Audio` in the current scope
  --> src/transcode-audio.rs:65:18
   |
65 |     try!(decoder.set_parameters(input.parameters()));
   |                  ^^^^^^^^^^^^^^

error[E0599]: no method named `parameters` found for type `ffmpeg::Stream<'_>` in the current scope
  --> src/transcode-audio.rs:65:39
   |
65 |     try!(decoder.set_parameters(input.parameters()));
   |                                       ^^^^^^^^^^

error[E0599]: no method named `set_parameters` found for type `ffmpeg::StreamMut<'_>` in the current scope
  --> src/transcode-audio.rs:89:12
   |
89 |     output.set_parameters(&encoder);
   |            ^^^^^^^^^^^^^^

error: aborting due to previous error(s)

Unsafe destructors

Please consider the following snippet:

extern crate ffmpeg;

use std::env;
use std::path::Path;

struct Store {
    input: ffmpeg::format::context::Input,
    decoder: ffmpeg::codec::decoder::Audio,
}

fn main() {
    ffmpeg::init().unwrap();

    let ictx    = ffmpeg::format::input(&env::args().nth(1).expect("missing input")).unwrap();
    let decoder = ictx.streams().best(ffmpeg::media::Type::Audio).expect("could not find best audio stream")
                      .codec().decoder().audio().unwrap();

    let store = Store {
        input: ictx,
        decoder: decoder,
    };
}

If this gets compiled and run under valgrind several Invalid read and Invalid writes pop up:

==14420== Invalid read of size 8
==14420==    at 0x5127F94: avcodec_close (utils.c:2880)
==b14420==    by 0x11C2BC: codec::decoder::opened::Opened.Drop::drop::hd94913beb95d20d4Zdu (opened.rs:74)
==14420==    by 0x111101: ffmpeg..codec..decoder..opened..Opened::drop.3455::h73bd8800b3ed73e0 (in /home/me/dev/rust-ffmpeg/target/debug/examples/test)
==14420==    by 0x11109A: ffmpeg..codec..decoder..audio..Audio::drop.3452::h68a2d653d5c11a74 (in /home/me/dev/rust-ffmpeg/target/debug/examples/test)
==14420==    by 0x11146B: Store::drop.3479::hb9aa8e79435c8851 (in /home/me/dev/rust-ffmpeg/target/debug/examples/test)

If we change the order of the fields in the Store struct and leverage the Rust drop order the error is resolved:

struct Store {
    decoder: ffmpeg::codec::decoder::Audio,
    input: ffmpeg::format::context::Input,
}

The problem might be, that avcodec_free_context() does not NULL the internal codec pointers and so a subsequent avcodec_close() operates on invalid data.

Example of encoding video

Hi, I was wondering how complete/usable this lib is -- I'd like to record some video, and I have the source from an opengl render, and I need to encode it -- this lib looked like it might be what I need.
I dug through the source/docs, but couldn't find a way to:

  • open a file as writer
  • encode video frames to it

Is this lib able to do that?
Currently I'm just rendering to a bunch of images and then using ffmpeg on the cli to make the video, but I thought it would be more efficient this way.

Thanks!

Unsafe memory handling when decoding frames

Memory handling for decoded AVFrames can either be the responsibility of the caller or of the codec, depending on whether AVCodecContext.refcounted_frames is set to 1 or to 0.
Explained here (parameter picture):
http://ffmpeg.org/doxygen/3.2/group__lavc__decoding.html#ga3ac51525b7ad8bca4ced9f3446e96532
If refcounted_frames is set to 0, the decoder owns the memory of the frames and will reuse this memory when decoding further frames. Therefore frames are only valid until the next call to the decoder and this can cause problems for a rust programmer that expects the obtained ffmpeg::util::frame::video::Video struct to remain valid until it gets destroyed.
In my case I was extensively moving the obtained frames around (even through various threads) and it took me a long time to realize that the origin of my problems (frame duplication/reordering, contrast/color separation) was the ffmpeg decoder overwriting the frames that I had already decoded and which were in various stages of further processing. Cloning the frames immediately after decoding solved the problem for me.

So far I'm not sure how to solve this problem "cleanly". Maybe the decoder could just return something like a borrowed reference to a frame and therefore force the rust programmer to either release the reference or to clone the frame before calling the decoder again.

License

Hello.

Currently rust-ffmpeg is licensed under WTFPL - license that is not recognised in some jurisdictions, which puts rust-ffmpeg on a level equal to proprietary code that can't be used.

Furthermore, WTFPL does not offer any sort of protection for someone who wrote the code - according to it, they can be hold liable for the code they wrote.

To help with those issues, CC0 could be used - it's on par with WTFPL when it comes to what it allows (it's a public domain license), is recognised in every jurisdiction, and also offers protection for code authors from being held liable for code they wrote.

To compare those 2:
https://tldrlegal.com/license/do-what-the-f*ck-you-want-to-public-license-%28wtfpl%29
https://tldrlegal.com/license/creative-commons-cc0-1.0-universal

Thus, I would like to ask whether it is possible to re-license rust-ffmpeg (and rust-ffmpeg-sys) to CC0?
Are there some reasons to keep WTFPL, instead of switching to CC0?

On a side note - it would seem quite likely that I will have to use rust-ffmpeg in some FOSS project(s?) I'll be doing in the future, and using something that uses WTFPL would make me feel uneasy - I would be afraid that WTFPL in some jurisdictions would affect ability of users' to use software because of legal reasons.

Document code

As a new rustacean, it's very hard to follow along with the code. If it was documented, you could understand the code, but for now I do not understand the code.

Failed to build metadata example

I've tied to build example

And got

Compiling ffmpeg v0.2.0-alpha.2 (https://github.com/meh/rust-ffmpeg.git#dc6ace91)
error[E0425]: cannot find value `AVCOL_SPC_YCGCO` in this scope
  --> /usr/local/cargo/git/checkouts/rust-ffmpeg-9e0ba839e85456a1/dc6ace9/src/util/color/space.rs:72:29
   |
72 |             Space::YCGCO => AVCOL_SPC_YCGCO,
   |                             ^^^^^^^^^^^^^^^ did you mean `AVCOL_SPC_YCOCG`?

error[E0425]: cannot find value `AVCOL_SPC_CHROMA_DERIVED_NCL` in this scope
  --> /usr/local/cargo/git/checkouts/rust-ffmpeg-9e0ba839e85456a1/dc6ace9/src/util/color/space.rs:77:40
   |
77 |             Space::ChromaDerivedNCL => AVCOL_SPC_CHROMA_DERIVED_NCL,
   |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `AVCOL_SPC_CHROMA_DERIVED_CL` in this scope
  --> /usr/local/cargo/git/checkouts/rust-ffmpeg-9e0ba839e85456a1/dc6ace9/src/util/color/space.rs:78:39
   |
78 |             Space::ChromaDerivedCL => AVCOL_SPC_CHROMA_DERIVED_CL,
   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `AVCOL_SPC_ICTCP` in this scope
  --> /usr/local/cargo/git/checkouts/rust-ffmpeg-9e0ba839e85456a1/dc6ace9/src/util/color/space.rs:79:29
   |
79 |             Space::ICTCP => AVCOL_SPC_ICTCP,
   |                             ^^^^^^^^^^^^^^^ did you mean `AVCOL_SPC_FCC`?

and etc.

Can someone point out what I'm doing wrong?

I'm building inside Dockerfile. And this is my Cargo.toml.

Disabling libraries while building ffmpeg statically

I'd quite like to use rust-ffmpeg for a small project of mine, for which I'd need to build and link ffmpeg statically. As far as I understand it, the included build.rs supports this. I only need a couple of formats (mp3, flac, and pcmf32le) for my purposes, so I was wondering if there is any way to disable the other libraries that the static build links (e.g. ssh) in order to reduce the dependencies, and size of the resulting library.

From reading through the build.rs, it seems that there is a way, but I can't quite figure out how to do it...

Thanks!

Streams with invalid duration

metadata returns an invalid duration for the streams of this file:

stream index 0:
        duration (stream timebase): -9223372036854775808
        duration (seconds): -9223372036854776.00
stream index 1:
        duration (stream timebase): -9223372036854775808
        duration (seconds): -9223372036854776.00

As a workaround I will rely on context.duration() which seems to be correct.

Audio example non monotonically increasing dts

running the transcode-audio example on this file: http://hpr.dogphilosophy.net/test/ogg.ogg fails with the following output (including RUST_BACKTRACE output):

+-----------+
|    in     |default--[48000Hz fltp:stereo]--Parsed_anull_0:default
| (abuffer) |
+-----------+

                                                      +---------------+
Parsed_anull_0:default--[48000Hz fltp:stereo]--default|      out      |
                                                      | (abuffersink) |
                                                      +---------------+

                                          +----------------+
in:default--[48000Hz fltp:stereo]--default| Parsed_anull_0 |default--[48000Hz fltp:stereo]--out:default
                                          |    (anull)     |
                                          +----------------+


thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: ffmpeg::Error(1313558101: Unknown error occurred)', src/libcore\result.rs:746
stack backtrace:
   0:           0x4d6549 - panicking::default_handler::_$u7b$$u7b$closure$u7d$$u7d$::closure.42006
   1:           0x4d581e - panicking::default_handler::h6366d1e4ad19cfebQ6y
   2:           0x49a88f - sys_common::unwind::begin_unwind_inner::h58a3b689f77cd448edt
   3:           0x49b0db - sys_common::unwind::begin_unwind_fmt::he9ca76086d6a2073kct
   4:           0x4cbe42 - rust_begin_unwind
   5:           0x4ea668 - panicking::panic_fmt::h9f2031b6af182750qYL
   6:           0x404759 - result::unwrap_failed::h6763306835692356360
                        at src/libcore/macros.rs:29
   7:           0x40a0c4 - result::Result<T, E>::unwrap::h17889083407238900606
                        at src/libcore/result.rs:687
   8:           0x404208 - main::heabe6125ff279f4auja
                        at examples/transcode-audio.rs:140
   9:           0x4d4f0d - sys_common::unwind::try::h9177743410636681703
  10:           0x4d4dd5 - rt::lang_start::h54735f69e5a4deb8WYy
  11:           0x40a38a - main
  12:           0x4013ec - _tmainCRTStartup
                        at C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:332
  13:           0x40152a - mainCRTStartup
                        at C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:212
  14:     0x7fffb4b72d91 - get_output_format
[libvorbis @ 0000000001551500] Queue input is backward in time
[libvorbis @ 0000000001551500] Queue input is backward in time
[libvorbis @ 0000000001551500] Queue input is backward in time
[libvorbis @ 0000000001551500] Queue input is backward in time
[libvorbis @ 0000000001551500] Queue input is backward in time
[libvorbis @ 0000000001551500] Queue input is backward in time
[libvorbis @ 0000000001551500] Queue input is backward in time
[ogg @ 00000000015f97a0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 65856 >= 65536
Process didn't exit successfully: `target\debug\examples\transcode-audio.exe D:/dev/desktop/rust/video_host_transcoder/ogg.ogg D:/msys2/home/euan/sample.out.ogg` (exit code: 101)

Compilation Error ffmpeg library not found

Hi

I work with Ubuntu 14.04 64bit and rustc 1.4.0-dev
I have the following error:

Compiling ffmpeg-sys v2.8.0-5
Compiling bitflags v0.3.2
Compiling libc v0.2.2
Compiling ffmpeg v0.1.1 (https://github.com/meh/rust-ffmpeg#67009f0f)
Compiling myserver v0.1.0 (file:///home/saskyrar/Development/Languages/rust/myserver)
error: linking with cc failed: exit code: 1
note: "cc" "-Wl,--as-needed" "-m64" "-L" "/usr/lib/rust/rust-stable/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/saskyrar/Development/Languages/rust/myserver/target/debug/myserver.0.o" "-o" "/home/saskyrar/Development/Languages/rust/myserver/target/debug/myserver" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "/home/saskyrar/Development/Languages/rust/myserver/target/debug/deps/libffmpeg-2237698f5e29be22.rlib" "/home/saskyrar/Development/Languages/rust/myserver/target/debug/deps/libffmpeg_sys-72b52694e5f2edc4.rlib" "/home/saskyrar/Development/Languages/rust/myserver/target/debug/deps/liblibc-540159808ccfa9ab.rlib" "/home/saskyrar/Development/Languages/rust/myserver/target/debug/deps/libbitflags-c495827ddcd6a202.rlib" "/usr/lib/rust/rust-stable/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-a5fc0d6c.rlib" "/usr/lib/rust/rust-stable/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-a5fc0d6c.rlib" "/usr/lib/rust/rust-stable/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_unicode-a5fc0d6c.rlib" "/usr/lib/rust/rust-stable/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-a5fc0d6c.rlib" "/usr/lib/rust/rust-stable/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-a5fc0d6c.rlib" "/usr/lib/rust/rust-stable/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-a5fc0d6c.rlib" "/usr/lib/rust/rust-stable/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-a5fc0d6c.rlib" "/usr/lib/rust/rust-stable/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-a5fc0d6c.rlib" "-L" "/home/saskyrar/Development/Languages/rust/myserver/target/debug" "-L" "/home/saskyrar/Development/Languages/rust/myserver/target/debug/deps" "-L" "/usr/lib/rust/rust-stable/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/home/saskyrar/Development/Languages/rust/myserver/.rust/lib/x86_64-unknown-linux-gnu" "-L" "/home/saskyrar/Development/Languages/rust/myserver/lib/x86_64-unknown-linux-gnu" "-Wl,-Bstatic" "-Wl,-Bdynamic" "-l" "avutil" "-l" "avcodec" "-l" "avdevice" "-l" "avformat" "-l" "avfilter" "-l" "avresample" "-l" "swresample" "-l" "swscale" "-l" "dl" "-l" "pthread" "-l" "gcc_s" "-l" "rt" "-l" "pthread" "-l" "c" "-l" "m" "-l" "compiler-rt"
note: /usr/bin/ld: cannot find -lavresample
collect2: error: ld returned 1 exit status

My question is: is there a specific place where I have to put the ffmpeg libraries?

Non-exhaustive patterns

My Cargo.toml pulls in rust-ffmpeg in this way:

[dependencies.ffmpeg]
git = "https://github.com/meh/rust-ffmpeg.git"
features = ["build"]

However, building the project (cargo build) fails with these errors:

$ cargo build
    Updating git repository `https://github.com/meh/rust-ffmpeg.git`
   ...
   Compiling ffmpeg v0.2.0-alpha.2 (https://github.com/meh/rust-ffmpeg.git#28b7a82a)
   ...
   Compiling ffmpeg-sys v3.4.0
warning: redundant linker flag specified for library `X11`

warning: redundant linker flag specified for library `X11`

warning: redundant linker flag specified for library `va`

warning: redundant linker flag specified for library `va`

warning: redundant linker flag specified for library `SDL2`

error[E0004]: non-exhaustive patterns: `AVCOL_SPC_CHROMA_DERIVED_NCL`, `AVCOL_SPC_CHROMA_DERIVED_CL` and `AVCOL_SPC_ICTCP` not covered
  --> /home/ajsyp/.cargo/git/checkouts/rust-ffmpeg-9e0ba839e85456a1/28b7a82/src/util/color/space.rs:34:9
   |
34 |   match value {
   |         ^^^^^ patterns `AVCOL_SPC_CHROMA_DERIVED_NCL`, `AVCOL_SPC_CHROMA_DERIVED_CL` and `AVCOL_SPC_ICTCP` not covered

error[E0004]: non-exhaustive patterns: `AV_PIX_FMT_D3D11`, `AV_PIX_FMT_GRAY9BE`, `AV_PIX_FMT_GRAY9LE` and 5 more not covered
   --> /home/ajsyp/.cargo/git/checkouts/rust-ffmpeg-9e0ba839e85456a1/28b7a82/src/util/format/pixel.rs:357:9
    |
357 |   match value {
    |         ^^^^^ patterns `AV_PIX_FMT_D3D11`, `AV_PIX_FMT_GRAY9BE`, `AV_PIX_FMT_GRAY9LE` and 5 more not covered

error[E0004]: non-exhaustive patterns: `AV_FRAME_DATA_CONTENT_LIGHT_LEVEL` and `AV_FRAME_DATA_ICC_PROFILE` not covered
  --> /home/ajsyp/.cargo/git/checkouts/rust-ffmpeg-9e0ba839e85456a1/28b7a82/src/util/frame/side_data.rs:41:9
   |
41 |   match value {
   |         ^^^^^ patterns `AV_FRAME_DATA_CONTENT_LIGHT_LEVEL` and `AV_FRAME_DATA_ICC_PROFILE` not covered

error[E0004]: non-exhaustive patterns: `AV_CODEC_ID_BITPACKED`, `AV_CODEC_ID_MSCC`, `AV_CODEC_ID_SRGC` and 5 more not covered
   --> /home/ajsyp/.cargo/git/checkouts/rust-ffmpeg-9e0ba839e85456a1/28b7a82/src/codec/id.rs:493:9
    |
493 |   match value {
    |         ^^^^^ patterns `AV_CODEC_ID_BITPACKED`, `AV_CODEC_ID_MSCC`, `AV_CODEC_ID_SRGC` and 5 more not covered

error[E0004]: non-exhaustive patterns: `AV_PKT_DATA_CONTENT_LIGHT_LEVEL` and `AV_PKT_DATA_A53_CC` not covered
  --> /home/ajsyp/.cargo/git/checkouts/rust-ffmpeg-9e0ba839e85456a1/28b7a82/src/codec/packet/side_data.rs:37:9
   |
37 |   match value {
   |         ^^^^^ patterns `AV_PKT_DATA_CONTENT_LIGHT_LEVEL` and `AV_PKT_DATA_A53_CC` not covered

error: aborting due to 5 previous errors

error: Could not compile `ffmpeg`.

To learn more, run the command again with --verbose.

Any insight into what might be causing this?

A new release to crates.io?

This looks like a really interesting library! I'd like to add optional ffmpeg support to my substudy subtitle-processing crate, but it turns out that a crate on crates.io can't depend on a crate which is only distributed via GitHub.

Would it be possible to make a new release of the ffmpeg crate at some point so that I could try it out? Thank you very much for working on Rust video tools!

Declare required development packages

I have trouble linking on Debian 8 and OSX 10.11.
Could you guys write a quick list of dep+vsn in /README.md?

On debian I have this:

error: linking with `cc` failed: exit code: 1
note: "cc" "-Wl,--as-needed" "-m64" "-L" "/home/pete/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/pete/wefwefwef/chaptrs.git/target/debug/chaptrs.0.o" "-o" "/home/pete/wefwefwef/chaptrs.git/target/debug/chaptrs" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/home/pete/wefwefwef/chaptrs.git/target/debug" "-L" "/home/pete/wefwefwef/chaptrs.git/target/debug/deps" "-L" "/home/pete/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/home/pete/wefwefwef/chaptrs.git/.rust/lib/x86_64-unknown-linux-gnu" "-L" "/home/pete/wefwefwef/chaptrs.git/lib/x86_64-unknown-linux-gnu" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/home/pete/wefwefwef/chaptrs.git/target/debug/deps/libffmpeg-805255d617bd8363.rlib" "/home/pete/wefwefwef/chaptrs.git/target/debug/deps/libffmpeg_sys-fadf153a42f32bb4.rlib" "/home/pete/wefwefwef/chaptrs.git/target/debug/deps/liblibc-540159808ccfa9ab.rlib" "/home/pete/wefwefwef/chaptrs.git/target/debug/deps/libbitflags-eec34728826d9769.rlib" "/home/pete/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8cf6ce90.rlib" "/home/pete/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-8cf6ce90.rlib" "/home/pete/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_unicode-8cf6ce90.rlib" "/home/pete/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-8cf6ce90.rlib" "/home/pete/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-8cf6ce90.rlib" "/home/pete/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-8cf6ce90.rlib" "/home/pete/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-8cf6ce90.rlib" "/home/pete/.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-8cf6ce90.rlib" "-l" "avutil" "-l" "avcodec" "-l" "avdevice" "-l" "avformat" "-l" "avfilter" "-l" "avresample" "-l" "swresample" "-l" "swscale" "-l" "dl" "-l" "pthread" "-l" "gcc_s" "-l" "rt" "-l" "pthread" "-l" "c" "-l" "m" "-Wl,-rpath,$ORIGIN/../../../../.multirust/toolchains/nightly/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-rpath,/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "compiler-rt"
note: /usr/bin/ld: cannot find -lswresample
collect2: error: ld returned 1 exit status

Mainly: does it depend on ffmpeg (from the Ffmpeg project), avconv (because both my platforms ask for libavutil)?
Or: do you know an easy way to install libavutil on debian or osx?
I think I'll test my code using only Travis CI for now :D

SIGSEGV iterating stream

I'm probably doing something dumb, but even so I think a SIGSEGV in safe code is supposed to be impossible.

#[macro_use] extern crate ffmpeg;

use ffmpeg::format;
use ffmpeg::format::network;
use std::env;

fn main() {
    let url = env::args().nth(1).expect("missing url");
    ffmpeg::init().unwrap();
    network::init();
    let open_options = dict![
        "rtsp_transport" => "tcp",
        "probesize" => "262144",
        "user-agent" => "rtsptest",
        "stimeout" => "10000000"
    ];
    let mut input = format::input_with(&url, open_options).unwrap();
    println!("open");
    for (stream, mut pkt) in input.packets() {
        println!("packet");
    }
}

When run with some URL (for example, rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov), it crashes with a segfault.

GDB says this:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  ffmpeg::format::context::input::{{impl}}::next (
    self=<error reading variable: Cannot access memory at address 0xfffffffffffffff0>)
    at /home/slamb/.cargo/registry/src/github.com-1ecc6299db9ec823/ffmpeg-0.2.0-alpha.1/src/format/context/input.rs:164
164                             match packet.read(self.context) {

which I guess means that the location where the self pointer is stored is invalid? Not sure why that would be but I'll poke at it a bit.

I tried a couple versions of rust in case it's a problem with the compiler/runtime:

rustc 1.10.0-nightly (476fe6eef 2016-05-21)
rustc 1.12.0-nightly (34f35ed29 2016-07-17)

How to build it under windows please ?

Hello,
I need Rust-ffmpeg to build Gifski with video support in it (here https://github.com/ImageOptim/gifski ) , but rust-ffmpeg always fails to build.

cloning the rust ffmpeg repo and trying to build it, alone, and i get this

H:\rust-ffmpeg>cargo build --release
   Compiling ffmpeg-sys v3.4.1
error: failed to run custom build command for `ffmpeg-sys v3.4.1`
process didn't exit successfully: `H:\rust-ffmpeg\target\release\build\ffmpeg-sy
s-9c2b3fa23df71254\build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: MSVC', s
rc\libcore\result.rs:916:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Enabling backtrace :

H:\rust-ffmpeg>cargo build --release
   Compiling ffmpeg-sys v3.4.1
error: failed to run custom build command for `ffmpeg-sys v3.4.1`
process didn't exit successfully: `H:\rust-ffmpeg\target\release\build\ffmpeg-sys-9c2b3fa23df71254\b
uild-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: MSVC', src\libcore\result.rs
:916:5
stack backtrace:
   0: <std::sync::condvar::WaitTimeoutResult as core::fmt::Debug>::fmt
   1: <std::time::SystemTimeError as core::fmt::Display>::fmt
   2: std::panicking::Location::column
   3: std::panicking::Location::column
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::begin_panic_fmt
   6: std::panicking::begin_panic_fmt
   7: rust_begin_unwind
   8: core::panicking::panic_fmt
   9: core::result::unwrap_failed
  10: <alloc::vec::Vec<T> as core::ops::drop::Drop>::drop
  11: bindgen::Bindings::write_to_file
  12: std::panicking::update_panic_count
  13: _rust_maybe_catch_panic
  14: std::rt::lang_start_internal
  15: main
  16: __scrt_common_main_seh
             at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283
  17: BaseThreadInitThunk

I'm using Rust stable-x86_64-pc-windows-msvc 1.24.0
Visual Studio 2017
win 7 x64 pro

I don't know what to do at this point, also got similar errors when trying to build rust-ffmpeg-sys alone...

So any good soul have an idea or tips about how to build this under windows please ?

Thanks in advance.

encode one video from RGB Pixels

Hi, i want make one video from some RGB Pixels data, but have some problems:

i can't see ffmpeg function api avpicture_fill in rust-ffmpeg:

image

    extern crate ffmpeg;

    use ffmpeg::software::{converter, scaling};
    use ffmpeg::util::frame::{Frame, Video, Audio};
    use ffmpeg::util::format::Pixel;

    let (width, height) = (1440, 900);
    let ctx: scaling::Context =  converter( (width, height), Pixel::RGB24, Pixel::YUV420P ).unwrap();

    let rgb24_buff = vec![255,255,255, ...];
    // Question 1: How can i put the `rgb24_buff` pixels data to `Video<Frame>` ?
    //                     i have not see some method in `Video` And `Frame` struct.
    let input_video_frame : Video = Video::new(); // RGB24 Pixel
    let output_video_frame: Video = Video::new(); // YUV420P Pixel

    // convert RGB Pixels to YUV420P Pixels
    let _ = ctx.run( input_video_frame,  output_video_frame );

    let frames = vec![ output_video_frame, output_video_frame, output_video_frame, ... ];
    // Question 2: How can i encode some `Video` frame to one real video (like h264, vp8) ?
    // let video   = ....

anyone have some example?

thx.

failing to find `ffmpeg-sys` when running cargo build

I am currently trying to build the codec-info.rs example and am currently getting this error message
I am fairly new to rust so not really sure what I should be doing to fix it

cargo build
    Updating registry `https://github.com/rust-lang/crates.io-index`
no matching package named `ffmpeg-sys` found (required by `ffmpeg`)
location searched: registry https://github.com/rust-lang/crates.io-index
version required: ^2.8.0 

my Cargo.toml file is

[package]
name = "fastr"
version = "0.1.0"
authors = ["Benjamin Hinchley <[email protected]>"]

[dependencies]
ffmpeg = "0.2.0-alpha.1"

Build fails (Ubuntu/libav)

I'm getting some non-exhausted pattern match errors (Ubuntu 15.04):

>> Running: /usr/bin/cargo build
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading ffmpeg-sys v2.8.0-4
 Downloading ffmpeg v0.1.1
   Compiling ffmpeg-sys v2.8.0-4
   Compiling ffmpeg v0.1.1
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/util/format/pixel.rs:263:3: 455:4 error: non-exhaustive patterns: `AV_PIX_FMT_MMAL` not covered [E0004]
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/util/format/pixel.rs:263        match value {
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/util/format/pixel.rs:264            AV_PIX_FMT_NONE => Pixel::None,
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/util/format/pixel.rs:265 
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/util/format/pixel.rs:266            AV_PIX_FMT_YUV420P         => Pixel::YUV420P,
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/util/format/pixel.rs:267            AV_PIX_FMT_YUYV422         => Pixel::YUYV422,
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/util/format/pixel.rs:268            AV_PIX_FMT_RGB24           => Pixel::RGB24,
                                                                                                        ...
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/util/format/pixel.rs:263:3: 455:4 help: run `rustc --explain E0004` to see a detailed explanation
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/codec/id.rs:459:3: 890:4 error: non-exhaustive patterns: `AV_CODEC_ID_TDSC` not covered [E0004]
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/codec/id.rs:459         match value {
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/codec/id.rs:460             AV_CODEC_ID_NONE => Id::None,
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/codec/id.rs:461 
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/codec/id.rs:462             /* video codecs */
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/codec/id.rs:463             AV_CODEC_ID_MPEG1VIDEO             => Id::MPEG1VIDEO,
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/codec/id.rs:464             AV_CODEC_ID_MPEG2VIDEO             => Id::MPEG2VIDEO,
                                                                                               ...
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/codec/id.rs:459:3: 890:4 help: run `rustc --explain E0004` to see a detailed explanation
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/codec/packet/side_data.rs:29:3: 46:4 error: non-exhaustive patterns: `AV_PKT_DATA_QUALITY_STATS` not covered [E0004]
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/codec/packet/side_data.rs:29        match value {
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/codec/packet/side_data.rs:30            AV_PKT_DATA_PALETTE                  => Type::Palette,
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/codec/packet/side_data.rs:31            AV_PKT_DATA_NEW_EXTRADATA            => Type::NewExtraData,
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/codec/packet/side_data.rs:32            AV_PKT_DATA_PARAM_CHANGE             => Type::ParamChange,
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/codec/packet/side_data.rs:33            AV_PKT_DATA_H263_MB_INFO             => Type::H263MbInfo,
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/codec/packet/side_data.rs:34            AV_PKT_DATA_REPLAYGAIN               => Type::ReplayGain,
                                                                                                            ...
/home/user/.cargo/registry/src/github.com-0a35038f75765ae4/ffmpeg-0.1.1/src/codec/packet/side_data.rs:29:3: 46:4 help: run `rustc --explain E0004` to see a detailed explanation
error: aborting due to 3 previous errors
Could not compile `ffmpeg`.

build failed

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Failure { command: "\"pkg-config\" \"--libs\" \"--cflags\" \"libavutil\"", output: Output { status: ExitStatus(ExitStatus(256)), stdout: "", stderr: "Package libavutil was not found in the pkg-config search path.\nPerhaps you should add the directory containing `libavutil.pc\'\nto the PKG_CONFIG_PATH environment variable\nNo package \'libavutil\' found\n" } }', src/libcore/result.rs:997:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

Can't figure out how to properly resample decoded audio

Hi,

I'm trying to use ffmpeg to decode a file into s16le PCM samples, resampling to a new sample rate if necessary. So far, I've managed to get output that matches what I'd get by subprocessing ffmpeg, however, it's incomplete.

Every frame I get from the API matches what I get subprocessing, except the API is short a few (couple of hundred) frames. Now, If I change the sample rate on the resampler, I get the same amount of samples, but they don't match anymore, which leads me to believe I'm doing something terribly wrong somewhere, because something is changing when I modify the sample rate I create the resampler with, but, if I change the output sample rate of the subprocess, I get the same amount of samples as I do with the API resampler set to any value.

To recap, whenever I change the sample rate of the subprocessed ffmpeg, the amount of samples I get varies (which is what I'd expect), but when I change the sample rate of the resampler I create, I get the same amount of samples but with different values.

I assume this is because I'm decoding the file with it's original sample rate and filtering it like that, but I'm not sure where I should actually change the sample rate.

I've written an example project that exhibits the issue: https://github.com/nstafie/rust-ffmpeg-test (it takes an audio file as an argument, I've included a 44100 hz flac file in the repo)

Now, I'm not sure what else I should try, I've surely missed something, so I would really appreciate some help.

Thanks!

New Codec Context from Codec

Hi,
don't support new one ffmpeg::codec::Context struct from one ffmpeg::codec::codec::Codec struct ?

why this make CodecContext from Null ?

Example:

let code_id: AVCodecID           = AVCodecID::AV_CODEC_ID_MPEG1VIDEO;
let mut codec: *const AVCodec    = avcodec_find_encoder(code_id);
// Alloc Context need `Codec` data.
let mut c: AVCodecContext = avcodec_alloc_context3(codec);

But in /src/codec/context.rs#L36

Context { ptr: avcodec_alloc_context3(ptr::null()), owner: None }

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.