{"id":19316998,"url":"https://github.com/henkelmax/opus4j","last_synced_at":"2025-04-22T17:30:34.915Z","repository":{"id":44913936,"uuid":"348111020","full_name":"henkelmax/opus4j","owner":"henkelmax","description":"A Java wrapper for the Opus Codec.","archived":false,"fork":false,"pushed_at":"2024-08-16T08:31:56.000Z","size":5449,"stargazers_count":10,"open_issues_count":0,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T02:03:42.162Z","etag":null,"topics":["codec","java","jna","opus"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/henkelmax.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-03-15T20:19:26.000Z","updated_at":"2025-03-30T02:08:44.000Z","dependencies_parsed_at":"2024-08-17T03:31:16.097Z","dependency_job_id":null,"html_url":"https://github.com/henkelmax/opus4j","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henkelmax%2Fopus4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henkelmax%2Fopus4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henkelmax%2Fopus4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henkelmax%2Fopus4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/henkelmax","download_url":"https://codeload.github.com/henkelmax/opus4j/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250287365,"owners_count":21405597,"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":["codec","java","jna","opus"],"created_at":"2024-11-10T01:13:22.126Z","updated_at":"2025-04-22T17:30:33.847Z","avatar_url":"https://github.com/henkelmax.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Opus4J\n\nA Java wrapper for the [Opus Codec](https://opus-codec.org/) written in Rust using JNI.\n\n## Usage\n\n**Maven**\n\n``` xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ede.maxhenkel.opus4j\u003c/groupId\u003e\n  \u003cartifactId\u003eopus4j\u003c/artifactId\u003e\n  \u003cversion\u003e2.0.2\u003c/version\u003e\n\u003c/dependency\u003e\n\n\u003crepositories\u003e\n  \u003crepository\u003e\n    \u003cid\u003ehenkelmax.public\u003c/id\u003e\n    \u003curl\u003ehttps://maven.maxhenkel.de/repository/public\u003c/url\u003e\n  \u003c/repository\u003e\n\u003c/repositories\u003e\n```\n\n**Gradle**\n\n``` groovy\ndependencies {\n  implementation 'de.maxhenkel.opus4j:opus4j:2.0.2'\n}\n\nrepositories {\n  maven {\n    name = \"henkelmax.public\"\n    url = 'https://maven.maxhenkel.de/repository/public'\n  }\n}\n```\n\n### Example Code\n\n**Encoding**\n\n``` java\nshort[] rawAudio = ...;\n\n// Creates a new encoder instance with 48kHz mono VOIP\nOpusEncoder encoder = new OpusEncoder(48000, 1, OpusEncoder.Application.VOIP);\n\n// Sets the max payload size to 1500 bytes\nencoder.setMaxPayloadSize(1500);\n\n// Encodes the raw audio\nbyte[] encoded = encoder.encode(rawAudio);\n\n// Resets the encoder state\nencoder.resetState();\n\n...\n\n// Closes the encoder - Not calling this will cause a memory leak!\nencoder.close(); \n```\n\n**Decoding**\n\n``` java\nbyte[] encodedAudio = ...;\n\n// Creates a new decoder instance with 48kHz mono\nOpusDecoder decoder = new OpusDecoder(48000, 1);\n\n// Sets the frame size to 960 samples\n// If this is not set properly, decoded FEC frames will have the wrong size\ndecoder.setFrameSize(960);\n\n// Decodes the encoded audio\nshort[] decoded = decoder.decode(encodedAudio);\n\n// Decode a missing packet with FEC (Forward Error Correction)\ndecoded = decoder.decodeFec();\n\n// Resets the decoder state\ndecoder.resetState();\n\n...\n\n// Closes the decoder - Not calling this will cause a memory leak!\ndecoder.close();\n```\n\n## Credits\n\n- [Opus](https://opus-codec.org/)\n- [opus-rs](https://github.com/SpaceManiac/opus-rs)\n- [jni-rs](https://github.com/jni-rs/jni-rs)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenkelmax%2Fopus4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhenkelmax%2Fopus4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenkelmax%2Fopus4j/lists"}