Giter Site home page Giter Site logo

imager-io / ffmpeg-dev-rs Goto Github PK

View Code? Open in Web Editor NEW
51.0 4.0 13.0 29.17 MB

Rust - Self Contained FFmpeg Bindings

Home Page: https://crates.io/crates/ffmpeg-dev

License: MIT License

Rust 41.13% C 58.87%
ffmpeg ffmpeg-wrapper rust rust-ffi-bindings rust-ffi

ffmpeg-dev-rs's People

Contributors

colbyn avatar naps62 avatar pronvis 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

Watchers

 avatar  avatar  avatar  avatar

ffmpeg-dev-rs's Issues

run example failed

cargo run --example h264_video_dec

ffmpeg-dev-rs/target/debug/deps/libffmpeg_dev-def21d6af90e43d1.rlib(allcodecs.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC

Question on scaling video

Hi there. This isn't an actual issue, but more of a question. I hope that's ok.

I'm working on a project to reduce the disk space required by mp4 videos. I was planning on doing this by scaling down the resolution and lowering frames per second. I'm doing this with Rust, and my searching directed me to ffmpeg. This is my first exposure to ffmpeg.

Am I on the right track by using this library in the first place? If not, you can stop reading here and say so.

I found an ffmpeg example about scaling, but I'll be honest, it seems more complicated than I was expecting especially when just using the command line ffmpeg tool can scale with this command:

ffmpeg -i input.avi -vf scale=320:240 output.avi

Can you point me in the right direction for doing these operations (scaling and lowering fps)? Perhaps some pseudo code would be helpful. Thanks!

update ffmpeg archive?

I noticed this package has a hardcoded archive pointing to a build of ffmpeg

I'd be interested in updating that. mostly because I was trying to do h265, and my guess as to why I fail to find that encoder is because it didn't exist in this version

I'm not sure how I should go about this though. I have ffmpeg built on my own machine, but there's probably some requirements regarding compatibility?

Can't build on Raspberry Pi 4


pi@raspberrypi:~/rust-ffmpeg $ RUST_BACKTRACE=full cargo build
   Compiling ffmpeg-dev v0.3.7
error: failed to run custom build command for `ffmpeg-dev v0.3.7`

Caused by:
  process didn't exit successfully: `/home/pi/rust-ffmpeg/target/debug/build/ffmpeg-dev-9e731ab85a8ee3a6/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'assertion failed: result.status.success()', /home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/ffmpeg-dev-0.3.7/build.rs:292:13
stack backtrace:
   0:   0xaf40d0 - backtrace::backtrace::libunwind::trace::hda41dbcdfba36aa0
                       at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/libunwind.rs:88
   1:   0xaf40d0 - backtrace::backtrace::trace_unsynchronized::h24db1eb743e32b7a
                       at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66
   2:   0xaf40d0 - std::sys_common::backtrace::_print_fmt::h0ecd5de0be695bc9
                       at src/libstd/sys_common/backtrace.rs:76
   3:   0xaf40d0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf24f776311cdf529
                       at src/libstd/sys_common/backtrace.rs:60
   4:   0xb135d8 - core::fmt::write::h01edf6dd68a42c9c
                       at src/libcore/fmt/mod.rs:1030
   5:   0xaefa04 - std::io::Write::write_fmt::ha096f698ec4136ad
                       at src/libstd/io/mod.rs:1412
   6:   0xaf6620 - std::sys_common::backtrace::_print::h4b33c71a5db06ff0
                       at src/libstd/sys_common/backtrace.rs:64
   7:   0xaf6620 - std::sys_common::backtrace::print::h690a5e4a78826230
                       at src/libstd/sys_common/backtrace.rs:49
   8:   0xaf6620 - std::panicking::default_hook::{{closure}}::h9252dff4eab26d22
                       at src/libstd/panicking.rs:196
   9:   0xaf6260 - std::panicking::default_hook::hf5f567043bc78ff4
                       at src/libstd/panicking.rs:210
  10:   0xaf6d20 - std::panicking::rust_panic_with_hook::h9a662f58cf3f8ffe
                       at src/libstd/panicking.rs:473
  11:   0x518d0c - std::panicking::begin_panic::h268d833d957d2adf
                       at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/panicking.rs:407
  12:   0x4e04d0 - build_script_build::build::h44ca87797125b727
                       at /home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/ffmpeg-dev-0.3.7/build.rs:292
  13:   0x4e2120 - build_script_build::main::hebec4c61000db4e4
                       at /home/pi/.cargo/registry/src/github.com-1ecc6299db9ec823/ffmpeg-dev-0.3.7/build.rs:384
  14:   0x4e4368 - std::rt::lang_start::{{closure}}::h994adea77f38d3d4
                       at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/rt.rs:64
  15:   0xaf6790 - std::rt::lang_start_internal::{{closure}}::h480a8a74e6250ca9
                       at src/libstd/rt.rs:49
  16:   0xaf6790 - std::panicking::try::do_call::haa8fa7e95b273461
                       at src/libstd/panicking.rs:292
  17:   0xafdad8 - __rust_maybe_catch_panic
                       at src/libpanic_unwind/lib.rs:80
  18:   0xaf7198 - std::panicking::try::h7df0be55a6fa36e5
                       at src/libstd/panicking.rs:271
  19:   0xaf7198 - std::panic::catch_unwind::h4bd88ca4b117b223
                       at src/libstd/panic.rs:394
  20:   0xaf7198 - std::rt::lang_start_internal::h7d3aa0ed326f9560
                       at src/libstd/rt.rs:48
  21:   0x4e4338 - std::rt::lang_start::h101599b2e6607018
                       at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/rt.rs:64
  22:   0x4e2228 - main
  23: 0xb6d98718 - __libc_start_main

crashes here:

ffmpeg-dev-rs/build.rs

Lines 282 to 293 in 3b382ce

{
let mut cpu_number = num_cpus::get();
let result = std::process::Command::new("make")
.arg("-C")
.arg(&source_path)
.arg("-f")
.arg("Makefile")
.arg(&format!("-j{}", cpu_number))
.output()
.expect(&format!("make -C {:?} failed", source_path));
assert!(result.status.success());
}

--

How can I troubleshoot this?

how to resolve build error: unknown type name '*'

Hi, I got build error: unknown type name '*' when trying to build this crate:

LLVM_CONFIG_PATH=/usr/local/opt/llvm/bin/llvm-config cargo run --release --example h264_video_dec

  • Error report
--- stderr

--- stderr
/w/imager-io/ffmpeg-dev-rs/target/release/build/ffmpeg-dev-81b52e898a9ea16c/out/FFmpeg-FFmpeg-2722fc2/libavutil/buffer_internal.h:44:5: error: unknown type name 'atomic_uint'
/w/imager-io/ffmpeg-dev-rs/target/release/build/ffmpeg-dev-81b52e898a9ea16c/out/FFmpeg-FFmpeg-2722fc2/libavutil/buffer_internal.h:89:5: error: unknown type name 'atomic_uint'
/w/imager-io/ffmpeg-dev-rs/target/release/build/ffmpeg-dev-81b52e898a9ea16c/out/FFmpeg-FFmpeg-2722fc2/libavcodec/error_resilience.h:64:5: error: unknown type name 'atomic_int'
...

No debug symbols in debug build

build.rs contains this snippet:

            if is_debug_mode() && opt_level_eq(0) {
                configure_flags.push("--disable-optimizations");
                configure_flags.push("--disable-debug");
                configure_flags.push("--disable-stripping");
            }

This causes debug builds to explicitly request that debugging symbols not be built.

Maybe something like:

            if is_debug_mode() && opt_level_eq(0) {
                configure_flags.push("--disable-optimizations");
                configure_flags.push("--disable-stripping");
                configure_flags.push("--enable-debug");
            }
            else {
                configure_flags.push("--disable-debug");
            }

would be better.

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.