Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video end behavior regression #53

Open
FlashOnFire opened this issue Nov 16, 2024 · 0 comments
Open

Video end behavior regression #53

FlashOnFire opened this issue Nov 16, 2024 · 0 comments

Comments

@FlashOnFire
Copy link

FlashOnFire commented Nov 16, 2024

Hi
I'm running into an issue with the recent versions of video-rs
I recently upgraded my project from video-rs 0.8..1 to the latest version and it now produces an Ffmpeg backend error EOF when reaching the end of a video instead of a regular readexhausted (or the new decodeexhausted).

I bisected this, it works fine on 0.9.0 and stops working on 0.10.0 and above

This simple minimal code is enough to reproduce the bug :

use std::path::PathBuf;
use video_rs::{Decoder, Error, Location};

fn main() {
    let source = Location::File(PathBuf::from("test.mp4"));
    let mut decoder = Decoder::new(source).expect("Failed to create decoder");

    let mut i = 0;
    loop {
        match decoder.decode() {
            Ok(_) => {
                println!("Frame : {i}");
                i += 1;
            }
            Err(err) => match err {
                Error::ReadExhausted => {
                    decoder.seek_to_start().unwrap();
                    i = 0;
                    println!("restart");
                }
                _ => panic!("Error while decoding video frames : {:?}", err),
            },
        };
    }
}

Am i missing something ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant