Giter Site home page Giter Site logo

opusenc.js's Introduction

opusenc.js Build Status

JavaScript Opus (audio format) Encoder

Project Website โ€ข Minimal demo

Opusenc.js encodes whole files to ogg-opus; this is Opus encapsulated into an Ogg container. It is supposed to do the same as the opusenc tools from the opus-tools collection and as such supports features like Vorbis comment, preserving some metadata, reading AIF, WAV, and FLAC (in its native container).

opusenc.js was built with Emscripten.

Building

If you just want to use opusenc.js, you don't have to build it. In this case, see using instead.

Prerequisites

  • A recent linux build system
  • Emscripten 1.25.0 installed and activated

Build script

git clone git://github.com/Rillke/opusenc.js.git opusenc.js
cd opusenc.js
git submodule update --init
./make.sh

Using

A pre-compiled script together with some auxiliary scripts making use from JavaScript easier is in the /worker directory. iframe.html is a minimal usage example. Test it live. It starts the encoding process posting command: 'encode' to the worker:

var worker = new Worker( 'worker/EmsWorkerProxy.js' );
// Files to be read and posted back
// after encoding completed
var outData = {
	// File name
	'encoded.opus': {
		// MIME type
		'MIME': 'audio/ogg'
	}
};

worker.onmessage = function( e ) {
	// Handle incoming data
};

// Prepare files etc.

// Post all data and the encode command
// to the web worker
worker.postMessage( {
	command: 'encode',
	args: args,
	outData: outData,
	fileData: storedFiles
} );
  • command: 'encode'|'prefetch' DOMString that either starts encoding or prefetching the 850 KiB worker script. Posting a prefetch command in advance is optional, depends on the user experience you'd like to create and does not require further arguments. If the script is not prefetched, it will be downloaded when 'encode' is invoked.
  • args: Array holding the command line arguments (DOMString)
  • outData: Object literal of information about the files that should be read out of the worker's file system after encoding completed
  • fileData: Object literal of input file data mapping file names to Uint8Arrays

A more extensive example is available on the project's website.

Contributing

Submit patches to this GitHub repository or file issues.

License

See LICENSE.md

opusenc.js's People

Contributors

rillke avatar

Watchers

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