Code Monkey home page Code Monkey logo

obuparse's Introduction

obuparse

A simple and portable single file AV1 OBU parser written in mostly C89 with a tiny bit of C99, with a permissive license.

Why?

I got tired of rewriting ad-hoc OBU parsers for various tasks suchs as ISOBMFF muxing, MSE codec string generation, level verification, etc. So I decided to write once, as correctly as possible, and to use it everywhere in place of probably subtly-broken ad-hoc parsers.

I could have ripped out an OBU parser from other projects, but they're all either very intertwined with their respective encoder/decoder, written in very unportable manners, or in non-FFI friendly languages. At the time of writing this, I am not aware of any permissively licensed (or otherwise) OBU parsers that actually work portably.

How?

Simply copy obuparse.c and obuparser.h into your project, or use this repository as a git submodule.

By default, the parser uses a checked bitreader, but you can define OBP_UNCHECKED_BITREADER to use the unchecked version if that really matters to you.

All API documentation lives in obuparse.h.

There is also a Makefile provided for building a simple shared library on Linux. It should be straightforward to build for other OSes; all public symbols are namespaced with obp_. All public enums and types are namespaced with OBP.

Features

This section will expand as more of the library becomes complete, and it moves out of being a work in progress.

  • No allocations; only works on user-provided buffers and the stack.
  • OBU header parsing.
  • Sequence Header OBU parsing.
  • Metadata OBU parsing.
  • Tile List OBU parsing.
  • Tile Group OBU parsing.
  • Frame Header OBU parsing.
  • Frame OBU parsing.

Tools

The tools directory contains a simple tool to parse and serialize OBUs from an IVF file into JSON, called dumpobu.

obuparse's People

Contributors

dwbuiten avatar qyot27 avatar tdaede avatar tmatth 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

Watchers

 avatar  avatar  avatar  avatar  avatar

obuparse's Issues

no release tags

This project needs an official release version (even a beta version would do).
Can you tag the head of the repository with it's version so it can be properly packaged?
With new version from the author, it's going to be marked as "no-scheme" which puts a burden on software packagers.

you can already see the issue here:
https://repology.org/project/obuparse/versions

makefile is missing soname

The shared library doesn't have the soname definition for elf builds.

I had to patch the makefile like this:

--- Makefile.orig       2023-07-12 18:02:40 UTC
+++ Makefile
@@ -11,7 +11,7 @@ ifneq (,$(findstring mingw,$(CC)))
        SYSTEM=MINGW
 else
        LIBSUF=.so
-       LDFLAGS=-Wl,--version-script,obuparse.v
+       LDFLAGS=-Wl,--version-script,obuparse.v -Wl,-soname,libobuparse.so.1
 endif

 all: libobuparse$(LIBSUF) libobuparse.a

How to get OBU data from packet?

Hi,
I try to open ivf file and get raw obu data from packet. In documentation you write that parameter offset should get offet in buffer. But how to understand those values?

{"packet_number": 0, "packet_size": 4242}
{"obu_type": 2, "offset": 2, "obu_size": 0, "temporal_id": 0, "spatial_id": 0}
{"obu_type": 1, "offset": 2, "obu_size": 11, "temporal_id": 0, "spatial_id": 0}
{"obu_type": 6, "offset": 3, "obu_size": 4224, "temporal_id": 0, "spatial_id": 0}
{"packet_number": 1, "packet_size": 75}
{"obu_type": 2, "offset": 2, "obu_size": 0, "temporal_id": 0, "spatial_id": 0}
{"obu_type": 6, "offset": 2, "obu_size": 31, "temporal_id": 0, "spatial_id": 0}
{"obu_type": 6, "offset": 2, "obu_size": 38, "temporal_id": 0, "spatial_id": 0}

Packet 0 = 4224 + 11 != 4242
Why two OBUs has same offset?

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.