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

"annexb" #4

Open
jxors opened this issue Dec 22, 2020 · 0 comments
Open

"annexb" #4

jxors opened this issue Dec 22, 2020 · 0 comments

Comments

@jxors
Copy link

jxors commented Dec 22, 2020

Hi! Filing this issue because of the comment:

/// Please file an issue if you know what this does, because I have no idea.
pub fn annexb(mut self, annexb: bool) -> Self {

This repo doesn't seem very active anymore, but maybe this helps someone else struggling with the same thing as me.

The way I understand it, "Annex B" start codes are a way to be able to seek to the next/previous NAL unit from anywhere in a stream. The mp4 container does not use Annex B start codes, so if you're trying to use this library in combination with for example the mp4 crate, you need to make sure to turn off the Annex B start codes, because they're enabled by default. For example:

let mut encoder =
    Setup::preset(Preset::Medium, Tune::None, false, true)
        .annexb(false)
        .build(Colorspace::I420, WIDTH as _, HEIGHT as _)
        .unwrap();

(also, make sure to crop off the first 4 bytes of the SPS and PPS headers before passing them to mp4)

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