{"id":20513317,"url":"https://github.com/androzdev/mediaplex","last_synced_at":"2026-03-14T07:34:37.527Z","repository":{"id":181430476,"uuid":"666701665","full_name":"androzdev/mediaplex","owner":"androzdev","description":"Media utilities for node 🦀 🎶 ","archived":false,"fork":false,"pushed_at":"2024-12-05T18:07:15.000Z","size":7772,"stargazers_count":14,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-13T05:42:56.024Z","etag":null,"topics":["audio","ffmpeg","hacktoberfest","libopus","media","node","rust"],"latest_commit_sha":null,"homepage":"https://npm.im/mediaplex","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/androzdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-15T09:37:38.000Z","updated_at":"2025-06-05T15:19:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"5de316a8-1206-4be4-93a1-42c9118df775","html_url":"https://github.com/androzdev/mediaplex","commit_stats":{"total_commits":68,"total_committers":2,"mean_commits":34.0,"dds":"0.17647058823529416","last_synced_commit":"f76c42010ae59edfc02899a8488fcb61b53aa35e"},"previous_names":["androzdev/mediaplex"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/androzdev/mediaplex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androzdev%2Fmediaplex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androzdev%2Fmediaplex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androzdev%2Fmediaplex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androzdev%2Fmediaplex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/androzdev","download_url":"https://codeload.github.com/androzdev/mediaplex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androzdev%2Fmediaplex/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261605008,"owners_count":23183742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","ffmpeg","hacktoberfest","libopus","media","node","rust"],"created_at":"2024-11-15T21:09:59.826Z","updated_at":"2026-03-14T07:34:37.471Z","avatar_url":"https://github.com/androzdev.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `mediaplex`\n\n![https://github.com/napi-rs/tar/actions](https://github.com/napi-rs/tar/workflows/CI/badge.svg)\n[![install size](https://packagephobia.com/badge?p=mediaplex)](https://packagephobia.com/result?p=mediaplex)\n[![Downloads](https://img.shields.io/npm/dm/mediaplex.svg?sanitize=true)](https://npmcharts.com/compare/mediaplex?minimal=true)\n\nMedia processing library for Node.js\n\n## Install this package\n\n```\nyarn add mediaplex\npnpm add mediaplex\nbun add mediaplex\nnpm install mediaplex\n```\n\n# Examples\n\n## Probe metadata\n\nYou can use Mediaplex to probe media files for metadata. Here's an example:\n\n```js\nconst mediaplex = require('mediaplex');\n\nconst stream = createReadStream('./media.mp3');\nconst { result } = await mediaplex.probeStream(stream);\n\nconsole.log(result);\n\n/* Sample Output */\n{\n    channels: 2,\n    sampleRate: 44100,\n    framesPerBlock: 0,\n    codec: 4099, // use `CodecType` enum to validate this\n    nFrames: 796032,\n    duration: 18, // seconds\n    metadata: [\n        { name: 'TXXX:major_brand', value: 'mp42' },\n        { name: 'TXXX:minor_version', value: '0' },\n        { name: 'TXXX:compatible_brands', value: 'isommp42' },\n        { name: 'TSSE', value: 'Lavf59.6.100' },\n        { name: 'TIT2', value: \"...\" },\n        { name: 'TPE1', value: '...' },\n        { name: 'TALB', value: '...' },\n        { name: 'TCON', value: '...' },\n        { name: 'TPUB', value: '...' }\n    ]\n}\n```\n\nThis will output an object containing information about the media file, including the number of channels, sample rate, codec, duration, and metadata.\nThe default probe size is `2MB`, but you can adjust this as needed by passing the second argument to `probeStream`:\n\n```js\n// probe only 1024 bytes\nconst { result } = await mediaplex.probeStream(stream, 1024);\n\n// probe 5 MB\nconst { result } = await mediaplex.probeStream(stream, 5 * 1024 * 1024);\n```\n\n## Opus Encoder\n\nMediaplex also includes an Opus encoder/decoder, which can be used as a drop-in replacement for [`@discordjs/opus`](https://github.com/discordjs/opus). Here's an example on how to use it:\n\n```js\nconst { OpusEncoder, getOpusVersion } = require(\"mediaplex\");\n\nconsole.log(getOpusVersion()); // libopus xxx\n\nconst encoder = new OpusEncoder(48000, 2);\n\nconst encoded = encoder.encode(buffer);\nconst decoded = encoder.decode(encoded);\n```\n\nYou can use `OpusEncoder` to encode pcm data to opus and decode opus data to pcm format. Stream interface is provided by [@discord-player/opus](https://npm.im/@discord-player/opus) package.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrozdev%2Fmediaplex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrozdev%2Fmediaplex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrozdev%2Fmediaplex/lists"}