{"id":18867677,"url":"https://github.com/devowlio/node-fdkaac","last_synced_at":"2025-04-14T14:31:36.862Z","repository":{"id":47636986,"uuid":"84951027","full_name":"devowlio/node-fdkaac","owner":"devowlio","description":"Fraunhofer FDK AAC is a high-quality open-source AAC encoder. For all AAC and M4A encoding needs a Node.js wrapper of the full fdkaac command line frontend (by nu774) based on libfdk-aac encoder.","archived":false,"fork":false,"pushed_at":"2024-06-18T16:41:41.000Z","size":2439,"stargazers_count":12,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T22:51:30.512Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devowlio.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":"2017-03-14T13:16:46.000Z","updated_at":"2025-02-14T23:15:00.000Z","dependencies_parsed_at":"2024-06-21T16:35:32.923Z","dependency_job_id":"b8184687-cf68-4ece-b704-3e86ac36b1e6","html_url":"https://github.com/devowlio/node-fdkaac","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devowlio%2Fnode-fdkaac","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devowlio%2Fnode-fdkaac/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devowlio%2Fnode-fdkaac/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devowlio%2Fnode-fdkaac/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devowlio","download_url":"https://codeload.github.com/devowlio/node-fdkaac/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248329731,"owners_count":21085593,"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":[],"created_at":"2024-11-08T05:10:40.459Z","updated_at":"2025-04-14T14:31:36.259Z","avatar_url":"https://github.com/devowlio.png","language":"TypeScript","readme":"# node-fdkaac\n\n\u003cimg align=\"right\" src=\"https://assets.devowl.io/git/node-fdkaac/logo.png\" alt=\"node-fdkaac logo\" height=\"180\" /\u003e\n\nFraunhofer FDK AAC is a high-quality open-source AAC encoder. For all AAC and M4A encoding needs, a Node.js wrapper of the full [fdkaac](https://github.com/nu774/fdkaac) command line frontend (by [nu774](https://github.com/nu774)) based on [libfdk-aac](https://github.com/mstorsjo/fdk-aac) encoder.\n\nThe encoder reads linear PCM audio in either WAV, raw PCM or CAF format and encodes it into an M4A or an AAC file.\n\n## Requirements\n\n-   Linux or MacOS (Windows is NOT support by this package)\n-   libfdk-aac, fdkaac and ffmpeg installed (instructions see below)\n-   node 12.20.\\* or newer\n\n## Installation\n\nYou can install it with `npm`:\n\n```bash\n$ npm install --save node-fdkaac\n```\n\nIf you have not installed [libfdk-aac](https://github.com/mstorsjo/fdk-aac), [fdkaac](https://github.com/nu774/fdkaac) and [ffmpeg](https://www.ffmpeg.org/) yet, you find a bash script to compile the source code as `install.sh` in this package.\n\n_install.sh requirements:_\n\n-   automake\n-   libtool\n-   git\n\n### Run on Debian\n\n```bash\n$ sudo apt-get install automake libtool git ffmpeg\n$ chmod +x install.sh\n$ sudo ./install.sh\n```\n\n### Run on MacOS with brew\n\n```bash\n$ brew install automake libtool git ffmpeg\n$ chmod +x install.sh\n$ sudo ./install.sh\n```\n\n## Example\n\n### Encode from file to file\n\n```node\nconst Fdkaac = require(\"node-fdkaac\").Fdkaac;\n\nconst encoder = new Fdkaac({\n    output: \"./audio-files/demo.m4a\",\n    bitrate: 192,\n}).setFile(\"./audio-files/demo.wav\");\n\nencoder\n    .encode()\n    .then(() =\u003e {\n        // Encoding finished\n    })\n    .catch((error) =\u003e {\n        // Something went wrong\n    });\n```\n\n### Encode from file to buffer\n\n```node\nconst Fdkaac = require(\"node-fdkaac\").Fdkaac;\n\nconst encoder = new Fdkaac({\n    output: \"buffer\",\n    bitrate: 192,\n}).setFile(\"./audio-files/demo.wav\");\n\nencoder\n    .encode()\n    .then(() =\u003e {\n        // Encoding finished\n        const buffer = encoder.getBuffer();\n    })\n    .catch((error) =\u003e {\n        // Something went wrong\n    });\n```\n\n### Encode from buffer to file\n\n```node\n[...]\n\nconst Fdkaac = require(\"node-fdkaac\").Fdkaac;\n\nconst encoder = new Fdkaac({\n    \"output\": \"./audio-files/demo.m4a\",\n    \"bitrate\": 192\n}).setBuffer(audioFileBuffer);\n\nencoder.encode()\n    .then(() =\u003e {\n        // Encoding finished\n    })\n    .catch((error) =\u003e {\n        // Something went wrong\n    });\n```\n\n### Encode from buffer to buffer\n\n```node\n[...]\n\nconst Fdkaac = require(\"node-fdkaac\").Fdkaac;\n\nconst encoder = new Fdkaac({\n    \"output\": \"buffer\",\n    \"bitrate\": 192\n}).setBuffer(audioFileBuffer);\n\nencoder.encode()\n    .then(() =\u003e {\n        // Encoding finished\n        const buffer = encoder.getBuffer();\n    })\n    .catch((error) =\u003e {\n        // Something went wrong\n    });\n```\n\n### Get status of encoder as object\n\n```node\nconst Fdkaac = require(\"node-fdkaac\").Fdkaac;\n\nconst encoder = new Fdkaac({\n    output: \"buffer\",\n    bitrate: 192,\n}).setFile(\"./audio-files/demo.wav\");\n\nencoder\n    .encode()\n    .then(() =\u003e {\n        // Encoding finished\n    })\n    .catch((error) =\u003e {\n        // Something went wrong\n    });\n\nconst status = encoder.getStatus();\n```\n\n### Get status of encoder as EventEmitter\n\n```node\nconst Fdkaac = require(\"node-fdkaac\").Fdkaac;\n\nconst encoder = new Fdkaac({\n    output: \"buffer\",\n    bitrate: 192,\n}).setFile(\"./audio-files/demo.wav\");\n\nconst emitter = encoder.getEmitter();\n\nemitter.on(\"progress\", ([progress, eta]) =\u003e {\n    // On progress of encoding; in percent and estimated time of arrival as 00:00\n});\n\nemitter.on(\"finish\", () =\u003e {\n    // On finish\n});\n\nemitter.on(\"error\", (error) =\u003e {\n    // On error\n});\n\nencoder\n    .encode()\n    .then(() =\u003e {\n        // Encoding finished\n    })\n    .catch((error) =\u003e {\n        // Something went wrong\n    });\n```\n\n### Decode from file to file\n\n```node\nconst Fdkaac = require(\"node-fdkaac\").Fdkaac;\n\nconst decoder = new Fdkaac({\n    output: \"./audio-files/demo.wav\",\n}).setFile(\"./audio-files/demo.m4a\");\n\ndecoder\n    .decode()\n    .then(() =\u003e {\n        // Decoding finished\n    })\n    .catch((error) =\u003e {\n        // Something went wrong\n    });\n```\n\n### Decode from file to buffer\n\n```node\nconst Fdkaac = require(\"node-fdkaac\").Fdkaac;\n\nconst decoder = new Lame({\n    output: \"buffer\",\n}).setFile(\"./audio-files/demo.m4a\");\n\ndecoder\n    .decode()\n    .then(() =\u003e {\n        // Decoding finished\n        const buffer = decoder.getBuffer();\n    })\n    .catch((error) =\u003e {\n        // Something went wrong\n    });\n```\n\n### Decode from buffer to file\n\n```node\n[...]\n\nconst Fdkaac = require(\"node-fdkaac\").Fdkaac;\n\nconst decoder = new Lame({\n    \"output\": \"./audio-files/demo.wav\"\n}).setBuffer(m4aInputBuffer);\n\ndecoder.decode()\n    .then(() =\u003e {\n        // Decoding finished\n    })\n    .catch((error) =\u003e {\n        // Something went wrong\n    });\n```\n\n### Decode from buffer to buffer\n\n```node\n[...]\n\nconst Fdkaac = require(\"node-fdkaac\").Fdkaac;\n\nconst decoder = new Lame({\n    \"output\": \"buffer\"\n}).setBuffer(mp4aInputBuffer);\n\ndecoder.decode()\n    .then(() =\u003e {\n        // Decoding finished\n        const buffer = decoder.getBuffer();\n    })\n    .catch((error) =\u003e {\n        // Something went wrong\n    });\n```\n\n## All options\n\n| Option            | Description                                                                                                                                                         | Values                                                                                                                      | Default     |\n| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ----------- |\n| output            | Output filename                                                                                                                                                     | Path                                                                                                                        |\n| profile           | Target profile (MPEG4 audio object type, AOT)                                                                                                                       | `2` (MPEG-4 AAC LC), `5` (MPEG-4 HE-AAC; SBR), `23` (MPEG-4 AAC LD), `29` (MPEG-4 HE-AAC v2; SBR+PS), `39` (MPEG-4 AAC ELD) | `2`         |\n| bitrate           | Target bitrate (for CBR)                                                                                                                                            | Number                                                                                                                      | `undefined` |\n| bitrate-mode      | Bitrate configuration mode. Available VBR quality value depends on other parameters such as profile, sample rate, or number of channels.                            | `0` (CBR), `1`-`5` (VBR; higher value =\u003e higher bitrate)                                                                    | `0`         |\n| bandwidth         | Frequency bandwidth (lowpass cut-off frequency) in Hz. Available on AAC LC only.                                                                                    | Number                                                                                                                      | `undefined` |\n| afterburner       | Configure afterburner mode. When enabled, quality is increased at the expense of additional computational workload.                                                 | `0` (Off), `1` (On)                                                                                                         | `1`         |\n| lowdelay-sbr      | Configure SBR activity on AAC ELD.                                                                                                                                  | `-1` (Use ELD SBR auto configuration, `0` (Disable SBR on ELD), `1` (Enable SBR on ELD)                                     | `0`         |\n| sbr-ratio         | Controls activation of downsampled SBR.                                                                                                                             | `0` (Use lib default), `1` (Use downsampled SBR; default for ELD+SBR), `2` (Use dual-rate SBR; default for HE-AAC)          | `0`         |\n| transport-format  | Transport format. Tagging and gapless playback is only available on M4A.                                                                                            | `0` (M4A), `1` (ADIF), `2` (ADTS), `6` (LATM MCP=1), `7` (LATM MCP=0), `10` (LOAS/LATM; LATM within LOAS)                   | `0`         |\n| adts-crc-check    | Add CRC protection on ADTS header.                                                                                                                                  | Boolean                                                                                                                     | `false`     |\n| header-period     | StreamMuxConfig/PCE repetition period in the transport layer.                                                                                                       | Number                                                                                                                      | `undefined` |\n| gapless-mode      | Method to declare amount of encoder delay (and padding) in M4A container. These values are mandatory for proper gapless playback on player side.                    | `0` (iTunSMPB), `1` (ISO standard; edts and sgpd), `2` (Both)                                                               | `0`         |\n| include-sbr-delay | When specified, count SBR decoder delay in encoder delay.                                                                                                           | Boolean                                                                                                                     | `false`     |\n| ignorelength      | Ignore length field of data chunk in input WAV file.                                                                                                                | Boolean                                                                                                                     | `false`     |\n| moov-before-mdat  | Place moov box before mdat box in M4A container. This option might be important for some hardware players, that are known to refuse moov box placed after mdat box. | Boolean                                                                                                                     | `false`     |\n| raw               | Regard input as raw PCM.                                                                                                                                            | Boolean                                                                                                                     | `false`     |\n| raw-channels      | Specify number of channels of raw input                                                                                                                             | Number                                                                                                                      | `2`         |\n| raw-rate          | Specify sample rate of raw input.                                                                                                                                   | Number                                                                                                                      | `44100`     |\n| raw-format        | Specify sample format of raw input (details see [nu774/fdkaac](https://github.com/nu774/fdkaac/blob/master/README)).                                                | String                                                                                                                      | `S16L`      |\n| meta              | Meta data for M4A container.                                                                                                                                        | Object                                                                                                                      | `undefined` |\n\n_Meta options_\n\n| Option       | Description                                                                                                                                                        | Values            | Default     |\n| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------- | ----------- |\n| title        | Set title tag.                                                                                                                                                     | String            | `undefined` |\n| artist       | Set artist tag.                                                                                                                                                    | String            | `undefined` |\n| album        | Set album tag.                                                                                                                                                     | String            | `undefined` |\n| genre        | Set genre tag.                                                                                                                                                     | String            | `undefined` |\n| date         | Set date tag.                                                                                                                                                      | String            | `undefined` |\n| composer     | Set composer tag.                                                                                                                                                  | String            | `undefined` |\n| grouping     | Set grouping tag.                                                                                                                                                  | String            | `undefined` |\n| comment      | Set comment tag.                                                                                                                                                   | String            | `undefined` |\n| album-artist | Set album artist tag.                                                                                                                                              | String            | `undefined` |\n| track        | Set track tag, with or without number of total tracks.                                                                                                             | Number[/Total]    | `undefined` |\n| disk         | Set disk tag, with or without number of total discs.                                                                                                               | Number[/Total]    | `undefined` |\n| tempo        | Set tempo (BPM) tag.                                                                                                                                               | Number            | `undefined` |\n| tag          | Set iTunes predefined tag with explicit fourcc key and value. See [iTunesMetadata](https://code.google.com/p/mp4v2/wiki/iTunesMetadata) for known predefined keys. | \\\u003cfcc\\\u003e:\\\u003cvalue\\\u003e | `undefined` |\n| long-tag     | Set arbitrary tag as iTunes custom metadata. Stored in com.apple.iTunes field.                                                                                     | \\\u003cfcc\\\u003e:\\\u003cvalue\\\u003e | `undefined` |\n\nOption description text from [fdkaac](https://github.com/nu774/fdkaac) by [nu774](https://github.com/nu774). Based on fdkaac commit [4682fe4](https://github.com/nu774/fdkaac/tree/4682fe4961b92d3872e47d9fd4d9256151d292e7) from Jan 16, 2017.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevowlio%2Fnode-fdkaac","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevowlio%2Fnode-fdkaac","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevowlio%2Fnode-fdkaac/lists"}