{"id":13508711,"url":"https://github.com/paolo-pr/laav","last_synced_at":"2025-03-30T11:32:39.318Z","repository":{"id":216996867,"uuid":"89350387","full_name":"paolo-pr/laav","owner":"paolo-pr","description":"Asynchronous Audio / Video Library for H264 / MJPEG / OPUS / AAC / MP2 encoding, transcoding, recording and streaming from live sources","archived":false,"fork":false,"pushed_at":"2022-09-17T16:15:26.000Z","size":468,"stargazers_count":63,"open_issues_count":0,"forks_count":13,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-01T08:33:50.616Z","etag":null,"topics":["aac","audio-library","audio-streaming","h264","http","low-latency","matroska","mjpeg-decoder","mjpeg-stream","mpegts","mqtt","stream","udp-server","video-live","video-processing","video-recording","video-streaming","video-surveillance"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paolo-pr.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-04-25T10:57:09.000Z","updated_at":"2024-06-22T14:06:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"860ca65c-870f-4a3b-8d7e-25f542db39a2","html_url":"https://github.com/paolo-pr/laav","commit_stats":null,"previous_names":["paolo-pr/laav"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paolo-pr%2Flaav","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paolo-pr%2Flaav/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paolo-pr%2Flaav/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paolo-pr%2Flaav/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paolo-pr","download_url":"https://codeload.github.com/paolo-pr/laav/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246314011,"owners_count":20757450,"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":["aac","audio-library","audio-streaming","h264","http","low-latency","matroska","mjpeg-decoder","mjpeg-stream","mpegts","mqtt","stream","udp-server","video-live","video-processing","video-recording","video-streaming","video-surveillance"],"created_at":"2024-08-01T02:00:57.367Z","updated_at":"2025-03-30T11:32:39.311Z","avatar_url":"https://github.com/paolo-pr.png","language":"C++","funding_links":[],"categories":["C++","mqtt"],"sub_categories":[],"readme":"# Live Asynchronous Audio Video Library\n\n## ABOUT\n\nA header-only **C++** library which wraps [FFmpeg](https://ffmpeg.org/), [V4L2](https://linuxtv.org/), [ALSA](https://www.alsa-project.org) and [Libevent](http://libevent.org/) for capturing audio and video from multiple live sources (cameras and microphones) and\n\n* Encoding (video: **H264**, audio: **AAC**, **MP2** and **OPUS**)\n* Decoding (video: **MJPEG**) / transcoding (video: **MJPEG** -\u003e **H264**)\n* Recording to file (**MPEGTS** and **MATROSKA** containers, audio and/or video)\n* Streaming (**HTTP** and **UDP** protocols for **MPEGTS** and **MATROSKA** containers)\n* Basic image processing\n\nThe project is useful for building **video surveillance** systems as well, consisting in media servers which stream and record at the same time and which can be controlled through **MQTT** or **HTTP** commands (see **[THIS](https://github.com/paolo-pr/laav/blob/master/mqtt-avsystem/README.md)** and **[THIS](https://github.com/paolo-pr/laav/blob/master/examples/VideoExample_2.cpp)** examples).\n\nThe project runs on **Linux** (**ALSA** and **V4L2** devices), but a Windows port is planned (any contribution is welcome!).\n\n## FEATURES\n\n* All the audio/video tasks are made with **strictly asynchronous** multiple **pipes**, inside one main loop. This allows to create **simple**, **short** (a complete live H264 grabber/streamer can be made with less than 40 lines of code, see **[THIS](https://github.com/paolo-pr/laav/blob/master/examples/VideoExample_1.cpp)** example), **easy to read** and **intuitive** code in which all the pipes can be realized through overloaded operators, in the following form:\n\n```\nwhile (!LAAVStop)\n{\n    // Pipe\n    grabber \u003e\u003e converter \u003e\u003e encoder \u003e\u003e streamer;\n    \n    // Audio-video events catcher\n    eventsCatcher-\u003ecatchNextEvent();\n}\n```\n\n* **Threads are not used at all** and they are intentionally discouraged in order to avoid that they can be improperly used for decoupling tasks, without taking advantage from multi-core systems.\n* All the audio/video modules (-\u003e classes) make **extensive use of templates** and all their possible concatenations are checked at **compile-time**, so to avoid inconsistent pipes.\n* All the pipes are **safe at runtime**. I.E: when a source is disconnected or temporarily unavailable, the main loop can continue without necessarily having to check errors (they can be checked, anyway, by polling the status of each node: see **[THIS](https://github.com/paolo-pr/laav/blob/master/examples/AudioVideoExample_2.cpp)** example)\n* The library is all RAII-designed (basically it safely wraps Libavcodec/format, V4L and ALSA) and **the user doesn't have to bother with pointers and memory management**.\n* The public API is intended to be intuitive, with a few self-explanatory functions.\n\n## COMPILING / RUNNING\n\nDependencies: **[FFmpeg](https://ffmpeg.org/)** \u003e= **5.0** (tested with **5.0** version), **[Libevent](http://libevent.org/)** and pkg-config (optional: see the compile command below).\n**[FFmpeg](https://ffmpeg.org/)** needs **[x264](http://www.videolan.org/developers/x264.html)** for H264 support and **[libopus](http://opus-codec.org/)** for OPUS support.\n\n* Include the library global header (LAAV.hpp), as shown in the [examples](https://github.com/paolo-pr/laav/tree/master/examples), in YourProgram.cpp and execute:\n```\ng++ -Wall -std=c++11 -DLINUX -o YourProgram YourProgram.cpp `pkg-config --libs libavformat libavcodec libavutil libswresample libswscale libevent alsa`\n```\n* Execute ./CompileExamples for compiling the provided examples.\n* API documentation in HTML format can be created by executing, inside the doxy directory:\n```\ndoxygen Doxyfile\n```\nThe library has been tested with the **[VLC](http://www.videolan.org/)**, **[FFPLAY](https://ffmpeg.org/)** and **[MPV](https://mpv.io/)** media players, but other players should work as well.\nIn order to reduce the network streams' latency, use the following flags on the client side:\n\nVLC (tested with v2.2.4: set a low value for --network-caching flag):\n```\nvlc --network-caching 200 http://stream_url\n```\nFFPLAY:\n```\nffplay -fflags nobuffer http://stream_url\n```\n\n## HOW TO USE IT\n\nSee the provided **[EXAMPLES](https://github.com/paolo-pr/laav/tree/master/examples)**\n\n## TODO\n\n* Improve the compile-time error messages, for inconsistent pipes, with more static_assert(...) calls.\n* Add a RTSP/RTP streaming server.\n* Windows port (basically, it will consist in creating Windows based classes corresponding to the ALSAGrabber and V4L2Grabber classes, with the same API, and few other things: any contribution is welcome!).\n* MPEGTS-MJPEG is currently NOT supported.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaolo-pr%2Flaav","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaolo-pr%2Flaav","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaolo-pr%2Flaav/lists"}