Coder Social home page Coder Social logo

avp'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.

avp's People

Contributors

dependabot-preview[bot] avatar est31 avatar fkaa avatar lu-zero avatar luni-4 avatar sdroege 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

avp's Issues

Failed to build

I am running rustc 1.37.0 (eae3437df 2019-08-13), on Fedora 29, but I am unable to build.
Here's the error:

   Compiling opus-sys v0.1.0 (https://github.com/rust-av/opus-rs#966ce08b)
error: failed to run custom build command for `vpx-sys v0.1.0 (https://github.com/rust-av/vpx-rs#2a509f97)`

Caused by:
  process didn't exit successfully: `/home/are/Tools/avp/target/debug/build/vpx-sys-92c1115ce0fd9917/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(PkgConfig(Failure { command: "\"pkg-config\" \"--libs\" \"--cflags\" \"vpx\" \"vpx >= 1.5.0\"", output: Output { status: ExitStatus(ExitStatus(256)), stdout: "", stderr: "Package vpx was not fou
nd in the pkg-config search path.\nPerhaps you should add the directory containing `vpx.pc\'\nto the PKG_CONFIG_PATH environment variable\nPackage \'vpx\', required by \'virtual:world\', not found\nPackage \'vpx\', required by \'virtual:world\', not found\n" } }), State {
 next_error: None })', src/libcore/result.rs:999:5
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 `opus-sys v0.1.0 (https://github.com/rust-av/opus-rs#966ce08b)`

Caused by:
  process didn't exit successfully: `/home/are/Tools/avp/target/debug/build/opus-sys-6d767d1ba017ef27/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(PkgConfig(Failure { command: "\"pkg-config\" \"--libs\" \"--cflags\" \"opus\" \"opus >= 1.3\"", output: Output { status: ExitStatus(ExitStatus(256)), stdout: "", stderr: "Package opus was not found in the pkg-config search path.\nPerhaps you should add the directory containing `opus.pc\'\nto the PKG_CONFIG_PATH environment variable\nPackage \'opus\', required by \'virtual:world\', not found\nPackage \'opus\', required by \'virtual:world\', not found\n" } }), State { next_error: None })', src/libcore/result.rs:999:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

Build fails (the trait bound `MkvDemuxer: format::demuxer::Demuxer` is not satisfied)

Build

git clone https://github.com/rust-av/avp.git
cd avp
cargo build

Error

Compiling avp v0.1.0 (/Users/gabe/code/rust/video-processing/avp)
error[E0277]: the trait bound `MkvDemuxer: format::demuxer::Demuxer` is not satisfied
   --> src/main.rs:147:34
    |
147 |         let mut c = Context::new(Box::new(MkvDemuxer::new()), Box::new(ar));
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `format::demuxer::Demuxer` is not implemented for `MkvDemuxer`
    |
    = note: required for the cast to the object type `dyn format::demuxer::Demuxer`

error[E0277]: the trait bound `vpx::decoder::decoder_trait::Des: codec::decoder::Descriptor` is not satisfied
   --> src/main.rs:151:47
    |
151 |         let decoders = DecCodecs::from_list(&[VP9_DESCR, OPUS_DESCR, VORBIS_DESCR]);
    |                                               ^^^^^^^^^ the trait `codec::decoder::Descriptor` is not implemented for `vpx::decoder::decoder_trait::Des`
    |
    = note: required for the cast to the object type `dyn codec::decoder::Descriptor`

error[E0277]: the trait bound `opus::decoder::decoder_trait::Des: codec::decoder::Descriptor` is not satisfied
   --> src/main.rs:151:58
    |
151 |         let decoders = DecCodecs::from_list(&[VP9_DESCR, OPUS_DESCR, VORBIS_DESCR]);
    |                                                          ^^^^^^^^^^ the trait `codec::decoder::Descriptor` is not implemented for `opus::decoder::decoder_trait::Des`
    |
    = note: required for the cast to the object type `dyn codec::decoder::Descriptor`

error[E0277]: the trait bound `Des: codec::decoder::Descriptor` is not satisfied
   --> src/main.rs:151:70
    |
151 |         let decoders = DecCodecs::from_list(&[VP9_DESCR, OPUS_DESCR, VORBIS_DESCR]);
    |                                                                      ^^^^^^^^^^^^ the trait `codec::decoder::Descriptor` is not implemented for `Des`
    |
    = note: required for the cast to the object type `dyn codec::decoder::Descriptor`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `avp` due to 4 previous errors

Could not compile `avp`

I'm using rustc 1.38.0 (625451e37 2019-09-23) on Darwin.
Following error occurred when running cargo build --verbose.

Compiling avp v0.1.0 (/Users/orcaxs/dev/rust/projects/avp)
     Running `rustc --crate-name avp src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=f352847a0c0226f1 -C extra-filename=-f352847a0c0226f1 --out-dir /Users/orcaxs/dev/rust/projects/avp/target/debug/deps -C incremental=/Users/orcaxs/dev/rust/projects/avp/target/debug/incremental -L dependency=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps --extern av_codec=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/libav_codec-992dbd81d5ebf114.rlib --extern av_data=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/libav_data-a3716311a872ae36.rlib --extern av_format=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/libav_format-c7b1776eb6152662.rlib --extern av_vorbis=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/libav_vorbis-2671a5a057673e57.rlib --extern clap=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/libclap-d4711d17da7c7f3d.rlib --extern libopus=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/liblibopus-94eac1e4b417a368.rlib --extern libvpx=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/liblibvpx-3f9f7345116b483e.rlib --extern matroska=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/libmatroska-a4f439bca8d455d8.rlib --extern sdl2=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/libsdl2-6ae25e94e4164c24.rlib -L native=/Users/orcaxs/dev/rust/projects/avp/target/debug/build/backtrace-sys-25756d2a018dbc14/out -L native=/usr/local/Cellar/opus/1.3.1/lib -L native=/usr/local/Cellar/libvpx/1.8.1/lib`
error[E0277]: the trait bound `matroska::demuxer::MkvDemuxer: format::demuxer::Demuxer` is not satisfied
   --> src/main.rs:138:34
    |
138 |         let mut c = Context::new(Box::new(MkvDemuxer::new()), Box::new(ar));
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `format::demuxer::Demuxer` is not implemented for `matroska::demuxer::MkvDemuxer`
    |
    = note: required for the cast to the object type `dyn format::demuxer::Demuxer`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
error: Could not compile `avp`.

Caused by:
  process didn't exit successfully: `rustc --crate-name avp src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=f352847a0c0226f1 -C extra-filename=-f352847a0c0226f1 --out-dir /Users/orcaxs/dev/rust/projects/avp/target/debug/deps -C incremental=/Users/orcaxs/dev/rust/projects/avp/target/debug/incremental -L dependency=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps --extern av_codec=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/libav_codec-992dbd81d5ebf114.rlib --extern av_data=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/libav_data-a3716311a872ae36.rlib --extern av_format=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/libav_format-c7b1776eb6152662.rlib --extern av_vorbis=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/libav_vorbis-2671a5a057673e57.rlib --extern clap=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/libclap-d4711d17da7c7f3d.rlib --extern libopus=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/liblibopus-94eac1e4b417a368.rlib --extern libvpx=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/liblibvpx-3f9f7345116b483e.rlib --extern matroska=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/libmatroska-a4f439bca8d455d8.rlib --extern sdl2=/Users/orcaxs/dev/rust/projects/avp/target/debug/deps/libsdl2-6ae25e94e4164c24.rlib -L native=/Users/orcaxs/dev/rust/projects/avp/target/debug/build/backtrace-sys-25756d2a018dbc14/out -L native=/usr/local/Cellar/opus/1.3.1/lib -L native=/usr/local/Cellar/libvpx/1.8.1/lib` (exit code: 1)

clang version clash

If I naively clone and then use cargo build I'm blocked by this:

package `clang-sys v0.22.0`
    ... which is depended on by `bindgen v0.37.0`
    ... which is depended on by `opus-sys v0.1.0 (https://github.com/rust-av/opus-rs#c7329ada)`
    ... which is depended on by `libopus v0.1.0 (https://github.com/rust-av/opus-rs#c7329ada)`
    ... which is depended on by `avp v0.1.0 `
links to native library `clang`

package `clang-sys v0.26.4`
    ... which is depended on by `bindgen v0.45.0`
    ... which is depended on by `vpx-sys v0.1.0 (https://github.com/rust-av/vpx-rs#7d2c86b4)`
    ... which is depended on by `libvpx v0.1.0 (https://github.com/rust-av/vpx-rs#7d2c86b4)`
    ... which is depended on by `avp v0.1.0 `
also links to native library `clang`

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

    Updating crates.io index
    Updating git repository `https://github.com/rust-av/av-vorbis`
    Updating git repository `https://github.com/rust-av/opus-rs`
    Updating git repository `https://github.com/rust-av/vpx-rs`
    Updating git repository `https://github.com/rust-av/matroska`
error: failed to select a version for `clang-sys`.
    ... required by package `bindgen v0.54.0`
    ... which is depended on by `opus-sys v0.1.0 (https://github.com/rust-av/opus-rs#6d741399)`
    ... which is depended on by `libopus v0.1.0 (https://github.com/rust-av/opus-rs#6d741399)`
    ... which is depended on by `avp v0.1.0 (/home/dependabot/dependabot-updater/dependabot_tmp_dir//github.com/rust-av/vpx-rs#c3e2cc6c)`
    ... which is depended on by `libvpx v0.1.0 (https://github.com/rust-av/vpx-rs#c3e2cc6c)`
    ... which is depended on by `avp v0.1.0 (/home/dependabot/dependabot-updater/dependabot_tmp_dir

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Build Fails (missing libopus)

rustc 1.59.0 (9d1b2106e 2022-02-23)
Running cargo update

    Updating crates.io index
    Updating git repository `https://github.com/rust-av/av-vorbis`
    Updating git repository `https://github.com/rust-av/opus-rs`
    Updating git repository `https://github.com/rust-av/vpx-rs`
    Updating git repository `https://github.com/rust-av/matroska`

Running cargo build fails

  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)`

  process didn't exit successfully: `F:\_\avp\target\debug\build\opus-sys-acbc3b6f20e1d051\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(`"pkg-config" "--libs" "--cflags" "opus" "opus >= 1.3"` did not exit successfully: exit code: 1
  error: could not find system library 'opus' required by the 'opus-sys' crate

  --- stderr
  Package opus was not found in the pkg-config search path.
  Perhaps you should add the directory containing `opus.pc'
  to the PKG_CONFIG_PATH environment variable
  Package 'opus', required by 'virtual:world', not found
  Package 'opus', required by 'virtual:world', not found
  ), State { next_error: None })', C:\Users\User\.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: build failed

Fails to build

This is possibly due to the git dependencies. Did you consider commiting the Cargo.lock file to the repo? :)

Setting up the github workflow to run periodically could also help, but might be unnecessary with the lock file in the repo.

Thanks!

error[E0277]: the trait bound `MkvDemuxer: format::demuxer::Demuxer` is not satisfied
   --> src/main.rs:138:34
    |
138 |         let mut c = Context::new(Box::new(MkvDemuxer::new()), Box::new(ar));
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `format::demuxer::Demuxer` is not implemented for `MkvDemuxer`
    |
    = note: required for the cast to the object type `dyn format::demuxer::Demuxer`

error[E0308]: mismatched types
   --> src/main.rs:186:41
    |
186 |                         dec.send_packet(&pkt).unwrap(); // TODO report error
    |                                         ^^^^ expected struct `av_data::packet::Packet`, found struct `data::packet::Packet`
    |
    = note: expected reference `&av_data::packet::Packet`
               found reference `&data::packet::Packet`
    = note: perhaps two different versions of crate `av_data` are being used?

error[E0308]: mismatched types
   --> src/main.rs:187:28
    |
187 |                         Ok(dec.receive_frame().ok())
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `data::frame::Frame`, found struct `av_data::frame::Frame`
    |
    = note: expected enum `Option<Arc<data::frame::Frame>>`
               found enum `Option<Arc<av_data::frame::Frame>>`
    = note: perhaps two different versions of crate `av_data` are being used?

error: aborting due to 3 previous errors

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

    Updating crates.io index
    Updating git repository `https://github.com/rust-av/av-vorbis`
    Updating git repository `https://github.com/rust-av/opus-rs`
    Updating git repository `https://github.com/rust-av/vpx-rs`
    Updating git repository `https://github.com/rust-av/matroska`
error: failed to select a version for `clang-sys`.
    ... required by package `bindgen v0.54.0`
    ... which is depended on by `opus-sys v0.1.0 (https://github.com/rust-av/opus-rs#6d741399)`
    ... which is depended on by `libopus v0.1.0 (https://github.com/rust-av/opus-rs#6d741399)`
    ... which is depended on by `avp v0.1.0 (/home/dependabot/dependabot-updater/dependabot_tmp_dir//github.com/rust-av/vpx-rs#f2ddb045)`
    ... which is depended on by `libvpx v0.1.0 (https://github.com/rust-av/vpx-rs#f2ddb045)`
    ... which is depended on by `avp v0.1.0 (/home/dependabot/dependabot-updater/dependabot_tmp_dir

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

    Updating crates.io index
    Updating git repository `https://github.com/rust-av/av-vorbis`
    Updating git repository `https://github.com/rust-av/opus-rs`
    Updating git repository `https://github.com/rust-av/vpx-rs`
    Updating git repository `https://github.com/rust-av/matroska`
error: failed to select a version for `clang-sys`.
    ... required by package `bindgen v0.52.0`
    ... which is depended on by `vpx-sys v0.1.0 (https://github.com/rust-av/vpx-rs#c3e2cc6c)`
    ... which is depended on by `libvpx v0.1.0 (https://github.com/rust-av/vpx-rs#c3e2cc6c)`
    ... which is depended on by `avp v0.1.0 (/home/dependabot/dependabot-updater/dependabot_tmp_dir//github.com/rust-av/opus-rs#6d741399)`
    ... which is depended on by `libopus v0.1.0 (https://github.com/rust-av/opus-rs#6d741399)`
    ... which is depended on by `avp v0.1.0 (/home/dependabot/dependabot-updater/dependabot_tmp_dir

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Implement other A/V sync clocks

Right now avp assumes continuous audio, computes the frame cadence using the system clock.

Would be nice to have an option to use the audio as clock source optionally.

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.