{"id":15776064,"url":"https://github.com/w33tmaricich/kawa","last_synced_at":"2025-06-13T05:05:30.364Z","repository":{"id":40477368,"uuid":"93417505","full_name":"w33tmaricich/kawa","owner":"w33tmaricich","description":"A clojure wrapper around ffmpeg command line tools.","archived":false,"fork":false,"pushed_at":"2019-06-06T18:29:45.000Z","size":39,"stargazers_count":18,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-05-12T13:52:16.949Z","etag":null,"topics":["clojure","ffmpeg","ffmpeg-wrapper","ffplay","ffprobe"],"latest_commit_sha":null,"homepage":"http://w33tmaricich.com/kawa","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/w33tmaricich.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}},"created_at":"2017-06-05T15:18:48.000Z","updated_at":"2024-05-13T19:33:56.000Z","dependencies_parsed_at":"2022-09-18T08:52:03.250Z","dependency_job_id":null,"html_url":"https://github.com/w33tmaricich/kawa","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/w33tmaricich/kawa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w33tmaricich%2Fkawa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w33tmaricich%2Fkawa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w33tmaricich%2Fkawa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w33tmaricich%2Fkawa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/w33tmaricich","download_url":"https://codeload.github.com/w33tmaricich/kawa/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w33tmaricich%2Fkawa/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259584815,"owners_count":22880200,"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":["clojure","ffmpeg","ffmpeg-wrapper","ffplay","ffprobe"],"created_at":"2024-10-04T17:04:43.488Z","updated_at":"2025-06-13T05:05:30.341Z","avatar_url":"https://github.com/w33tmaricich.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 川 - kawa\n[![Clojars Project](https://img.shields.io/clojars/v/w33t/kawa.svg)](https://clojars.org/w33t/kawa)\n\nA clojure wrapper around ffmpeg command line tools.\n\n## The goal.\n\nffmpeg is an awesome tool. Lets stop just using `sh` to control it. How\nabout we write a robust system that can:\n\n - Control the many tools included in ffmpeg's ecosystem.\n - Keep track of what processes we have spun up.\n - Navigate ffmpeg's flag hell with readable sane flags.\n\n## Installation\n\nThis is a wrapper library. Make sure you have ffmpeg installed on your system\nand runnable through your system path.\n\n[![version](https://clojars.org/w33t/kawa/latest-version.svg)](https://clojars.org/w33t/kawa)\n\n## Usage\n\n### Quick start\n\nKawa provides both ffmpeg command line tool wrappers as well as a process\nmanager.\n\nTo include the command line tools:\n```clojure\nkawa.core=\u003e (require '[kawa.core :refer [ffmpeg! ffplay! ffprobe!]])\n;nil\n```\n\nTo include the process manager:\n```clojure\nkawa.core=\u003e (require `[kawa.manager :as manager])\n;nil\n```\n\n`ffmpeg!`, `ffplay!`, and `ffprobe!` will all launch an instance of each\napplication. As a simple example, lets generate a test video and store it\nin a file on your system.\n```clojure\nkawa.core=\u003e (ffmpeg! :f \"lavfi\" :i \"testsrc\" :t 10 :pix_fmt \"yuv420p\" \"testsrc.mp4\")\n;{:cmd [\"ffmpeg\" \"-f\" \"lavfi\" \"-i\" \"testsrc\" \"-t\" \"10\" \"-pix_fmt\" \"yuv460p\" \"testsrc.mp4\"], :process {:out #object[java.lang.UNIXProcess$ProcessPipeInputStream 0x33b2f029 \"java.lang.UNIXProcess$ProcessPipeInputStream@33b2f029\"], :in #object[java.lang.UNIXProcess$ProcessPipeOutputStream 0x134ec85c \"java.lang.UNIXProcess$ProcessPipeOutputStream@134ec85c\"], :err #object[java.lang.UNIXProcess$ProcessPipeInputStream 0x375941a4 \"java.lang.UNIXProcess$ProcessPipeInputStream@375941a4\"], :process #object[java.lang.UNIXProcess 0x3c319941 \"java.lang.UNIXProcess@3c319941\"]}}\n```\nThe command returns a map that contains `:cmd` which holds the exact command\nrun. It also contains `:process` which holds the return value of\n[conch's sh/proc implementation](https://github.com/Raynes/conch). The `:process`\nvalue is used by the manager to kill running processes.\n\nAs you can see, flags are represented by keywords. There are many quality of\nlife keywords that improve the readability of your code. For example, the below\ncode does the same as above.\n```clojure\nkawa.core=\u003e (ffmpeg! :format \"lavfi\" :input-url \"testsrc\" :duration 10\n                     :pixel-format \"yuv420p\" \"testsrc.mp4\")\n```\n\n### Process manager\nTo check the currently registered processes, you can run:\n```clojure\nkawa.core=\u003e (manager/ls)\n;{}\n```\n\nThe manager is using a namespaced `(atom {})` to store information registered.\nYou may find yourself in a situation where you wish to have multiple registries.\nIf this is the case, all 3 kawa.manager functions have an optional first\nparameter that takes an `atom`.\n```clojure\nkawa.core=\u003e (def my-registry (atom {}))\n; #'kawa.core/my-registry\nkawa.core=\u003e (manager/ls my-registry)\n;{}\nkawa.core=\u003e (manager/ls)\n;{:test {:cmd [\"ffmpeg\" \"-i\" \"rtsp://admin:robot@172.28.137.102:554/media/video1\" \"-t\" \"100\" \"-pix_fmt\" \"yuv420p\" \"testsrc.mp4\"], :process {:out #object[java.lang.UNIXProcess$ProcessPipeInputStream 0x53d266d \"java.lang.UNIXProcess$ProcessPipeInputStream@53d266d\"], :in #object[java.lang.UNIXProcess$ProcessPipeOutputStream 0x5eba57f5 \"java.lang.UNIXProcess$ProcessPipeOutputStream@5eba57f5\"], :err #object[java.lang.UNIXProcess$ProcessPipeInputStream 0x40de6630 \"java.lang.UNIXProcess$ProcessPipeInputStream@40de6630\"], :process #object[java.lang.UNIXProcess 0x538f1277 \"java.lang.UNIXProcess@538f1277\"]}}}\n```\n\nIn this example, we have no processes registered yet. Lets spin up an ffmpeg\nprocess and register it in one go.\n\n```clojure\nkawa.core=\u003e (manager/register :test (ffmpeg! :i \"rtsp://admin:robot@172.28.137.102:554/media/video1\" :duration 100 :pix_fmt \"yuv420p\" \"testsrc.mp4\"))\n; :test\n```\n\nYou can then use `ls` to ensure the process has been successfully registered.\nIf you do not provide an id to register it as, a unique id will be\ngenerated for you. `register` returns the ID of process you just registered.\n\nTo kill the process that has been registered, simply run:\n```clojure\nkawa.core=\u003e (manager/kill :test)\n;Stopping :test\n;#future[{:status :ready, :val 0} 0x7549316]\n```\n`kill` returns a future whose value is the exit value that is returned from the\nshell.\n\n\n### Detailed Docs\n\n[Detailed documentation can be found here](doc)\n\n## License\n\nCopyright © 2019 Alexander Maricich\n\nDistributed under the Eclipse Public License version 1.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw33tmaricich%2Fkawa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fw33tmaricich%2Fkawa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw33tmaricich%2Fkawa/lists"}