zmwangx / rust-ffmpeg

Safe FFmpeg wrapper.
Do What The F*ck You Want To Public License
1.28k stars 203 forks source link

Panic when trying to create video decoder #100

Open davidclevenger opened 2 years ago

davidclevenger commented 2 years ago

OS: MacOS Big Sur 11.6.4 Rust Toolchain: stable-x86_64-apple-darwin ffmpeg: 5.0 ffmpeg-next version: 4.4.0

Error output:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ffmpeg::Error(1128613112: )'`

(that's all)

Example:

// some imports may be unused
use ffmpeg_next as ffmpeg;
use ffmpeg::format::{input, output, Pixel};
use ffmpeg::media::Type;
use ffmpeg::software::scaling::{context::Context, flag::Flags};
use ffmpeg::util::frame::video::Video;

fn main() {
    let path = <absolute path to some video file (I've tested 'mp4' and 'mov' formats)>
    let mut ctx = input(&path.to_string()).unwrap();
                let input = ctx
                .streams()
                .best(Type::Video)
                .unwrap();
    let index = input.index();
    let mut decoder = input.codec().decoder().video().unwrap(); // <-- panics on err from ::video call
}
Polochon-street commented 2 years ago

Hi! Have you tried it with ffmpeg-next version 5.0.3? ffmpeg upstream changed the way they handle these (see how the examples look now)