{"_id":"stream-transcoder","_rev":"28-e214ff1f1a57576b27211b9281a63c1e","name":"stream-transcoder","description":"FFmpeg based media transcoder that supports streams.","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.1":{"name":"stream-transcoder","version":"0.0.1","author":{"name":"Kristian Trenskow","email":"trenskow@me.com"},"description":"FFmpeg based media transcoder that supports streams.","main":"index.js","keywords":["ffmpeg","stream","transcoding","media","video"],"license":"BSD 2-Clause license","engines":{"node":">=0.10.15"},"repository":{"type":"git","url":"https://github.com/trenskow/stream-transcoder.js.git"},"bugs":{"url":"https://github.com/trenskow/stream-transcoder.js/issues"},"_id":"stream-transcoder@0.0.1","dist":{"shasum":"007882c9f4f3ff1994ae258b3f85fc4e771b3976","tarball":"https://registry.npmjs.org/stream-transcoder/-/stream-transcoder-0.0.1.tgz","integrity":"sha512-1h5KfAvZCqPpSOr8GHu9Iwzs//e3IKhsR/KXtdUMHo/gyjf/YlQKXXMH8yJuO3JzTBU91z5oRssEorNj/6xdag==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDe7Ljq5G4TeIy4DBQQFXLZF1cshi8RSw0d7B5JnTj/1AiAx4vcRpNvaCnoZZdyxjS733xZPv9yJS+QzNr741eYhEg=="}]},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"trenskow","email":"trenskow@me.com"},"maintainers":[{"name":"trenskow","email":"trenskow@me.com"}],"directories":{}},"0.0.3":{"name":"stream-transcoder","version":"0.0.3","author":{"name":"Kristian Trenskow","email":"trenskow@me.com"},"description":"FFmpeg based media transcoder that supports streams.","main":"index.js","keywords":["ffmpeg","stream","transcoding","media","video"],"license":"BSD 2-Clause license","engines":{"node":">=0.10.15"},"repository":{"type":"git","url":"https://github.com/trenskow/stream-transcoder.js.git"},"bugs":{"url":"https://github.com/trenskow/stream-transcoder.js/issues"},"homepage":"https://github.com/trenskow/stream-transcoder.js","_id":"stream-transcoder@0.0.3","dist":{"shasum":"b13ccf503a8a73fab59473da926ac5b1969cf066","tarball":"https://registry.npmjs.org/stream-transcoder/-/stream-transcoder-0.0.3.tgz","integrity":"sha512-uFmBx+zVkar/19t91n/A/PLD2u3k6B6w+0Kn07BosizAStdM6EzWE/dg9ebcQq9y8C00dFXUTf1iAiTLMuMPpA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC2GOQK++ex9iIs63XZeON8+H8BXVxTyVP+vvnZDGKISAIgQPKIVGClPnXJyj+blfRX5WQ+blFseoEzzsgZAU68Yek="}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"trenskow","email":"trenskow@me.com"},"maintainers":[{"name":"trenskow","email":"trenskow@me.com"}],"directories":{}},"0.0.4":{"name":"stream-transcoder","version":"0.0.4","author":{"name":"Kristian Trenskow","email":"trenskow@me.com"},"description":"FFmpeg based media transcoder that supports streams.","main":"index.js","keywords":["ffmpeg","stream","transcoding","media","video"],"license":"BSD 2-Clause license","engines":{"node":">=0.10.15"},"repository":{"type":"git","url":"https://github.com/trenskow/stream-transcoder.js.git"},"bugs":{"url":"https://github.com/trenskow/stream-transcoder.js/issues"},"homepage":"https://github.com/trenskow/stream-transcoder.js","_id":"stream-transcoder@0.0.4","_shasum":"8b5e43d721be4a3461605283eea006172d273685","_from":".","_npmVersion":"1.4.10","_npmUser":{"name":"trenskow","email":"trenskow@me.com"},"maintainers":[{"name":"trenskow","email":"trenskow@me.com"}],"dist":{"shasum":"8b5e43d721be4a3461605283eea006172d273685","tarball":"https://registry.npmjs.org/stream-transcoder/-/stream-transcoder-0.0.4.tgz","integrity":"sha512-CKSrtzeBzy6uQQhlNdbErJ10Rtuhrq9W0W/H9nHgELvf1f0vZ2U2lxIV+eN7k4Ux6OmdNZGhY0EwgZWcGoLTuA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCbIvvqp4JTNIpy9hwdbWCrYh6ja6YRwP7yyOwXHbsPPwIgBYnZBeJN/AhV4M3WAI8KtNCtB/mS514pgf6dxcE0Zas="}]},"directories":{}},"0.0.5":{"name":"stream-transcoder","version":"0.0.5","author":{"name":"Kristian Trenskow","email":"trenskow@me.com"},"description":"FFmpeg based media transcoder that supports streams.","main":"index.js","keywords":["ffmpeg","stream","transcoding","media","video"],"license":"BSD 2-Clause license","engines":{"node":">=0.10.15"},"repository":{"type":"git","url":"https://github.com/trenskow/stream-transcoder.js.git"},"gitHead":"8f321e2a936fbf6b73dea1d3be15feb3168369b0","bugs":{"url":"https://github.com/trenskow/stream-transcoder.js/issues"},"homepage":"https://github.com/trenskow/stream-transcoder.js","_id":"stream-transcoder@0.0.5","scripts":{},"_shasum":"68261be4efb48840239b5791af23ee3b8bd79808","_from":".","_npmVersion":"2.0.0-alpha-5","_npmUser":{"name":"trenskow","email":"trenskow@me.com"},"maintainers":[{"name":"trenskow","email":"trenskow@me.com"}],"dist":{"shasum":"68261be4efb48840239b5791af23ee3b8bd79808","tarball":"https://registry.npmjs.org/stream-transcoder/-/stream-transcoder-0.0.5.tgz","integrity":"sha512-mPthCybIYrahVWlszOcDfCHn3TAiVvUzyZwGLAEgGE6J28HmjM6+gPwC2cu2M6uwaGojvs6xgGvrqJACHXvaLw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDDmjKnqEcc5J7KdzcEjyDtJ4DcIGtlvqFWJh+pcBI4WgIhANbkpn8x6K7PWcXObyIZPuyAs3/sm9/HN8RqJ13Czafp"}]},"directories":{}}},"readme":"#stream-transcoder.js\n**FFmpeg based media transcoder that supports streams.**\n\n##Introduction\nFlexible media transcoding using FFmpeg. Stream media in and out - converting it on the fly.\n\nI created this, because the current FFmpeg transcoders for node.js did not properly support streams as I needed.\n\nAlong with the [stream-body-parser.js](https://github.com/trenskow/stream-body-parser.js), this makes a great companion for doing stuff like this.\n\n    var express = require('express'),\n        StreamBodyParser = require('stream-body-parser'),\n        Transcoder = require('stream-transcoder');\n    \n    var app = express();\n    \n    var bodyParser = new StreamBodyParser(app);\n    \n    bodyParser.process('video/*', function(stream, req, next) {\n    \t\n    \tvar myGridFSWriteStream = (Some MongoDB GridFS stream)\n    \t\n    \tnew Transcoder(stream)\n    \t    .maxSize(320, 240)\n    \t    .videoCodec('h264')\n    \t    .videoBitrate(800 * 1000)\n    \t    .fps(25)\n    \t    .audioCodec('libfaac')\n    \t    .sampleRate(44100)\n    \t    .channels(2)\n    \t    .audioBitrate(128 * 1000)\n    \t    .format('mp4')\n    \t    .on('finish', function() {\n    \t    \tnext();\n    \t    })\n    \t    .stream().pipe(myGridFSWriteStream);\n    \t\n    });\n    \n    app.post('/', function(req, res) {\n    \tres.send(200); // File uploaded\n    });\n    \n    app.listen(3000);\n    \nIn the above example the video is transcoded as it is being uploaded, and then piped directly into the database. So when the route is being called, the video is transcoded and stored.\n\n## Installing FFmpeg\nFFmpeg is not installed with this package. So before usage, install FFmpeg using your favorite package manager or download it at [ffmpeg.org](http://ffmpeg.org/).\n\n### Configure FFmpeg binary path\n\nSet the `FFMPEG_BIN_PATH` env var. (`ffmpeg` by default)\n\n## Class: Transcoder\n`Transcoder` is an EventEmitter.\n\nThis class transcodes from one media format to another. It supports both files and streams as input and/or output. Some formats are not suited for streaming, in which case the `Transcoder` will emit an `error`, but most formats are.\n\n### new Transcoder(stream)\n\n  * `stream` Object - A readable stream.\n  \nPrepares a new Transcoder with a stream as its input.\n\n### new Transcoder(file)\n\n  * `file` String - The path of the file to be transcoded.\n\nPrepares a new Transcoder with a file as its input.\n\n### Event: 'metadata'\n\n  * `metadata` Object - Metadata of input and output streams.\n\nEmitted when metadata is available for both input and output streams. If no output is specified (by using `transcoder.exec()`), only input streams will be described.\n\nThis an example of a transcoding process metadata.\n\n    {\n        \"input\": {\n            \"streams\": [\n                {\n                    \"type\": \"video\",\n                    \"codec\": \"h264\",\n                    \"bitrate\": 10131000,\n                    \"fps\": 25,\n                    \"size\": {\n                        \"width\": 1280,\n                        \"height\": 720\n                    },\n                    \"aspect\": 1.7777777777777777,\n                    \"colors\": \"yuv420p\"\n                },\n                {\n                    \"type\": \"audio\",\n                    \"codec\": \"aac\",\n                    \"samplerate\": 44100,\n                    \"channels\": 2,\n                    \"bitrate\": 106000\n                }\n            ],\n            \"duration\": 250068,\n            \"synched\": true\n        },\n        \"output\": {\n            \"streams\": [\n                {\n                    \"type\": \"video\",\n                    \"codec\": \"h264\",\n                    \"bitrate\": 800000,\n                    \"size\": {\n                        \"width\": 320,\n                        \"height\": 180\n                    },\n                    \"aspect\": 1.7777777777777777,\n                    \"colors\": \"yuv420p\"\n                },\n                {\n                    \"type\": \"audio\",\n                    \"codec\": \"aac\",\n                    \"samplerate\": 44100,\n                    \"channels\": 2,\n                    \"bitrate\": 128000\n                }\n            ]\n        }\n    }\n\n### Event: 'progress'\n\n  * `progress` Object - Object describing current progress.\n\nEmitted when progress has been made in the transcoding.\n\nThis is an example of the `progress` object. Where `progress.progress` is a percentage of the total transcoding job.\n\n    {\n        \"frame\": 508,\n        \"fps\": 253,\n        \"quality\": 16,\n        \"size\": 1553408,\n        \"time\": 20041,\n        \"bitrate\": 608000,\n        \"progress\": 0.08014220132124063\n    }\n\n### Event: 'finish'\n\nEmitted when transcoding is complete.\n\n### Event: 'error'\n\n  * `error` Error - The error that occured.\n\nEmitted when FFmpeg exits with an error.\n\n### transcoder.videoCodec(codec)\n\n  * `codec` String - Name of the video codec. As an example `h264`.\n\nSets the video codec.\n\nReturns transcoder object.\n\n*Notice:* Supported video codecs depends on your FFmpeg installation. Running `ffmpeg -codecs` from your terminal will list the supported codecs.\n\n### transcoder.videoBitrate(bitrate)\n\n  * `bitrate` Number or String - The bitrate of the encoded video. Both `1280000` or `128 kbit` can be passed.\n\nSets the video bitrate.\n\nReturns transcoder object.\n\n### transcoder.fps(fps)\n\n  * `fps` Number - Frames per second.\n\nSets the number of frames per second.\n\nReturns transcoder object.\n\n### transcoder.format(format)\n\n  * `format` String - Output format.\n\nSets the output format.\n\nReturns transcoder object.\n\n*Notice:* Supported formats also depends on you FFmpeg installation. Running `ffmpeg -formats` from your terminal will list the supported formats.\n\n### transcoder.maxSize(width, height)\n\n  * `width` Number - Maximum width of video.\n  * `height` Number - Miximum height of video.\n\nSets the output video size, shrinking to fit the size to maintain aspect ratio. The output video will be within the defined size, but with aspect ratio is preserved.\n\nReturns transcoder object.\n\n### transcoder.minSize(width, height)\n\n  * `width` Number - Minimum width of video.\n  * `height` Number - Minimum height of video.\n\nSets the output video size, scaling it to have a minimum of both directions, while maintaining aspect ratio.\n\n### transcoder.size(width, height)\n\n  * `width` Number - Minimum width of video.\n  * `height` Number - Minimum height of video.\n\nSets the output video size, not maintaining aspect ratio if it doesn't fit.\n\nReturns transcoder object.\n\n### transcoder.passes(passes)\n\n   * `passes` Number - The number of encoder passes.\n\nSets the number of encoder passes.\n\nReturns transcoder object.\n\n### transcoder.aspectRatio(ratio)\n\n   * `ratio` Number - The desired aspect ratio. As an example `1.7777777`.\n\nSets the video aspect ratio.\n\nReturns transcoder object.\n\n### transcoder.audioCodec(codec)\n\n  * `codec` String - Name of the audio codec. As an example `mp3` or `aac`.\n\nSets the audio codec.\n\nReturns transcoder object.\n\n*Notice:* Supported audio codecs depends on your FFmpeg installation. Running `ffmpeg -codecs` from your terminal will list the supported codecs.\n\n### transcoder.sampleRate(rate)\n\n  * `rate` Number - Audio sample rate. As an example `44100`.\n\nSets the audio sample rate.\n\nReturns transcoder object.\n\n### transcoder.channels(channels)\n\n  * `channels` Number - Number of audio channels.\n\nSets the number of audio channels.\n\nReturns transcoder object.\n\n### transcoder.audioBitrate(bitrate)\n\n  * `bitrate` Number - The audio bitrate.\n\nSets the audio bitrate.\n\nReturns transcoder object.\n\n### transcoder.captureFrame(time)\n\n  * `time` Number - Time of frame in milliseconds.\n\nCapture a single frame at `time`. Sets up transcoder to jpeg output.\n\nReturns transcoder object.\n\n### transcoder.stream()\n\nReturns a writeable stream that will emit the transcoded media data.\n\n### transcoder.writeToFile(file)\n\n   * `file` String - Path of filename.\n\nWrites transcoded media data to `file`.\n\nReturns transcoder object.\n\n### transcoder.exec()\n\nExecutes the transcoder without outputting any data. This is useful if you only need metadata for a media file.\n\nReturns child process.\n\n### transcoder.custom(key, value)\n\n   * `key` String - The key for the parameter\n   * `value` String [optional] - The value for the parameter.\n\nAdds a custom parameter to the FFmpeg command line - this is for all your special needs that is currently not implemented as a function in the Transcoder.\n\nAs an example:\n\n    .custom('ss', '00:30:00')\n    \nTranslates to on the FFmpeg command line:\n\n    ffmpeg -ss 00:30:00\n\n\n","maintainers":[{"name":"trenskow","email":"trenskow@me.com"}],"time":{"modified":"2022-06-27T00:51:06.063Z","created":"2013-08-10T18:07:55.544Z","0.0.1":"2013-08-10T18:08:09.978Z","0.0.3":"2013-12-10T13:00:45.387Z","0.0.4":"2014-07-25T11:40:22.662Z","0.0.5":"2014-08-10T19:11:07.010Z"},"author":{"name":"Kristian Trenskow","email":"trenskow@me.com"},"repository":{"type":"git","url":"https://github.com/trenskow/stream-transcoder.js.git"},"homepage":"https://github.com/trenskow/stream-transcoder.js","keywords":["ffmpeg","stream","transcoding","media","video"],"bugs":{"url":"https://github.com/trenskow/stream-transcoder.js/issues"},"license":"BSD 2-Clause license","readmeFilename":"README.md","users":{"sapjax":true,"santihbc":true,"brandonpapworth":true,"helloncanella":true,"kaperstone":true,"pizzaspam":true,"bitsonic":true,"mortgy":true,"quocnguyen":true,"imoil":true,"simon129":true,"eterna2":true,"tagkiller":true}}