Git Product home page Git Product logo

ngx_http_enhance_mp4_module's Introduction

ngx_http_enhance_mp4_module

  • This module is an enhance version of original nginx mp4 module (which shipped into nginx source code). Please note this is my own project, it has nothing related with nginx's source code except it takes all source code of ngx_http_mp4_module.

  • This module enable nginx mp4 module to modify mp4 file (which moov atom place in the last of file) on the fly (just one time), then deliver it to video player.

This is why

  • In order to deliver HTTP (RTMP and other can do better) video on demand (using ngx_http_mp4_module) the right way: player just has to download:
    1. the ftyp atom and check that the container format, version and branding are supported.
    2. moov atom, check that the required codec are available and use the "stco" sub-atoms to start decoding the video and audio streams.

The whole data is mdat atom, which can be buffered, decompressed and play later.

The ftyp and moov atom are just few KB, so if these atom are placed in the begining of the file, every player can start progressive download just after download them. Most of video encoder/muxer/demuxer (without doing 2 pass encoding) place moov atom in the last of the file, which cause progressive playback has problem. Browser has to download the whole file in order to start playing that file, it's not progressive playback anymore.

These tools above require you to do this at encoding step: convert the file, standardise it. Using this module, you dont have to standarlise using above tool anymore (you still have to convert file into Quick time format).

Usage:

  • install

    • ./configure --add-module=ngx_http_enhance_mp4_module
  • like mp4 module, nginx configuration file will look likes this:

    location /mp4 {
                error_log logs/mp4_debug.log debug;
                root /data2/streams/ ;
                enhance_mp4;
                fix_mp4 on;
                enhance_mp4_buffer_size 1m;
                enhance_mp4_max_buffer_size 50m;
    }
  • which:
    • enhance_mp4, enhance_mp4_buffer_size, enhance_mp4_max_buffer_size are the same with mp4, mp4_buffer_size, and mp4_max_buffer_size directives from the original module.
    • fix_mp4: when it is on, mp4 file will be fixed if needed, if moov atom is place in right order, we dont have to fix it. if it is off, this module works exactly the way nginx mp4 module do (so why you use it).

Note:

  • To make it less conflict with nginx mp4 module, I've tried to change its namespace from ngx_mp4 -> ngx_enhance_mp4, I don't take license of this.

ngx_http_enhance_mp4_module's People

Contributors

whatvn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.