{"id":26540399,"url":"https://github.com/kernelinterrupt/whisper4dart","last_synced_at":"2026-04-12T04:37:20.437Z","repository":{"id":281509835,"uuid":"942197762","full_name":"KernelInterrupt/whisper4dart","owner":"KernelInterrupt","description":"whisper4dart is a dart wrapper for whisper.cpp, designed to offer an all-in-one speech recognition experience. It can handle most audio file inputs, not just wav.","archived":false,"fork":false,"pushed_at":"2025-07-19T18:24:06.000Z","size":21390,"stargazers_count":8,"open_issues_count":8,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-19T21:45:09.603Z","etag":null,"topics":["cpp","dart","deep-learning","flutter","speech-recognition","speech-to-text","whisper","whisper-cpp"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KernelInterrupt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2025-03-03T18:21:53.000Z","updated_at":"2025-07-19T18:24:11.000Z","dependencies_parsed_at":"2025-04-19T05:29:04.811Z","dependency_job_id":"e48a9456-b4ea-450d-aa32-f76bf64a1365","html_url":"https://github.com/KernelInterrupt/whisper4dart","commit_stats":null,"previous_names":["kernelinterrupt/whisper4dart"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/KernelInterrupt/whisper4dart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KernelInterrupt%2Fwhisper4dart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KernelInterrupt%2Fwhisper4dart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KernelInterrupt%2Fwhisper4dart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KernelInterrupt%2Fwhisper4dart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KernelInterrupt","download_url":"https://codeload.github.com/KernelInterrupt/whisper4dart/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KernelInterrupt%2Fwhisper4dart/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28874841,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T09:47:23.353Z","status":"ssl_error","status_checked_at":"2026-01-29T09:47:19.357Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cpp","dart","deep-learning","flutter","speech-recognition","speech-to-text","whisper","whisper-cpp"],"created_at":"2025-03-22T00:32:29.751Z","updated_at":"2026-04-12T04:37:20.425Z","avatar_url":"https://github.com/KernelInterrupt.png","language":"Dart","readme":"# whisper4dart\n\nwhisper4dart is a dart wrapper for [whisper.cpp](https://github.com/ggerganov/whisper.cpp), designed to offer an all-in-one speech recognition experience. With the built-in decoder/demuxer from ffmpeg, it can handle **most audio/video file** inputs, not just wav.\n\n| Platform | Status |\n| :------: | :----: |\n| Windows |   ✅   |\n|  Linux  |   ✅   |\n| Android |   ✅   |\n|   iOS   |   ❌   |\n|  MacOS  |   ❌   |\n\niOS and MacOS version of whisper4dart will be available in the near future. However, we have no intention to support web platform, at least now.\n\n## Getting Started\n\n```\nflutter pub add whisper4dart\n```\n\nor add following line to your `pubspec.yaml`:\n\n```yaml\n\twhisper4dart:^0.1.4 //for flutter version greater than 3.19 but lower than 3.27\n\twhisper4dart:^0.1.5 //for flutter version \u003e= 3.27\n```\n\nAfter that,run following command in your terminal:\n\n```\ndart run libmpv_dart:setup --platform \u003cyour-platform\u003e\n```\n\n(For example,you need to run:`dart run libmpv_dart:setup --platform windows` if you want to setup for windows.)\n\nAnd then,run:\n\n```\ndart run whisper4dart:setup  --prebuilt\n```\n\nAttention:If you want to build whisper.cpp by yourself instead of using prebuilt libs,run following command:\n\n```\ndart run whisper4dart:setup --source\n```\n\nOK,now you are ready to use the package,enjoy it!\n\n## How to use\n\n```dart\n\nimport 'package:whisper4dart/whisper4dart.dart' as whisper;\n\nfinal Directory tempDirectory = await getTemporaryDirectory();\nfinal ByteData documentBytes = await rootBundle.load(inputPath);\nawait File(inputPath).writeAsBytes(\n    documentBytes.buffer.asUint8List(),\n);\n//preprocess the file,if the file is not in assets/ ,you don't need to use the code above.\n\nfinal String logPath = '${tempDirectory.path}/log.txt';\n\n\nvar cparams=whisper4dart.createContextDefaultParams();\n//create default parameters,you can modify it on your demand.\n\nvar buffer=await rootBundle.load(\"assets/ggml-base.en.bin\");\nUint8List model=buffer.buffer.asUint8List();\n//if your model file is not in assets/ ,you dont need to do so,\n//and you just need to pass the file path of model to initialize whisper.\n//Like this: var model=\"path/to/your/model\";\n\nvar whisperModel=whisper.Whisper(model,cparams,outputMode:\"plaintext\");\n//initialize whisper model\n//The \"outputMode\" variable determines the output format. There are four options:\n//\"plaintext\": Outputs plain text\n//\"txt\": Outputs text-formatted strings\n//\"json\": Outputs JSON-formatted strings\n//\"srt\": Outputs SRT-subtitle-formatted strings\nString output=await whisperModel.infer(inputPath,\nlogPath: logPath,\nnumProcessors: 1,\ntranslate:False,\ninitialPrompt:\"\",\nstartTime:0,\nendTime:-1,\nuseOriginalTime:true);\n//The core function whisper.infer takes \"inputPath\" as the audio file path (e.g., /tmp/jfk.mp3).\n//Specifying \"logPath\" directs whisper4dart to save encoder/demuxer logs in that directory.\n//\"translate\" determines if the output should be translated into English.\n//Use \"initialPrompt\" to set the model's initial prompt.\n//\"startTime\" and \"endTime\" define the segment of the audio to process (unit: milliseconds).\n//Setting \"endTime\" to -1 means no end cropping is needed.\n//When \"useOriginalTime\" is set to true, the timestamps are based on the start of the original audio, \n//not the start of the cropped audio. This means that regardless of whether the audio has \n//been cropped, the timestamps always reference the timeline of the original audio.\n```\n\nSample output strings of the four output modes:(input file:jfk.wav)\n\n`plaintext`:\n\n```\n And so my fellow Americans, ask not what your country can do for you, ask what you can do for your country.\n```\n\n`txt`:\n\n```\n And so my fellow Americans, ask not what your country can do for you, ask what you can do for your country.\n```\n\n`json`:\n\n```json\n[{\"multilingual\":\"false\"},{\"language\":\"en\"},{\"from\":\"00:00:00.000\",\"to\":\"00:00:11.000\",\"text\":\" And so my fellow Americans, ask not what your country can do for you, ask what you can do for your country.\"}]\n```\n\n`srt`:\n\n```\n1\n00:00:00,000 --\u003e 00:00:11,000\n And so my fellow Americans, ask not what your country can do for you, ask what you can do for your country.\n```\n\n## Run in isolate\n\nJust use `.inferIsolate()` to replace `.infer()` .\n\n## Output the transcription result in real time\n\nJust use `.inferStream()` to replace `.infer()` .\n\nThis method returns a tuple `(ValueNotifier\u003cString\u003e, ValueNotifier\u003cint\u003e)`.(known as a **record** in Dart) You can use these returned notifiers to build your widgets.\n\nThe first notifier `(ValueNotifier\u003cString\u003e)` provides the output strings, while the second `(ValueNotifier\u003cint\u003e)` tracks the progress.\n\n(e.g., if the transcription is 50% complete, the value of the progress notifier will be 50.)\n\n\u003e [!CAUTION]\n\u003e In this mode,json output is not supported and you have to set numProcessors to 1.\n\n## Acknowledgement\n\nThis project leverages contributions from[ libmpv_dart ](https://github.com/Playboy-Player/libmpv_dart)and [whisper.cpp](https://github.com/ggerganov/whisper.cpp)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkernelinterrupt%2Fwhisper4dart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkernelinterrupt%2Fwhisper4dart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkernelinterrupt%2Fwhisper4dart/lists"}