Before this article, we released the RTMP push flow under the environment of Unity (Windows + Android platform) and RTMP | RTSP pull flow (Windows + Android platform + iOS) low latency solutions that make a whole summary today, replace the topic.

1. Push RTMP streams in Unity

In Unity environment, whether it is camera or form data, the main purpose is to get the original data efficiently. The data format available to the acquisition end is RGB. After getting the data, it will be sent to the encapsulated native SDK through efficient data transmission to complete data coding and RTMP push.

There are several points to note:

1. Data collection and delivery to ensure high efficiency;

2. The screen resolution changes, which can be adapted in real time;

3. Communication between Unity and the native SDK, such as event callbacks;

4. If the screen data is flipped horizontally or vertically, it needs to be corrected.

Related blogs:

Under the Windows platform to realize the Unity form collection push | | camera screen

Juejin. Cn/post / 697235…

RTMP push under Unity3D is implemented on Android platform

Juejin. Cn/post / 697498…

2. The Unity environment RTMP | RTSP player

RTMP or RTSP live streaming in Unity was released a few years ago and has been used in many traditional industries, such as education or industrial simulation or some low-latency control scenarios.

The relevant implementation logic is as follows:

1. Native RTSP or RTSP live playback SDK callback RGB/YUV420/NV12 one of the uncompressed image formats;

2. Unity3D creates the corresponding RGB/YUV420 Shader;

3.Unity3D can obtain image data from various platforms to fill the texture;

There are several points to note:

1. Multi-instance support: The playback side is different from the push side. For example, in smart city, the playback side has multi-path scenario, so multi-instance support is a necessary function.

2. Data transfer as efficiently as possible to minimize resource occupancy;

3. After the video resolution changes, it can automatically adapt;

4. Communication between Unity and the native SDK, such as event callbacks;

5. Long running stability.

Related blogs:

How to play multiple RTSP or RTMP streams simultaneously in Windows platform Unity3d

Juejin. Cn/post / 696353…

How to play RTMP or RTSP streams with low latency under Unity3d platform

Juejin. Cn/post / 696353…