{"_id":"transcoding","_rev":"7-0f02f999659d1a31692ca5936a5890a2","name":"transcoding","description":"Media transcoding and streaming support","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"transcoding","description":"Media transcoding and streaming support","version":"0.0.1","author":{"name":"Ben Vanik","email":"ben.vanik@gmail.com"},"contributors":[],"repository":{"type":"git","url":"git://github.com/benvanik/node-transcoding.git"},"keywords":["audio","video","media","transcode","transcoding","remux","streaming"],"directories":{"lib":"./lib/transcoding"},"main":"./lib/transcoding","bin":{"transcode":"./examples/transcode.js"},"dependencies":{"tav":"0.1.0"},"scripts":{"preinstall":"node-waf configure && node-waf build","preuninstall":"rm -rf build/*"},"engines":{"node":">= 0.6.x"},"devDependencies":{},"_npmUser":{"name":"benvanik","email":"ben.vanik@gmail.com"},"_id":"transcoding@0.0.1","_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.1","_defaultsLoaded":true,"dist":{"shasum":"6ca5818952da67e994cb1b8a00c8cda8d31d792a","tarball":"https://registry.npmjs.org/transcoding/-/transcoding-0.0.1.tgz","integrity":"sha512-0KFhwMgkQVeRa7meoMTjNPXWsFnbs8sIXkYUwNt3eNQzhnw3k3UrcSi+UG52AHH7x6qrudnzSwaREUEuulaDMQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFJsrH4xCqsD74PDEDdJIK/2yHEryXSH4jWdKyvvdO74AiBIABtHi1Ch2KuddyU3f0R0h29YHtU9rxhp9i1JIqH7kw=="}]},"maintainers":[{"name":"benvanik","email":"ben.vanik@gmail.com"}]}},"readme":"node-transcoding -- Media transcoding and streaming for node.js\n====================================\n\nnode-transcoding is a library for enabling both offline and real-time media\ntranscoding. In addition to enabling the manipulation of the input media,\nutilities are provided to ease serving of the output.\n\nCurrently supported features:\n\n* Nothing!\n\nComing soon (maybe):\n\n* Everything!\n\n## Quickstart\n\n    npm install transcoding\n    node\n    > var transcoding = require('transcoding');\n    > transcoding.process('input.flv', 'output.m4v',\n        transcoding.profiles.APPLE_TV_2, function(err, sourceInfo, targetInfo) {\n          console.log('completed!');\n        });\n\n## Installation\n\nWith [npm](http://npmjs.org):\n\n    npm install transcoding\n\nFrom source:\n\n    cd ~\n    git clone https://benvanik@github.com/benvanik/node-transcoding.git\n    npm link node-transcoding/\n\n### Dependencies\n\nnode-transcoding requires `ffmpeg` and its libraries `avformat` and `avcodec`.\nMake sure it's installed and on your path. It must be compiled with libx264 to\nsupport most output - note that some distributions don't include this and you\nmay have to compile it yourself. Annoying, I know.\n\n#### Source\n\n    ./configure \\\n        --enable-gpl --enable-nonfree --enable-pthreads \\\n        --enable-libfaac --enable-libfaad --enable-libmp3lame \\\n        --enable-libx264\n    sudo make install\n\n#### Mac OS X\n\nThe easiest way to get ffmpeg is via [MacPorts](http://macports.org).\nInstall it if needed and run the following from the command line:\n\n    sudo port install ffmpeg +gpl +lame +x264 +xvid\n\nYou may also need to add the MacPorts paths to your `~./profile`:\n\n    export C_INCLUDE_PATH=$C_INCLUDE_PATH:/opt/local/include/\n    export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/opt/local/include/\n    export LIBRARY_PATH=$LIBRARY_PATH:/opt/local/lib/\n\n#### FreeBSD\n\n    sudo pkg_add ffmpeg\n\n#### Linux\n\n    # HAHA YEAH RIGHT GOOD LUCK >_>\n    sudo apt-get install ffmpeg\n\n## API\n\n### Sources/targets\n\nAll APIs take a source and target. Today these must be file paths that can be\naccessed by normal filesystem APIs. In the future they can be node streams, or\nin the case of sources HTTP or any other protocol node can open.\n\n### Media Information\n\nWhenever 'info' is used, it refers to a MediaInfo object that looks something\nlike this:\n\n    {\n      container: 'flv',\n      duration: 126,         // seconds\n      start: 0,              // seconds\n      bitrate: 818000,       // bits/sec\n      streams: [\n        {\n          type: 'video',\n          codec: 'h264',\n          profile: 'Main',\n          profileId: 77,\n          profileLevel: 30,\n          resolution: { width: 640, height: 360 },\n          bitrate: 686000,\n          fps: 29.97\n        }, {\n          type: 'audio',\n          language: 'eng',\n          codec: 'aac',\n          sampleRate: 44100, // Hz\n          channels: 2,\n          bitrate: 131000\n        }\n      ]\n    }\n\nNote that many of these fields are optional, such as bitrate, language, profile\ninformation, and even fps/duration. Don't go using the values without checking\nfor undefined first.\n\n### Querying Media Information\n\nTo quickly query media information (duration, codecs used, etc) use the\n`queryInfo` API:\n\n    var transcoding = require('transcoding');\n    transcoding.queryInfo(source, function(err, info) {\n      // Completed\n    });\n\n### Transcoding Profiles\n\nTranscoding requires a ton of parameters to get the best results. It's a pain in\nthe ass. So what's exposed right now is a profile set that tries to set the\nbest options for you. Pick your profile and pass it into the transcoding APIs.\n\n    var transcoding = require('transcoding');\n    for (var profileName in transcoding.profiles) {\n      var profile = transcoding.profiles[profileName];\n      console.log(profileName + ':' + util.inspect(profile));\n    }\n\n### Simple Transcoding\n\nIf you are doing simple offline transcoding (no need for streaming, extra\noptions, progress updates, etc) then you can use the `process` API:\n\n    var transcoding = require('transcoding');\n    transcoding.process(source, target, transcoding.profiles.APPLE_TV_2, {}, function(err, sourceInfo, targetInfo) {\n      // Completed\n    });\n\nNote that this effectively just wraps the advanced API, without the need to\ntrack events.\n\n### Advanced Transcoding\n\n    var transcoding = require('transcoding');\n    var task = transcoding.createTask(source, target, transcoding.profiles.APPLE_TV_2);\n\n    task.on('begin', function(sourceInfo, targetInfo) {\n      // Transcoding beginning, info available\n      console.log('transcoding beginning...');\n      console.log('source:');\n      console.log(util.inspect(sourceInfo));\n      console.log('target:');\n      console.log(util.inspect(targetInfo));\n    });\n    task.on('progress', function(progress) {\n      // New progress made, currrently at timestamp out of duration\n      // progress = {\n      //   timestamp: 0,        // current seconds timestamp in the media\n      //   duration: 0,         // total seconds in the media\n      //   timeElapsed: 0,      // seconds elapsed so far\n      //   timeEstimated: 0,    // seconds estimated for total task\n      //   timeRemaining: 0,    // seconds remaining until done\n      //   timeMultiplier: 2    // multiples of real time the transcoding is\n      //                        // occuring in (2 = 2x media time)\n      // }\n      console.log(util.inspect(progress));\n      console.log('progress ' + (progress.timestamp / progress.duration) + '%');\n    });\n    task.on('error', function(err) {\n      // Error occurred, transcoding ending\n      console.log('error: ' + err);\n    });\n    task.on('end', function() {\n      // Transcoding has completed\n      console.log('finished');\n    });\n\n    // Start transcoding\n    task.start();\n\n    // At any time, abort transcoding\n    task.stop();\n\n### HTTP Live Streaming\n\nIf you are targetting devices that support HTTP Live Streaming (like iOS), you\ncan have the transcoder build the output in realtime as it processes. This\nenables playback while the transcoding is occuring, as well as some other fancy\nthings such as client-side stream switching (changing audio channels/etc).\n\n    // TODO: API for this... something like:\n    // (where target is used as a base filename for all the extra stuff)\n    var task = transcoding.createTask(source, target, profile, {\n      streaming: {\n        segmentDuration: 10,\n        allowCaching: true\n      }\n    });\n","maintainers":[{"name":"benvanik","email":"ben.vanik@gmail.com"}],"time":{"modified":"2022-06-27T20:07:20.640Z","created":"2011-11-23T07:55:39.181Z","0.0.1":"2011-11-23T07:55:40.740Z"},"author":{"name":"Ben Vanik","email":"ben.vanik@gmail.com"},"repository":{"type":"git","url":"git://github.com/benvanik/node-transcoding.git"},"users":{"rchk":true,"helloncanella":true}}