{"id":13396906,"url":"https://github.com/libgdx/gdx-video","last_synced_at":"2025-03-13T23:31:59.336Z","repository":{"id":26027567,"uuid":"29470512","full_name":"libgdx/gdx-video","owner":"libgdx","description":"A libGDX cross platform video rendering extension","archived":false,"fork":false,"pushed_at":"2024-04-07T13:09:56.000Z","size":51958,"stargazers_count":141,"open_issues_count":13,"forks_count":49,"subscribers_count":38,"default_branch":"master","last_synced_at":"2024-04-07T14:25:42.838Z","etag":null,"topics":["android","cross-platform","html5","java","libgdx","linux","macosx","video","windows"],"latest_commit_sha":null,"homepage":"","language":"Java","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/libgdx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING.winpthreads.txt","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}},"created_at":"2015-01-19T12:46:22.000Z","updated_at":"2024-04-07T14:25:46.815Z","dependencies_parsed_at":"2024-04-07T14:36:31.969Z","dependency_job_id":null,"html_url":"https://github.com/libgdx/gdx-video","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libgdx%2Fgdx-video","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libgdx%2Fgdx-video/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libgdx%2Fgdx-video/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libgdx%2Fgdx-video/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libgdx","download_url":"https://codeload.github.com/libgdx/gdx-video/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243500224,"owners_count":20300759,"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":["android","cross-platform","html5","java","libgdx","linux","macosx","video","windows"],"created_at":"2024-07-30T18:01:07.318Z","updated_at":"2025-03-13T23:31:59.324Z","avatar_url":"https://github.com/libgdx.png","language":"Java","funding_links":[],"categories":["Video"],"sub_categories":[],"readme":"# GDX-Video\n\n![GitHub Workflow Status (master)](https://img.shields.io/github/actions/workflow/status/libgdx/gdx-video/publish_snapshot.yml?branch=master)\n\n[![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/com.badlogicgames.gdx-video/gdx-video?nexusVersion=2\u0026server=https%3A%2F%2Foss.sonatype.org\u0026label=release)](https://search.maven.org/artifact/com.badlogicgames.gdx-video/gdx-video)\n[![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/com.badlogicgames.gdx-video/gdx-video?server=https%3A%2F%2Foss.sonatype.org\u0026label=snapshot)](https://oss.sonatype.org/#nexus-search;gav~com.badlogicgames.gdx-video~gdx-video~~~~kw,versionexpand)\n\nA libGDX cross-platform video rendering extension\n\n## Contents\n* [Getting Started](#getting-started)\n  * [Repositories](#repositories)\n  * [Using with Gradle](#gradle-dependency-declarations)\n* [Playing video](#playing-video)\n* [Encoding recommendations](#encoding-recommendations)\n  * [File format and codec](#file-format-and-codec)\n  * [Resolution and framerate](#resolution-and-framerate)\n* [Contributing](#contributing)\n  * [Building from source](#building-from-source)\n  * [Cross-compilation on macOS](#cross-compilation-on-macos)\n* [Licensing](#licensing)\n\n## Getting Started\n\nGdx-video is currently available in maven with official builds and snapshot builds. You can find them at the following repositories:\n\n### Repositories\n\n* **Official**  For official releases, use https://oss.sonatype.org/content/repositories/releases\n* **Snapshots** For snapshot builds, use https://oss.sonatype.org/content/repositories/snapshots\n\n### Gradle dependency declarations\n##### Core:\n```groovy\nimplementation \"com.badlogicgames.gdx-video:gdx-video:$gdxVideoVersion\"\n```\n\n##### Desktop:\n```groovy\nimplementation \"com.badlogicgames.gdx-video:gdx-video-lwjgl3:$gdxVideoVersion\"\n// or (when using legacy LWJGL2):\nimplementation \"com.badlogicgames.gdx-video:gdx-video-lwjgl:$gdxVideoVersion\"\n```\n\n##### Android:\n```groovy\nimplementation \"com.badlogicgames.gdx-video:gdx-video-android:$gdxVideoVersion\"\n```\n\n##### iOS (with RoboVM):\n```groovy\nimplementation \"com.badlogicgames.gdx-video:gdx-video-robovm:$gdxVideoVersion\"\n```\n\n##### Html:\n\n```groovy\nimplementation \"com.badlogicgames.gdx-video:gdx-video:$gdxVideoVersion:sources\"\nimplementation \"com.badlogicgames.gdx-video:gdx-video-gwt:$gdxVideoVersion\"\nimplementation \"com.badlogicgames.gdx-video:gdx-video-gwt:$gdxVideoVersion:sources\"\n```\nYou also need to add the following file to your GdxDefinition.gwt.xml in your html project:\n`````xml\n\u003cinherits name=\"com.badlogic.gdx.video.gdx_video_gwt\" /\u003e\n`````\n\n## Playing video\n\nFirst, get a video player for the current platform using\n\n```java\nVideoPlayer player = VideoPlayerCreator.createVideoPlayer();\n```\n\nThen, load a video from your game's assets.\n\n```java\nFileHandle file = Gdx.files.internal(\"video.webm\");\nplayer.load(file);\n```\n\nThen you can play the video:\n\n```java\nplayer.play();\n```\n\nOnce the video has fully loaded, you may retrieve additional\ninformation about the file.\n\n```java\nif (player.isBuffered()) {\n    int videoWidth = player.getVideoWidth();\n    int videoHeight = player.getVideoHeight();\n}\n```\n\nOn each frame, call the `update()` function to acquire new video frames\nand keep the decoder running. You may then retrieve the frame using `getTexture()`,\nbut note that the texture may be larger than the video itself. The provided\n`VideoActor` takes care of both updating and drawing when using Scene2D.\n\nOnce you are done playing, remember to `dispose()` the video player.\n\n## Encoding recommendations\n\nDepending on the devices your game targets, you may need to encode\nyour videos with multiple formats and resolutions.\n\nSee the following tables for a rough overview, but remember to test\nyour game on real devices.\n\n### File format and codec\n\n| Format                 | Desktop  | Android  | iOS    | Web |\n|------------------------|----------|----------|--------|-----|\n| MP4 (H.264/AVC + AAC)  | ❌ *      | ✅        | ✅      | ⚠️  |\n| MP4 (H.265/HEVC + AAC) | ❌ *      | ⚠️ \u003e 5.0 | ✅ \u003e 11 | ⚠️  |\n| WebM (VP8 + Vorbis)    | ✅        | ✅        | ❌      | ✅   |\n| WebM (VP9 + Opus)      | ✅        | ⚠️ \u003e 5.0 | ❌      | ❔   |\n| MKV (AV1 + Opus)       | ✅        | ⚠️ \u003e 10  | ❌ *   | ⚠️  |\n\n#### Additional notes\n\n**Desktop:** Additional formats and codecs can be enabled when compiling \ngdx-video yourself. See the file [gdx-video-desktop/FFmpeg/build.gradle](gdx-video-desktop/FFmpeg/build.gradle).\n\n**iOS**: H.265 is supported since iOS 11. AV1 requires a current high-end\ndevice with a hardware decoder.\n\n**Android**: See the following webpage for officially supported media formats: \n\u003chttps://developer.android.com/guide/topics/media/platform/supported-formats\u003e.\nNote that this support table is not always accurate, especially for devices\nand emulator images without Google Play Services. \n\nIn practice, H.264 is a good choice for physical Android tablets / smartphones\nas most devices (including old and cheap ones) have hardware decoding support.\nRemember to dispose a VideoPlayer before loading a new one, as some devices\nfail to load the next video otherwise.\n\n### Resolution and framerate\n\nEven when the format is officially supported, not all devices\nhave hardware acceleration for video decoding. Many video\ncodecs specify the decoding capabilities as \"levels\" of bitrate,\nvideo resolution and framerate. Trying to play a video above the\ndevice's capabilities may cause increased power usage, frame drops,\nvisual or audio artifacts or even game crashes.\n\n#### Examples (using H.264 levels):\n\n| Level | (Mobile) device category | Example 1            | Example 2           |\n|-------|--------------------------|----------------------|---------------------|\n| 3     | Low end                  | 720 x  480 @  30fps  | -                   |\n| 3.1   |                          | 720 x  480 @  60fps  | 1280 x  720 @ 30fps |\n| 4     | Budget / mid range       | 1280 x  720 @  60fps | 1920 x 1080 @ 30fps |\n| 4.2   |                          | 1280 x  720 @ 120fps | 1920 x 1080 @ 60fps |\n| 5.1   | High performance         | 1920 x 1080 @ 120fps | 3840 x 2160 @ 30fps |\n\n#### Possible approaches:\n\n- Use a lower resolution as 'baseline' that works on all target devices\n- Ship your videos in multiple resolutions and guess the best one for the\n  device (e.g. based on OS version, RAM size or display resolution)\n\n## Contributing\n\n### Building from source\n\nTo build from source, clone or download this repository, then open it in Android Studio\nand perform a gradle sync. If you get any *ZipFile* errors, watch the logs above and\ninstall the remaining Android SDK components through the SDK manager.\n\nWhen building for desktop, build the native components using the Gradle tasks\n`:gdx-video-desktop:buildFFmpeg{platform}{arch}`\nand `:gdx-video-desktop:jnigenBuild{platform}{arch}`.\n\nPerform the following command to compile and upload the library in your local repository:\n\n    ./gradlew publishToMavenLocal\n\nSee `build.gradle` file for current version to use in your dependencies.\n\n### Cross-compilation on MacOS\n\nInstall the cross-compilers using [homebrew](https://brew.sh) with the commands\n~~~\nbrew install mingw-w64 nasm\nbrew tap messense/macos-cross-toolchains\nbrew install i686-unknown-linux-gnu x86_64-unknown-linux-gnu x86_64-unknown-linux-gnu arm-unknown-linux-gnueabihf aarch64-unknown-linux-gnu\n~~~\n\n## Licensing\nThe project is licensed under the Apache 2 License, meaning you can use it free of charge, without strings attached in commercial and non-commercial projects. We love to get (non-mandatory) credit in case you release a game or app using this project!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibgdx%2Fgdx-video","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibgdx%2Fgdx-video","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibgdx%2Fgdx-video/lists"}