Code Monkey home page Code Monkey logo

examples's Introduction

Rust-AV

Actions Status CodeCov dependency status IRC LICENSE

Pure-rust implementation of multimedia primitives and eventually some examples of demuxers, muxers and codecs.

Compiling

cargo build --workspace

Running tests

cargo test --workspace

Examples

Examples can be found in the examples repository.

Notes

The code is still in flux and the API is getting slowly fleshed out, please refer to the sub-crates. Until we reach version 1.0 assume that the API could change a lot.

License

Released under the MIT License.

Developing

I suggest to use the cargo paths override to have a local rust-av:

# Clone the trees
$ git clone https://github.com/rust-av/rust-av
$ git clone https://github.com/rust-av/${other package}
# Setup the override
$ cd ${other package}
$ mkdir .cargo
$ echo 'paths=["../rust-av"]' > .cargo/config
# Check it is doing the right thing
$ cargo build

Getting in Touch

Come chat with us on our IRC channel clicking the badge above! You can also use a web client to join with a web browser.

Otherwise, you can open a new discussion explaining your idea or problem as best as possible.

examples's People

Contributors

dependabot-preview[bot] avatar luni-4 avatar yinheli avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

examples's Issues

Current master does not build

I am tring to build bca2a6c under Mac OS and see these errors when running cargo build --all. I have similar errors when trying to compile https://github.com/rust-av/avp.

error[E0277]: the trait bound `MkvDemuxer: Demuxer` is not satisfied
  --> streams-info/src/streams_info.rs:38:36
   |
38 |     let mut demuxer = Context::new(MkvDemuxer::new(), ar);
   |                       ------------ ^^^^^^^^^^^^^^^^^ the trait `Demuxer` is not implemented for `MkvDemuxer`
   |                       |
   |                       required by a bound introduced by this call
   |
note: required by a bound in `av_format::demuxer::Context::<D, R>::new`
  --> /Users/hrapp/.cargo/registry/src/github.com-1ecc6299db9ec823/av-format-0.5.0/src/demuxer.rs:57:9
   |
57 | impl<D: Demuxer, R: Buffered> Context<D, R> {
   |         ^^^^^^^ required by this bound in `av_format::demuxer::Context::<D, R>::new`

error[E0277]: the trait bound `MkvDemuxer: Demuxer` is not satisfied
  --> frames-info/src/frames_info.rs:86:36
   |
86 |     let mut demuxer = Context::new(MkvDemuxer::new(), ar);
   |                       ------------ ^^^^^^^^^^^^^^^^^ the trait `Demuxer` is not implemented for `MkvDemuxer`
   |                       |
   |                       required by a bound introduced by this call
   |
note: required by a bound in `av_format::demuxer::Context::<D, R>::new`
  --> /Users/hrapp/.cargo/registry/src/github.com-1ecc6299db9ec823/av-format-0.5.0/src/demuxer.rs:57:9
   |
57 | impl<D: Demuxer, R: Buffered> Context<D, R> {
   |         ^^^^^^^ required by this bound in `av_format::demuxer::Context::<D, R>::new`

error[E0277]: the trait bound `MkvDemuxer: Demuxer` is not satisfied
  --> streams-info/src/streams_info.rs:38:23
   |
38 |     let mut demuxer = Context::new(MkvDemuxer::new(), ar);
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Demuxer` is not implemented for `MkvDemuxer`
   |
note: required by a bound in `av_format::demuxer::Context`
  --> /Users/hrapp/.cargo/registry/src/github.com-1ecc6299db9ec823/av-format-0.5.0/src/demuxer.rs:46:23
   |
46 | pub struct Context<D: Demuxer, R: Buffered> {
   |                       ^^^^^^^ required by this bound in `av_format::demuxer::Context`

error[E0277]: the trait bound `MkvDemuxer: Demuxer` is not satisfied
  --> frames-info/src/frames_info.rs:86:23
   |
86 |     let mut demuxer = Context::new(MkvDemuxer::new(), ar);
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Demuxer` is not implemented for `MkvDemuxer`
   |
note: required by a bound in `av_format::demuxer::Context`
  --> /Users/hrapp/.cargo/registry/src/github.com-1ecc6299db9ec823/av-format-0.5.0/src/demuxer.rs:46:23
   |
46 | pub struct Context<D: Demuxer, R: Buffered> {
   |                       ^^^^^^^ required by this bound in `av_format::demuxer::Context`

error[E0599]: the method `read_headers` exists for struct `av_format::demuxer::Context<MkvDemuxer, AccReader<File>>`, but its trait bounds were not satisfied
  --> frames-info/src/frames_info.rs:90:10
   |
90 |         .read_headers()
   |          ^^^^^^^^^^^^ method cannot be called on `av_format::demuxer::Context<MkvDemuxer, AccReader<File>>` due to unsatisfied trait bounds
   |
  ::: /Users/hrapp/.cargo/git/checkouts/matroska-89de4ba236a0b22a/b88747c/src/demuxer.rs:26:1
   |
26 | pub struct MkvDemuxer {
   | --------------------- doesn't satisfy `MkvDemuxer: Demuxer`
   |
   = note: the following trait bounds were not satisfied:
           `MkvDemuxer: Demuxer`

error[E0599]: the method `read_headers` exists for struct `av_format::demuxer::Context<MkvDemuxer, AccReader<File>>`, but its trait bounds were not satisfied
  --> streams-info/src/streams_info.rs:42:10
   |
42 |         .read_headers()
   |          ^^^^^^^^^^^^ method cannot be called on `av_format::demuxer::Context<MkvDemuxer, AccReader<File>>` due to unsatisfied trait bounds
   |
  ::: /Users/hrapp/.cargo/git/checkouts/matroska-89de4ba236a0b22a/b88747c/src/demuxer.rs:26:1
   |
26 | pub struct MkvDemuxer {
   | --------------------- doesn't satisfy `MkvDemuxer: Demuxer`
   |
   = note: the following trait bounds were not satisfied:
           `MkvDemuxer: Demuxer`

error[E0277]: the trait bound `libvpx::decoder::decoder_trait::Des: av_codec::decoder::Descriptor` is not satisfied
   --> frames-info/src/frames_info.rs:94:43
    |
94  |     let decoders = DecCodecs::from_list(&[VP9_DESCR, OPUS_DESCR, VORBIS_DESCR]);
    |                                           ^^^^^^^^^ the trait `av_codec::decoder::Descriptor` is not implemented for `libvpx::decoder::decoder_trait::Des`
    |
help: trait impl with same name found
   --> /Users/hrapp/.cargo/git/checkouts/vpx-rs-ab48b307657c386f/dca2a43/src/decoder.rs:207:5
    |
207 |     impl Descriptor for Des {
    |     ^^^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `av_codec` are being used?
    = note: required for the cast from `libvpx::decoder::decoder_trait::Des` to the object type `dyn av_codec::decoder::Descriptor`

error[E0277]: the trait bound `libopus::decoder::decoder_trait::Des: av_codec::decoder::Descriptor` is not satisfied
   --> frames-info/src/frames_info.rs:94:54
    |
94  |     let decoders = DecCodecs::from_list(&[VP9_DESCR, OPUS_DESCR, VORBIS_DESCR]);
    |                                                      ^^^^^^^^^^ the trait `av_codec::decoder::Descriptor` is not implemented for `libopus::decoder::decoder_trait::Des`
    |
help: trait impl with same name found
   --> /Users/hrapp/.cargo/git/checkouts/opus-rs-377ca7da91dbf68d/fde014f/src/decoder.rs:153:5
    |
153 |     impl Descriptor for Des {
    |     ^^^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `av_codec` are being used?
    = note: required for the cast from `libopus::decoder::decoder_trait::Des` to the object type `dyn av_codec::decoder::Descriptor`

error[E0277]: the trait bound `Des: av_codec::decoder::Descriptor` is not satisfied
  --> frames-info/src/frames_info.rs:94:66
   |
94 |     let decoders = DecCodecs::from_list(&[VP9_DESCR, OPUS_DESCR, VORBIS_DESCR]);
   |                                                                  ^^^^^^^^^^^^ the trait `av_codec::decoder::Descriptor` is not implemented for `Des`
   |
help: trait impl with same name found
  --> /Users/hrapp/.cargo/git/checkouts/av-vorbis-dc0aa63993bfa8b4/fc06e1c/src/decoder.rs:45:1
   |
45 | impl Descriptor for Des {
   | ^^^^^^^^^^^^^^^^^^^^^^^
   = note: perhaps two different versions of crate `av_codec` are being used?
   = note: required for the cast from `Des` to the object type `dyn av_codec::decoder::Descriptor`

error[E0277]: the trait bound `MkvDemuxer: Demuxer` is not satisfied
   --> frames-info/src/frames_info.rs:119:46
    |
119 |     while let Ok(data) = decode_single_frame(&mut demuxer, &mut decs) {
    |                          ------------------- ^^^^^^^^^^^^ the trait `Demuxer` is not implemented for `MkvDemuxer`
    |                          |
    |                          required by a bound introduced by this call
    |
note: required by a bound in `decode_single_frame`
   --> frames-info/src/frames_info.rs:24:27
    |
24  | fn decode_single_frame<D: Demuxer, R: Buffered>(
    |                           ^^^^^^^ required by this bound in `decode_single_frame`

Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `streams-info` due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `frames-info` due to 7 previous errors

can't build on windows

My Environment:
Windows 10 1809
Visual studio 2022
vcpkg commit 6a29f32
libvpx & opus installed with vcpkg:
libvpx:x64-windows 1.11.0#1
opus:x64-windows 1.3.1#6

I have tried some ffmpeg binding crates with vcpkg and succeed, so the vcpkg settings would be correct.
when I run "cargo build", it shows

...
Compiling opus-sys v0.1.0 (https://github.com/rust-av/opus-rs#a59e7a10)
Compiling vpx-sys v0.1.1 (https://github.com/rust-av/vpx-rs#84694096)
error: failed to run custom build command for opus-sys v0.1.0 (https://github.com/rust-av/opus-rs#a59e7a10)

Caused by:
process didn't exit successfully: D:\Code\rust\rust-av\examples\target\debug\build\opus-sys-c6e88b1fe60364f8\build-script-build (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=OPUS_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=OPUS_STATIC
cargo:rerun-if-env-changed=OPUS_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

--- stderr
thread 'main' panicked at 'called Result::unwrap() on an Err value: Error(PkgConfig(Could not run "pkg-config" "--libs" "--cflags" "opus" "opus >= 1.3"
The pkg-config command could not be found.

Most likely, you need to install a pkg-config package for your OS.

If you've already installed it, ensure the pkg-config command is one of the
directories in the PATH environment variable.

If you did not expect this build to link to a pre-installed system library,
then check documentation of the opus-sys crate for an option to
build the library from source, or disable features or dependencies
that require pkg-config.), State { next_error: None })', C:\Users\Administrator.cargo\git\checkouts\opus-rs-377ca7da91dbf68d\a59e7a1\opus-sys\build.rs:19:34
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for vpx-sys v0.1.1 (https://github.com/rust-av/vpx-rs#84694096)

Caused by:
process didn't exit successfully: D:\Code\rust\rust-av\examples\target\debug\build\vpx-sys-603f0f9baa1bcc53\build-script-build (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=VPX_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-msvc
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

--- stderr
thread 'main' panicked at 'called Result::unwrap() on an Err value: PkgConfig(Could not run "pkg-config" "--libs" "--cflags" "vpx" "vpx >= 1.5.0"
The pkg-config command could not be found.

Most likely, you need to install a pkg-config package for your OS.

If you've already installed it, ensure the pkg-config command is one of the
directories in the PATH environment variable.

If you did not expect this build to link to a pre-installed system library,
then check documentation of the vpx-sys crate for an option to
build the library from source, or disable features or dependencies
that require pkg-config.)', C:\Users\Administrator.cargo\git\checkouts\vpx-rs-ab48b307657c386f\8469409\vpx-sys\build.rs:19:51
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

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.