Giter VIP home page Giter VIP logo

streamer's Introduction

gstreamer-plugin

index

Setup

Engine:

  • To use this plugin first Clone this repository in the Plugins/Simbotic directory of your Engine:
git clone [email protected]:Simbotic/Streamer.git
  • After clone the repository, recompile the engine using make .

Project:

  • To use the plugin on a project, update your .uproject adding the UE4 Gstreamer Plugin as an additional dependency on .uproject:
...,
"Modules": [
	{
		"Name": "GST_Test",
		"Type": "Runtime",
		"LoadingPhase": "Default",
		"AdditionalDependencies": [
			"Engine"
		]
	}
],
"Plugins": [
	{
		"Name": "GStreamer",
		"Enabled": true
	},
],
...

  • Add, in the constructors of the classes of your project: Source/PROJECT_NAME.Target.cs and Source/PROJECT_NAMEEditor.Target.cs the following:
bUseUnityBuild = false;
bUsePCHFiles = false;

Usage

On Blueprints the Blueprint hierarchy you need:

  • GstPipeline.
  • 2 GstAppSrc these components will be named as GstAppSrcRGB and GstAppSrcDepth.
  • 2 scene Capture Component 2D these components will be named as SceneCaptureRGB and SceneCaptureDepth.

gst-plugin-ue4 blueprints

GstPipeline

gst-plugin-ue4 blueprints

  • Pipeline Name will be set as robot.

  • Pipeline config will set as:

    appsrc name=sensor_rgb caps=video/x-raw,width=512,height=512,format=BGRx, framerate=10/1 ! videoconvert ! queue2 ! fpsdisplaysink

  • Pipeline Config File will be empty.

  • Pipeline Use File will be unchecked.

  • Pipeline Autostart will be checked.

GstAppSrc

The components GstAppSrc are named as GstAppSrcRGB and GstAppSrcDepth these components are related with Scene Capture Components.

gst-plugin-ue4 blueprints gst-plugin-ue4 blueprints

  • Pipeline Name will be set as robot.
  • App Src Name it will be set as sensor_rgb and sensor_depth respectively.
  • App Src Enabled will be set as checked.
  • Src Video it will be set as SceneCaptureRGB and SceneCaptureDepth.
  • Src Klv Will Set as empty.

Scene Capture Component 2D (General)

on Scene Capture component go to Post Process Volume/Rendering/Features/Post process Materials/Array.

gst-plugin-ue4 blueprints gst-plugin-ue4 blueprints

Materials

gst-plugin-ue4 blueprints gst-plugin-ue4 blueprints

create a new array, on choose select asset reference, then add the respectively Material M_SensorBGRA and M_SensorDepth.

Scene Capture Component 2D (RGB)

Modify tab Scene Capture.

gst-plugin-ue4 blueprints

  • On Primitive Render Mode select Render Scene Primitives .
  • On Capture Source select Final Color (LDR) in RGB .

Scene Capture Component 2D (Depth)

Modify tab Scene Capture.

gst-plugin-ue4 blueprints

  • On Capture Source select Final Color (LDR) in RGB .

Render a local file on a mesh

We will build a BP where we will add the following components.

  • GstPipeline.
  • GstAppSink.
  • Plane (mesh).

gst-plugin-ue4 blueprints

GstPipeline

We need to add the name and the config to the pipeline.

gst-plugin-ue4 blueprints

pipeline name

robot

pipeline config

filesrc location=/Absolute/Path/To/Your/File.mp4 ! decodebin ! videoconvert ! video/x-raw,format=(string)RGBA ! videoconvert ! appsink name=sink

GstAppSink

We need to add the pipeline name that we defined before robot and the appsink that is set at the end of the pipeline config, it's called sink.

gst-plugin-ue4 blueprints

Blueprint Event Graph

We need to add a variable, it type will be Material Interface, we will name it as Material.

We will drag the GstAppSink component to the event Graph, from it pin we will generate a Get Texture Module, then using the variable we created before, generate a module type Create Dynamic Material Instance, Finally drag the Plane from BP components that we created at the begin, we will set a material on the plane.

gst-plugin-ue4 blueprints

Create Material To Render The Local File

Create a material (we will name it as (GstRender), inside of it, create a Texture Sample plug in the Base color, then add a Texture Object an convert it on a parameter, connect this parameter to the Texture input of the Texture Sample, Create A Texture Coordinate and plug in the UVs input, finally, create a constant it's value will be 0, plug in metallic and specular inputs.

gst-plugin-ue4 blueprints

Final step

Return to the BP that we create at the begin, and set Variable Material and the plane material, with the material we created.

Material

gst-plugin-ue4 blueprints

Plane

gst-plugin-ue4 blueprints

Render Camera record on a mesh

We will combine the configurations that we set on Render a local file on a mesh., and gstappsrc, and the biggest change will be set on the Pipeline Config.

Modify BP

On our BP we will add a gstappsrc (use the configuration of gstappsrc), add 2 sceneCapture, and name then as SceneCaptureRGB and SceneCaptureDepth (configuration for the SceneCapture is the same that we set on SceneCapture).

gst-plugin-ue4 blueprints

Modify pipeline config

Our pipeline config will looks like this.

gst-plugin-ue4 blueprints

appsrc name=sensor_rgb caps=video/x-raw,width=512,height=512,format=BGRx,framerate=10/1 ! videoconvert ! queue2! videoconvert ! video/x-raw,format=(string)RGBA ! videoconvert ! appsink name=sink

GstAppSink

gst-plugin-ue4 blueprints

GstAppSrc

gst-plugin-ue4 blueprints gst-plugin-ue4 blueprints

streamer's People

Contributors

rozgo avatar bryandrm avatar racsoraul avatar kevinrev26 avatar wongfei avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.