Code Monkey home page Code Monkey logo

isobmff's Introduction

ISOBMFF

Build Status Coverage Status Issues Status License Contact

C++ Library for ISO/IEC 14496-12 - ISO Base Media File Format (QuickTime, MPEG-4, HEIF, etc)

About

ISOBMFF is a cross-platform C++ library for reading/parsing files in the ISO Base Media File Format (ISO/IEC 14496-12).

The ISO Base Media File Format is a container format, used by many file types, including:

  • QuickTime (.mov)
  • MPEG-4 (.m4v, .m4a, etc)
  • 3GP (.3g2)
  • HEIF/HEIC (.heif, .heic, etc)
  • ... and many others

Support for editing/writing files is not available at the moment, but the library has been designed for this goal in mind, so writing support will eventually become available.

ISO Base Media File Format

ISO base media file format (ISO/IEC 14496-12 - MPEG-4 Part 12) defines a general structure for time-based multimedia files such as video and audio.
It is designed as a flexible, extensible format that facilitates interchange, management, editing and presentation of the media.
The presentation may be local, or via a network or other stream delivery mechanism.
The file format is designed to be independent of any particular network protocol while enabling support for them in general.
It is used as the basis for other media file formats (e.g. container formats MP4 and 3GP).

Source: Wikipedia

Building

macOS

An Xcode project is provided for convenience, containing the following targets:

  • ISOBMFF: The main cross-platform C++ library.
  • ISOBMFF-Dump: A cross-platform command-line utility for dumping files.

Note that you can also build the library with make, on the command line.

Windows

An VisualStudio solution is provided for convenience, containing the following targets:

  • ISOBMFF Static v120xp: A static library built with the V120XP toolset (VS 2013)
  • ISOBMFF Static v140xp: A static library built with the V140XP toolset (VS 2015)
  • ISOBMFF Static v141xp: A static library built with the V141XP toolset (VS 2017)
  • ISOBMFF DLL v120xp: A dynamic library (DLL) built with the V120XP toolset (VS 2013)
  • ISOBMFF DLL v140xp: A dynamic library (DLL) built with the V140XP toolset (VS 2015)
  • ISOBMFF DLL v141xp: A dynamic library (DLL) built with the V141XP toolset (VS 2017)
  • ISOBMFF-Dump: A cross-platform command-line utility for dumping files.

Linux/Unix

The library can be build with make, on the command line.

Library Usage

Parsing is done with the ISOBMFF::Parser class:

ISOBMFF::Parser parser;

try
{
    parser.Parse( "path/to/some/file" );
}
catch( ... )
{}

When the parser is done, an instance of ISOBMFF::File can be retrieved:

std::shared_ptr< ISOBMFF::File > file = parser.GetFile();

Boxes can then be retrieved the following way, from the file:

std::shared_ptr< ISOBMFF::Box > box = file.GetBox( "ftyp" );

If the box does not exist, it will return nullptr.

A typed box can be retrieved the following way:

std::shared_ptr< ISOBMFF::FTYP > ftyp = file.GetTypedBox< ISOBMFF::FTYP >( "ftyp" );

Here, nullptr will be returned if the box does not exist, or is not of the correct type.

Container boxes acts just the same:

std::shared_ptr< ISOBMFF::ContainerBox > moov = file.GetTypedBox< ISOBMFF::ContainerBox >( "moov" );
std::shared_ptr< ISOBMFF::TRAK         > trak = moov.GetTypedBox< ISOBMFF::TRAK         >( "trak" );

The parser also supports custom boxes:

parser.RegisterBox( "abcd", [ = ]( void ) -> std::shared_ptr< CustomBox > { return std::make_shared< CustomBox >(); } );

It will then create an instance of CustomBox when encountering an abcd box somewhere in the file.

The custom class needs at least to inherit from Box:

class CustomBox: public ISOBMFF::Box
{
    public:
        
        CustomBox( void ): Box( "abcd" )
        {}
        
        void CustomBox::ReadData( Parser & parser, BinaryStream & stream )
        {
            /* Read box data here... */
        }
        
        std::vector< std::pair< std::string, std::string > > CustomBox::GetDisplayableProperties( void ) const
        {
            /* Returns box properties, to support output... */
            return {};
        }
};

License

ISOBMFF is released under the terms of the MIT License.

Repository Infos

Owner:          DigiDNA
Web:            www.digidna.net
Blog:           imazing.com/blog
Twitter:        @DigiDNA
GitHub:         github.com/DigiDNA

isobmff's People

Contributors

macmade avatar

Watchers

Wenbin Hou avatar

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.