Giter Site home page Giter Site logo

dynamediapackager's Introduction

dynaMediaPackager

This repo provides a C/C++ library called dynaMediaPackager for transmuxing and encrypting media data. The library provides one single function which accepts a raw memory buffer that stores for example mp4 or ts media data, run all the media processing jobs, then returns the processed media data back to the caller function.

The library is developed on top of the Shaka packager API. However, unlike running Shaka packager directly on a media file which requires reading the input file and then followed by writing the output to another file, client applications of dynaMediaPackager can pass in input media data as memory buffer, and after the media processing are done, the applications receive processed media data also from memory buffer. This API design provides two performance benefits,

- Eliminate the need to read input and write output when using Shaka packager directly on file inputs, hence reduce I/O overhead and improve media packaging throughput.

- The client applications receives processed media data as memory buffer. It can run further media processing on the returned data all in memory. If the client application is a Just-in-Time media packager (aka. dynamic packager) built into a webserver, the processed media data can be sent back to web clients (e.g. HLS or DASH players) as HTTP response.  

Structure of this repo:

- The .cc files provide the C++ implementation of dynaMediaPackager.

- The .c files provide C interface for integrating the library into programs   written in C, or programs written in Go which use CGO to call C functions. For example, dynaMediaPackager can be integrated into NGINX (written in C) as a module to implement a dynamic media packager.

- packagerMain.cc provides a C/C++ sample application that uses dynaMediaPackager.

- packager_proxy.go provides a Go program that implements a simple dynamic packager proxy that can play both an HLS-fmp4 stream and an HLS-ts stream at the same time, from only one single set of mezzanine fmp4 media segments. The fmp4 segments are dynamically repackaged to ts segments to stream as an HLS-ts stream.

How to build:

To build dynaMediaPackager, first check out Shaka packager source from https://github.com/google/shaka-packager, put it in the same directory as this repo. Follow https://github.com/shaka-project/shaka-packager/blob/main/docs/source/build_instructions.md to build Shaka packager on Ubuntu. Build Shaka packager for release, "ninja -C out/Release". Depending on its release version, Shaka packager may have slightly different dependencies. You may need to resolve the dependencies on your own. For example, I had to manually install libcares. Then, cd to dynaMediaSegmentPackager/, run "make" to build the C++ sample packager, and the Go dynamic packager.

Run "dynaMediaPackager [input] [output]" to perform media segment repackaging and encryption, run "./dynaMediaPackager [input] [output] no_protection" to perform media segment repackaging only.

Run "packager_proxy" to start the dynamic packager proxy. The proxy listens on port 8080. A docker container tar file is provided with all the setup for testing packager_proxy.

dynamediapackager's People

Contributors

maxutility2011 avatar

Stargazers

Sergey Tikhonov avatar ALIEN MASTER avatar Van Nguyen avatar  avatar Nate Burr avatar Raul Santos avatar

Watchers

 avatar

Forkers

kuczek

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.