{"id":14960535,"url":"https://github.com/barakchamo/utexturesendreceive","last_synced_at":"2025-05-02T12:31:30.007Z","repository":{"id":41397985,"uuid":"142829626","full_name":"BarakChamo/uTextureSendReceive","owner":"BarakChamo","description":"Unity network texture sender and receiver for video and frame streaming","archived":false,"fork":false,"pushed_at":"2018-07-30T07:41:07.000Z","size":9510,"stargazers_count":152,"open_issues_count":8,"forks_count":27,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-07T02:01:34.177Z","etag":null,"topics":["streaming","streaming-video","texture","unity","unity3d","unity3d-plugin","video-streaming"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BarakChamo.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}},"created_at":"2018-07-30T05:38:42.000Z","updated_at":"2025-03-27T23:41:02.000Z","dependencies_parsed_at":"2022-09-21T07:31:32.552Z","dependency_job_id":null,"html_url":"https://github.com/BarakChamo/uTextureSendReceive","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BarakChamo%2FuTextureSendReceive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BarakChamo%2FuTextureSendReceive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BarakChamo%2FuTextureSendReceive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BarakChamo%2FuTextureSendReceive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BarakChamo","download_url":"https://codeload.github.com/BarakChamo/uTextureSendReceive/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252038152,"owners_count":21684632,"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":["streaming","streaming-video","texture","unity","unity3d","unity3d-plugin","video-streaming"],"created_at":"2024-09-24T13:22:28.589Z","updated_at":"2025-05-02T12:31:25.678Z","avatar_url":"https://github.com/BarakChamo.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# uTextureSendReceive\n###### Unity threaded network texture sender and receiver plugin for video and texture streaming\n\nThis is a small package that provides a threaded interface for sending and receiving any Unity texture over TCP/IP.\nIt can be used to stream video, webcams as well as any 2D or Render texture, like parts of your visuals, minimaps, etc.\n\nCheck out these examples of the same app streaming and receiving with a 20k-count particle-system running uninterrupted in the background ;)\n###### Streaming live webcam feed \n![Streaming live webcam feed](https://user-images.githubusercontent.com/2883345/43383106-efb38c1a-9414-11e8-94bf-eff527537fbd.gif)\n\n###### Streaming a Video Player\n![Streaming a Video Player](https://user-images.githubusercontent.com/2883345/43383267-7aab799a-9415-11e8-8c53-ec0fd8eac7b8.gif)\n\n###### Streaming in-game Camera view\n![Streaming in-game Camera view](https://user-images.githubusercontent.com/2883345/43383475-14dd1744-9416-11e8-8fb7-7bc69258b7f1.gif)\n\n\n## Features\n1. Simple texture-based interface for sending images/video/textures/etc. over TCP/IP.\n2. Threaded sending and receiving for improved performance of the rest of the project.\n3. Configurable encoding and quality settings.\n4. Example Webcam, Video Player and in-game Camera streaming components and scenes.\n\n## Installation\nTo install the package head to the [releases section](https://github.com/BarakChamo/uTextureSendReceive/releases) and download the latest release `.unitypackage`.\n\nFollow [these instructions](https://docs.unity3d.com/Manual/AssetPackages.html) to import the custom package into your project.\nThe package should show up under `TextureSendReceive` in your project's `Assets folder`.\n\n![capture](https://user-images.githubusercontent.com/2883345/43383219-4b7a6ad2-9415-11e8-8a51-a80df2ff1954.PNG)\n\n### Example scenes\nExample usage scenes are provided in the `Example` folder and show a range of use cases for the libary, how to set up streaming and\nhow to use incoming textures in Unity scenes.\n\nAll projects are set up with a sender and a receiver and a 20,000-count particle-system that runs smoothly when sending and receiving 720p video on an MSI laptop with a 260GhZ i7 and GTX970M running Windows 10. \n\n#### Webcam streaming example\nThe webcam example sends a receives a `WebCamTexure` and is included with a small utility to capture webcam textures and select the webcam you want to use.\n\nCheck out the `WebcamSender` file to learn how to use `uTextureSendReceive` with a webcam and Unity's `WebCamTexture`.\n\n#### Video file streaming example\nThe video file example sends a receives a RenderTexture from a `VideoPlayer`.\n\nCheck out the `VideoFileSender` file to learn how to use `uTextureSendReceive` with a `VideoPlayer`, `VideoClip`s and Unity's `RenderTexture` mode for video playback.\n\n#### Camera texture streaming example\nThe camera example sends a receives an in-game camera RenderTexture from a `Camera` aimed at the test particle system.\n\nCheck out the `CameraSender` file to learn how to use `uTextureSendReceive` with a `Camera` and Unity's `RenderTexture` mode for streaming the view from in-game cameras.\n\n\n## Setup and Usage\nTo begin using the package add a `TextureReceiver` or `TextureSender` component to your project.\nBoth components share some common properties, such as the `port` used for TCP/IP connection and the `Message byte length` that indicates the size of each video chunk sent and received.\n\nAll classes and properties are encapsulated under the `TextureSendReceive` namespace. \n\n#### TextureSender\nThe texture sender component accepts connection from receivers for streaming and, encodes textures and sends them over TCP/IP.\nOnce the `sendTexture`, an instance of `2DTexture`, is assigned with a `SetSourceTexture(Texture2D sendTexture)` the TextureSender\nwill send the contents of the texture once per frame.\n\n![captu1re](https://user-images.githubusercontent.com/2883345/43383251-6b94e04a-9415-11e8-97ae-79c5f97101ba.PNG)\n\n##### Configuration\nBegin by adding a `TextureSender` component to a new or existing `GameObject` and configure the `port` and `Encoding`. By default, the component is configured to encode textures as JPGs. It's recommended that you stick to JPGs unless strictly required as this cuts the encoding size by roughly half.\n\n##### Scripting\nStreaming a texture is done in code and only requires a single line for setting the streaming source texture.\nThe `SetSourceTexture(Texture2D sendTexutre)` accepts an instance or `2DTexture` and will continuously read from it once it's initialized.\n\n```c#\nusing TextureSendReceive;\n\n...\n\nTextureSender sender;\nTexture2D sendTexture;\n\nvoid Start () {\n  // Get sender instance\n  sender = GetComponent\u003cTextureSender\u003e();\n  \n  // Initialize Texture2D, in this case with webcamTexture dimensions\n  sendTexture = new Texture2D(webcam.width, webcam.height);\n  \n  // Set send texture\n  sender.SetSourceTexture(sendTexture);\n}\n...\n```\n\n#### TextureReceiver\nThe texture sender component connects to remote senders and accepts texture frames over TCP/IP, currently there's no distinction between senders to handle multiple sources but that might change in the future.\n\n![ca2pture](https://user-images.githubusercontent.com/2883345/43383250-6b698422-9415-11e8-8ec1-e7dde139b48a.PNG)\n\nOnce the `receiveTexture`, an instance of `2DTexture`, is assigned with a `SetTargetTexture(Texture2D sendTexture)` the TextureReceiver\nwill write each received frame to the target texture. Note that the texture will be automatically resized to fit the received frame.\n\n##### Configuration\nBegin by adding a `TextureReceiver` component to a new or existing `GameObject` and configure the `ip`, `port` and `Encoding`. By default, the component is configured to send over `localhost` (`127.0.0.1`) and you can see a working setup of local streaming in the example scenes.\n\n##### Scripting\nReceiving a texture, like streaming, is done in code and only requires a single line for setting the target receiving texture.\nThe `SetTargetTexture(Texture2D sendTexutre)` accepts an instance or `2DTexture` and will continuously write to it as new frames are received.\n\n```c#\nusing TextureSendReceive;\n\n...\n\nTextureReceiver receiver;\nTexture2D targetTexture;\n\nvoid Start () {\n  // Get sender instance\n  receiver = GetComponent\u003cTextureReceiver\u003e();\n\n  // initialize new target texture\n  targetTexture = new Texture2D(1, 1);\n\t\t\t\n  // Set target texture\n  receiver.SetTargetTexture(targetTexture);\n}\n...\n```\n\n## Usage tips\n#### Sending and receiving multiple sources\nYou can initialize as many `TextureReceiver` and `TextureSender`s as you want and handle more than one receiving or sending source.\nAn example for multi-sending and multi-receiving will be added soon.\n\n#### Switching sources and targets\nThe source and target textures can be swapped on the fly by making calls to `SetSourceTexture` and `SetTargetTexture` at runtime.\n\nMade by [Barak Chamo](github.com/BarakChamo), released under [MIT License](https://github.com/BarakChamo/uTextureSendReceive/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarakchamo%2Futexturesendreceive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarakchamo%2Futexturesendreceive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarakchamo%2Futexturesendreceive/lists"}