{"id":18175728,"url":"https://github.com/cloudofoz/raylib-media","last_synced_at":"2025-06-28T17:01:42.520Z","repository":{"id":260698322,"uuid":"881597043","full_name":"cloudofoz/raylib-media","owner":"cloudofoz","description":"Clean and user-friendly extension for raylib that adds seamless audio and video streaming support via the FFmpeg libav* libraries. It enables easy integration of multimedia content into raylib applications, providing direct access to video textures and audio streams, with support for seeking and looping.","archived":false,"fork":false,"pushed_at":"2025-05-06T06:11:55.000Z","size":25919,"stargazers_count":73,"open_issues_count":1,"forks_count":6,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-09T00:06:39.135Z","etag":null,"topics":["audio-streaming","ffmpeg","game-development","libav","multimedia","raylib","video-streaming"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudofoz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2024-10-31T22:16:42.000Z","updated_at":"2025-05-06T06:11:59.000Z","dependencies_parsed_at":"2024-12-20T22:21:36.331Z","dependency_job_id":"095c1a03-c260-498c-b7d4-6d569c50beca","html_url":"https://github.com/cloudofoz/raylib-media","commit_stats":{"total_commits":24,"total_committers":1,"mean_commits":24.0,"dds":0.0,"last_synced_commit":"5c392834f6506aee9614b83a2a5010da297ff320"},"previous_names":["cloudofoz/raylib-media"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cloudofoz/raylib-media","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudofoz%2Fraylib-media","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudofoz%2Fraylib-media/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudofoz%2Fraylib-media/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudofoz%2Fraylib-media/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudofoz","download_url":"https://codeload.github.com/cloudofoz/raylib-media/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudofoz%2Fraylib-media/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262465655,"owners_count":23315633,"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":["audio-streaming","ffmpeg","game-development","libav","multimedia","raylib","video-streaming"],"created_at":"2024-11-02T17:00:51.906Z","updated_at":"2025-06-28T17:01:42.499Z","avatar_url":"https://github.com/cloudofoz.png","language":"C","readme":"![Version](https://img.shields.io/badge/raylib--media-v0.3beta-informational) ![Version](https://img.shields.io/badge/raylib-v5.5-informational) ![License](https://img.shields.io/github/license/cloudofoz/raylib-media)\r\n\r\n\u003e **Note**: This library is in **beta**. Your feedback and support in enhancing its quality are greatly appreciated!\r\n\r\n## Introduction\r\n\r\n**raylib-media** is a clean and user-friendly *extension* for [raylib](https://www.raylib.com/) that adds seamless audio and video streaming support via the [FFmpeg](https://ffmpeg.org/about.html) **libav\\*** libraries.\r\nIt enables easy integration of multimedia content into raylib applications, providing direct access to video textures and audio streams, with support for seeking and looping.\r\n\r\n\u003cp align=\"center\"\u003e\r\n  \u003cimg src=\"res/rmedia_icon.svg\" alt=\"raylib-media icon\" width=\"270\" height=\"270\"\u003e\r\n  \u003cimg src=\"res/raylib_example_01.gif\" alt=\"raylib-example\"\u003e\r\n\u003c/p\u003e\r\n\r\n## Table of Contents\r\n\r\n- [Core Features](#core-features)\r\n- [Minimal Usage](#minimal-usage)\r\n- [Code Examples](#code-examples)\r\n- [Dependencies](#dependencies)\r\n- [About FFmpeg](#about-ffmpeg)\r\n- [License](#license)\r\n- [What's New](#whats-new)\r\n- [Credits](#credits)\r\n\r\n## Core Features\r\n\r\n- Portable code: successfully tested on **Windows**, **Linux**, **MacOS**.\r\n- Simple yet effective, with customizable options\r\n- Direct access to video `Texture` and `AudioStream` for efficient media handling\r\n- Optimized memory usage: no direct allocations are made outside the `LoadMedia` function.\r\n- Synchronized audio and video playback\r\n- Supports media seeking and looping\r\n- Supports loading media from custom streams, enabling flexible input sources like archives, online streams, or encrypted resource packs\r\n- Compatible with formats supported by the codecs in the linked FFmpeg build\r\n\r\n## Minimal Usage\r\n\r\nThese 3-4 lines of code show the minimal code needed to play a video with `raylib-media`:\r\n\r\n```c\r\n#include \u003craymedia.h\u003e\r\n\r\nMediaStream media = LoadMedia(\"path/to/your_file.mp4\"); // Load the media\r\n\r\nwhile (...) { // Begin your main loop\r\n    ...\r\n    UpdateMedia(\u0026media); // Update the media stream according to frame time\r\n    ...\r\n    DrawTexture(media.videoTexture, 0, 0, WHITE); // Draw the video frame\r\n    ...\r\n}\r\n\r\nUnloadMedia(\u0026media); // Unload media when done\r\n```\r\n---\r\n\r\n## Code Examples\r\n\r\n**[`1) example_01_basics.c`](https://github.com/cloudofoz/raylib-media/blob/main/examples/media/example_01_basics.c)**  \r\n\u003e *Description:* Demonstrates how to play a video on the screen and loop it continuously.\r\n   \u003cp align=\"center\"\u003e\r\n    \u003cimg src=\"res/rmedia_example_01.jpg\" alt=\"rmedia_example_01.jpg\" width=\"380\"\u003e\r\n   \u003c/p\u003e\r\n   \r\n**[`2) example_02_media_player.c`](https://github.com/cloudofoz/raylib-media/blob/main/examples/media/example_02_media_player.c)**  \r\n\u003e *Description:* A simple media player illustrating how to control playback speed, seek, pause, loop, adjust audio volume, and apply real-time shader effects to the video.\r\n   \u003cp align=\"center\"\u003e\r\n    \u003cimg src=\"res/rmedia_example_02.jpg\" alt=\"rmedia_example_02.jpg\" width=\"380\" height=\"222\"\u003e\r\n    \u003cimg src=\"res/rmedia_example_02.gif\" alt=\"rmedia_example_02.gif\" width=\"380\" height=\"222\"\u003e\r\n   \u003c/p\u003e\r\n\r\n**[`3) example_03_multi_stream.c`](https://github.com/cloudofoz/raylib-media/blob/main/examples/media/example_03_multi_stream.c)**\r\n\u003e *Description:* A 3D demo scene demonstrating multiple video streams with synchronized audio that dynamically adjusts based on cursor proximity.\r\n   \u003cp align=\"center\"\u003e\r\n    \u003cimg src=\"res/rmedia_example_03.jpg\" alt=\"rmedia_example_03.jpg\" width=\"380\" height=\"222\"\u003e\r\n    \u003cimg src=\"res/rmedia_example_03.gif\" alt=\"rmedia_example_03.gif\" width=\"380\" height=\"222\"\u003e\r\n   \u003c/p\u003e\r\n\r\n**[`4) example_04_custom_stream.c`](https://github.com/cloudofoz/raylib-media/blob/main/examples/media/example_04_custom_stream.c)**  \r\n\u003e *Description:* Demonstrates how to use `LoadMediaFromStream` with custom callbacks for reading media.  \r\n\u003e This example simulates a custom stream using a memory buffer, showcasing the flexibility of the API. Real-world use cases include:\r\n\u003e - Reading from compressed archives  \r\n\u003e - Streaming over a network  \r\n\u003e - Accessing custom data formats or encrypted resources  \r\n\r\n---\r\n\r\n## Dependencies\r\n\r\n`raylib-media` depends on the following files and libraries:\r\n\u003e *E.g. with GCC*: `gcc ... rmedia.c -lraylib -lavcodec -lavformat -lavutil -lswresample -lswscale`\r\n\r\n\r\n1. **`src/raymedia.h`** and **`src/rmedia.c`**\r\n\r\n   - You can include them directly in your project or compile **`rmedia.c`** and use the compiled library.\r\n\r\n2. **[raylib](https://www.raylib.com/)**\r\n\r\n   - Since **raylib-media** is an extension of **raylib**, it's assumed you are already using it and know how to compile it. This can easily be done using CMake or one of the available project files.\r\n\r\n3. The following subset of **libav\\*** libraries from **[FFmpeg](https://www.ffmpeg.org/)**:\r\n\r\n   - **`libavcodec`**\r\n   - **`libavformat`**\r\n   - **`libavutil`**\r\n   - **`libswresample`**\r\n   - **`libswscale`**\r\n\r\n   You may want to start by using precompiled libraries and later compile your own version, if needed:\r\n\r\n   - **Linux**: Install via your package manager (e.g., `sudo apt install libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev`).\r\n     \r\n   - **macOS**:\r\n     Use Homebrew (`brew install ffmpeg`).\r\n     \r\n   - **Windows**:\r\n     Download compiled libraries from sources like [FFmpeg Builds by BtbN](https://github.com/BtbN/FFmpeg-Builds): [`ffmpeg-n7.1-latest-win64-lgpl-shared-7.1.zip`](https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n7.1-latest-win64-lgpl-shared-7.1.zip)\r\n\r\n\r\n\r\n---\r\n\r\n## About FFmpeg\r\n\r\nFFmpeg is available in two versions:\r\n\r\n- The complete version under a **GPL** license.\r\n- A more permissive version without certain proprietary codecs under an **LGPL** license.\r\n\r\n**What does this mean for you?**\r\n\r\n- **LGPL Version**: If you prefer more flexibility in licensing your own code, choose the LGPL version. By linking LGPL **libav\\*** libraries dynamically, you're free to license your code as you wish without additional obligations.\r\n- **GPL Version**: Using the GPL version requires that your code also be released under the GPL license, which mandates that the source code be made available under the same terms.\r\n\r\n\r\n---\r\n\r\n## License\r\n\r\nThis project is licensed under the **Zlib** License - see the [LICENSE](LICENSE.md) file for details.\r\n\r\n---\r\n\r\n## What's New\r\n\r\n- **v0.3beta** (latest)\r\n  - **Added CMake support** for cross-platform builds\r\n \r\n---\r\n  \r\n## Credits\r\n\r\nSpecial thanks to the following resources:\r\n\r\n- [FFmpeg Libav Tutorial](https://github.com/leandromoreira/ffmpeg-libav-tutorial) - This resource was invaluable in helping me start to dive into FFmpeg and Libav.\r\n- [FFmpeg Builds by BtbN](https://github.com/BtbN/FFmpeg-Builds) - For providing compiled dependencies that are easy and straightforward to use, perfect for immediately starting to use **raylib-media** in a \"portable\" way.\r\n- [Blender Open Movie projects](https://studio.blender.org/films/) - These movies are not just very cool, but they have been a precious resource for testing my code.\r\n- [@GuvaCode](https://github.com/guvacode/) for his contribution with CMake support!\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudofoz%2Fraylib-media","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudofoz%2Fraylib-media","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudofoz%2Fraylib-media/lists"}