x264
x264 copied to clipboard
"annexb"
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
)