Git Product home page Git Product logo

codecbox.js's Introduction

codecbox.js

Codecbox.js is a pure javascript library providing fine-grained APIs for video/audio processing (currently only decoding is supported). Codecbox.js is based on FFmpeg and related libraries, which are compiled by emscripten into asm.js. Codecbox.js should run reasonably well in browsers with web worker and asm.js support.

View the demo page.

Currently codecbox.js is only provided as source code, you have to build it yourself.

Build

You need a Linux or similar system to build codecbox.js.

  1. Install emscripten, the C/C++ to asm.js comipler. Node.js should be installed as well.

  2. Install grunt, the build runner for JS.

  3. Clone codecbox.js repostory (suppose cloned to codecbox.js dir).

  4. Go to codecbox.js dir in a terminal, execute command npm install. Do the following steps in this dir as well.

  5. Execute command grunt init. This clones repos of ffmpeg and its external libraries (including x264, openh264, libvpx, libopus, lame, and zlib), so make sure you have good internet connection. This project try to build the latest master branch of these libraries. If you want to stick to specific versions, go to build/<lib_name> and checkout manually. You may also want to adjust and apply patches in patch dir.

  6. Execute command grunt build. This should compile ffmpeg etc. and produces codecbox.js and codecbox.js.mem in src dir.

  7. Load src/demo-player.html and try to play a media file (most common audio/video formats should be fine). This demo uses ffmpeg to decode media files, and renders video frames via HTML Canvas, and plays sound via Web Audio API.

Customization

You can customize the build of ffmpeg. Open file Gruntfile.js, and edit ffDecoders, ffDemuxers, ffParsers, ffEncoders, ffMuxers and ffFilters to select components of ffmpeg. You may also toggle comment of the following 2 lines to enable full ffmpeg build:

configure: ffmpegCustomConfig,
//configure: ffmpegFullConfig,

Currently the full ffmpeg build includes all its buildin components, as well as external libraries. Default custom build also include these external libraries.

API

Currently codecbox.js exposes a class Module.CodecBoxDecoder for video/audio decoding. See src/CodecBoxDecoder.h for its API. Note that C++ methods get_XXX()/set_XXX() are mapped to JS properties XXX. See also src/codecbox-decoder-worker.js for its usage. We plan to add video/audio encoding feature later on.

Acknowledgement

A lot of build settings are borrowed from the videoconverter.js project.

codecbox.js's People

Contributors

duanyao avatar

Watchers

James Cloos avatar HuangXianwei 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.