SlideShare ist ein Scribd-Unternehmen logo
1 von 43
Downloaden Sie, um offline zu lesen
Janus, WebRTC & AI
Fantastic Technologies and How to Mix Them!
Paolo Saviano
Full Stack developer @Meetecho
psaviano@meetecho.com
WebRTC and Artificial Intelligence?
● Absolutely fascinating matter
Real Time Computer Vision & Sound Recognition
Data collection and live elaboration
Broadcasting experience customized by users
● A lot of scenarios with different requirements
Massive broadcasting, small videorooms, device networks
Device constraints, Time constraints…
Must choose!
● Make it simple!
Remove constraints
Explore the results
2
What we wanted from this project
● Handle media in a comfortable way
Receive and elaborate the Janus RTP stream without (too much) manipulation
● Minimize the client side effort
Avoid client-side elaboration
Do not overload the client’s bandwidth
● Something generic
Make an API/SDK/WHATEVER intended to fit as many scenarios as possible
● Play in the home pitch using known languages and environments
3
● Handle media in a comfortable way
Receive and elaborate the Janus RTP stream without (too much) manipulation
● Minimize the client side effort
Avoid client-side elaboration
Do not overload the client’s bandwidth
● Something generic
Make an API/SDK/WHATEVER intended to fit as many scenarios as possible
● Play in the home pitch using known languages and environments
What we wanted from this project
3
ffmpeg
● Handle media in a comfortable way
Receive and elaborate the Janus RTP stream without (too much) manipulation
● Minimize the client side effort
Avoid client-side elaboration
Do not overload the client’s bandwidth
● Something generic
Make an API/SDK/WHATEVER intended to fit as many scenarios as possible
● Play in the home pitch using known languages and environments
What we wanted from this project
3
server-side
ffmpeg
● Handle media in a comfortable way
Receive and elaborate the Janus RTP stream without (too much) manipulation
● Minimize the client side effort
Avoid client-side elaboration
Do not overload the client’s bandwidth
● Something generic
Make an API/SDK/WHATEVER intended to fit as many scenarios as possible
● Play in the home pitch using known languages and environments
What we wanted from this project
3
server-side
modularity :)
ffmpeg
● Handle media in a comfortable way
Receive and elaborate the Janus RTP stream without (too much) manipulation
● Minimize the client side effort
Avoid client-side elaboration
Do not overload the client’s bandwidth
● Something generic
Make an API/SDK/WHATEVER intended to fit as many scenarios as possible
● Play in the home pitch using known languages and environments
What we wanted from this project
JavaScript-ish
modularity :)
3
server-side
ffmpeg
Technologies Recap
● Media Capture (WebRTC)
Janus WebRTC Server (http://github.com/meetecho/janus-gateway)
● Language
TypeScript (https://www.typescriptlang.org)
● Server
NodeJS (https://nodejs.org)
● Media elaboration and Sampling
fluent-ffmpeg (https://github.com/fluent-ffmpeg/node-fluent-ffmpeg)
4
Architecture
● The Janus Videoroom Plugin
WebRTC entrypoint for media producers
Forwards received stream as RTP stream WebRTC
Client
Janus VideoRoom
5
Architecture
● The Janus Videoroom Plugin
WebRTC entrypoint for media producers
Forwards received stream as RTP stream
● The Stream Elaborator
Elaborates received RTP streams
Returns elaboration results as UDP messages
5
RTP
WebRTC
Client
Janus VideoRoom
Architecture
● The Janus Videoroom Plugin
WebRTC entrypoint for media producers
Forwards received stream as RTP stream
● The Stream Elaborator
Elaborates received RTP streams
Returns elaboration results as UDP messages
● The Janus Streaming Plugin
WebRTC entrypoint for media receivers
Forwards received streams (RTP & UDP)
to WebRTC clients through media stream
or datachannels
RTP
RTP
UDP
Janus streaming
WebRTC
Client
WebRTC
Client
5
Janus VideoRoom
Breaking up the flow
Receive
media
elaboration
Handle
Results
6
elaboration
Breaking up the flow
Receive
media
Handle
Results
● Deal with different media
Handle both audio and video RTP streams
● Divergent options for each kind of media
Customizable listening port, video or audio codecs, resolution or sampling…
● Prepare and push data to the elaboration step
6
elaboration
Breaking up the flow
Receive
media
Handle
Results
● Execute the elaboration
Use a local library to achieve the results and propagate them
Use an external cognitive service
● Transform received data
Fit the machine learning model expected input
Optionally preprocess the data for features extraction and normalization
6
elaboration
Breaking up the flow
Receive
media
Handle
Results
● Define what we need to do
Send results back to the Janus Streaming plugin or save them locally
● Postprocess the results
Marshall the results in the format required for the usage, if needed
6
Breaking up the flow
Receive
media
elaboration
Handle
Results
● Common tasks
Bootstrapping, Configuration and Tearing down tasks.
● Common ability
Controllability, observability, isolation, replicability.
6
Breaking up the flow
Receive
media
elaboration
Handle
Results
Input Output
I.a.
Module
6
Breaking up the flow
Receive
media
elaboration
Handle
Results
Input Output
Channels
I.a.
Module
6
Breaking up the flow
Receive
media
elaboration
Handle
Results
Input Output
I.a.
Module
Channels
Producer Consumer/Producer Consumer
6
Module
Input
Breaking up the flow
Receive
media
elaboration
Handle
Results
Output
Janus
Janus
Receiver Sender
I.a.
Module
6
Video
Input
Udp
Output
I.A.
Module
Breaking up the flow
7
I.A.
Module
Audio
Input
I.A.
Module
The Node Interface
8
export interface Node {
ID: string;
config: Configuration;
controlChannel: Channel;
children: string[];
prepare(...options: any[]): void;
start(): void;
stop(): void;
teardown(...options: any[]): void;
handleControls(chunk: Buffer): void;
setControls(controlChannel: Channel): void;
}
The Producer/Consumer Interfaces
9
export interface Producer {
outputChannel: Channel;
propagate(result: Detection): void;
}
export interface Consumer {
inputChannel: Channel;
elaborate(chunk: Buffer): void;
}
● Nodes relationship and runtime
No references to setup, teardown and internal state
The elaborate method will be triggered each time a new data is available
Two nodes are connected when their input/output channels are pipelined
Channels
10
● Transform class extended
It’s a type of Node Stream object
Transfers a Buffer in a One-Way flow
Could register a transformation function and save a state between transformation
● Provides utility methods
type Transformation =
(data: Buffer, ref?: any) => Promise<Buffer|Buffer[]>;
The Sender/Receiver/Module Interfaces
11
● Lifecycle of the node
Invoked automatically
Have to be implemented by developers, if needed
Should handle how the node will use external libraries
export interface Module {
moduleStart(): void;
modulePrepare(...options: any[]): void;
moduleStop(): void;
}
The Sender/Receiver/Module Interfaces
12
export interface Receiver {
getSource(): any;
sourceStart(): void;
sourcePrepare(...options: any[]): void;
sourceStop(): void;
}
export interface Sender {
getSink(): any;
sinkStart(): void;
sinkPrepare(...options: any[]): void;
sinkStop(): void;
}
● Three kind of implemented supernodes
Shown interfaces are already implemented in Input, Elaboration and Output supernodes
Supernodes
13
abstract class Input<T extends Configuration>
implements Node, Receiver, Producer
abstract class Output<T extends Configuration>
implements Node, Sender, Consumer
abstract class Elaborator<T extends Configuration>
implements Node, Module, Producer, Consumer
Configuration
14
● An abstract Configuration class
An abstract class with utility methods only
● Inherited classes requirements
Translate the json in a simple class that contains properties we are looking for
Optionally add some extra get/set methods or additional utility functions
● The LoadConfiguration function
A static function capable of loading configuration properties from a json file
LoadConfiguration<T extends Configuration>
(source: string, constructor: new () => T): T
Configuration
15
constructor(ID: string,
confPath: string,
confConstructor: new () => T) {
this.ID = ID;
this.config = LoadConfiguration(confPath, confConstructor);
...
}
● Superclasses constructors
Loads automatically the provided configuration file into the declared Configuration class
Extending the Input Node
16
● Bootstrap the ffmpeg object
Use the sourcePrepare method to initialize a ffmpeg instance with fluent-ffmpeg
Add listeners for all event
● Configure the node
Specialize the ffmpeg pipe with the options declared into the Configuration class
Compose the right SDP in order to receive RTP stream correctly
● Forward the data
Invoking the sourceStart the ffmepg output is streamed to the outputChannel directly
The audio node will forward chunks of 640Kb (20ms)
The video node will decode and serve video as pictures
Extending the Input Node
17
import ffmpeg from 'fluent-ffmpeg';
sourcePrepare = (): void => {
let sourcePipe = ffmpeg();
sourcePipe
.input(this.config.sdp)
.native()
...
this.receiver = sourcePipe;
}
sourceStart = (): void => {
this.receiver.pipe(this.outputChannel);
}
Extending the Elaborator Node
18
● No boundaries
This kind of supernode could execute a very large variety of tasks
Just pay attention to the time required by the execution
● Use an external service
I.E. Azure, Google, AWS cognitive services
Put in place a third party SDK in the modulePrepare function
The elaborate method will implement data dispatch to the remote service
Then wait for the async results and push them downstream
● Use higher-level library
Demand the interaction with machine learning models to the library internal code
Wrap the API into the above methods
Extending the Elaborator Node
19
elaborate = (chunk: Buffer): void => {
var data = tf.tensor3d(new Int32Array(chunk.buffer), [...]);
this.model.estimateSinglePose(data).then((estimation) => {
const res = new PosenetDetection(estimation);
this.propagate(res);
});
};
● TensorflowJS
Load the model into modulePrepare
Apply a data transformation into the inputChannel to serve data as a Tensor
Do the prediction in the elaborate function
Push results using the propagate method
Extending the Output Node
20
● Stream results back to the Janus Streaming Plugin
When sinkPrepare is invoked, a new UDP socket is created
When data is received, the elaborate function will simply send data to Janus
● Too large data?
Define a transformation function in inputChannel capable of splitting data into chunks
Public API - Build the Network
21
● An object to rule them all
The NetAPI object keeps track of allocated nodes in a Map
A Controller object capable to send message on the controlChannel
● A factory pattern
Allocate a new node by passing its class and the configuration file path
Inject into the constructor a list of options, like parents list
Automatically wire the nodes to its parents and call its prepare method
factory = <T extends Node>
(layer: new (ID: string, configurationPath: string, ...extra: any[]) => T,
configurationPath: string,
constructorOptions: NodeConstructorOptions = { parents: [] }) : T
Public API - Build the Network
22
const V_Input = NetAPI.factory(
VideoInputNode,
'/sample_configs/video-config.json',
{ ID: 'video_input_1' }
);
const Posenet = NetAPI.factory(
PosenetNode,
'/sample_configs/posenet-config.json',
{ ID: 'posenet_module_1', parents: [V_Input] }
);
const UDPSink = NetAPI.factory(
UDPNode,
'/sample_configs/udp-config.json',
{ ID: 'udp_output_1', parents: [Posenet] }
);
Public API - Control the Network
23
● Controlling a node
A status message is sent by the controller over the shared controlChannel
The recipient of this message is written into the message
Only the recipient will change its status, the message is dropped by the others
The state of each node is retained both from the controller and the node itself
● Start and stop a node
When a node change its status, one among its start or stop methods is invoked
NetAPI.activate("input_video_1",
"module_posenet_1",
"output_udp_1");
Examples
24
Emotion recognition using third party service
25
Object Detection loading a Tensorflow model
26
Use a trained LBPHFaceRecognizer
27
What’s Next?
● Measurements
Provide the capability to evaluate delays introduced by elaboration
● Work directly on Stream
Allow video and audio elaboration live
● Online Training
Use the controlChannel in order to dispatch rewards
● Other modules, other languages
Increase the numbers of nodes available out-of-the-box
● Improve API
Create a network dynamically by feeding a file to API, or by using a graphic tool 28
Thank you!!!

Weitere ähnliche Inhalte

Was ist angesagt?

Janus/HOMER/HEPIC @ OpenSIPS18
Janus/HOMER/HEPIC @ OpenSIPS18Janus/HOMER/HEPIC @ OpenSIPS18
Janus/HOMER/HEPIC @ OpenSIPS18Lorenzo Miniero
 
Can WebRTC help musicians? @ FOSDEM 2021
Can WebRTC help musicians? @ FOSDEM 2021Can WebRTC help musicians? @ FOSDEM 2021
Can WebRTC help musicians? @ FOSDEM 2021Lorenzo Miniero
 
WHIP WebRTC Broadcasting @ FOSDEM 2022
WHIP WebRTC Broadcasting @ FOSDEM 2022WHIP WebRTC Broadcasting @ FOSDEM 2022
WHIP WebRTC Broadcasting @ FOSDEM 2022Lorenzo Miniero
 
WebRTC, RED and Janus @ ClueCon21
WebRTC, RED and Janus @ ClueCon21WebRTC, RED and Janus @ ClueCon21
WebRTC, RED and Janus @ ClueCon21Lorenzo Miniero
 
Janus + NDI @ ClueCon 2021
Janus + NDI @ ClueCon 2021Janus + NDI @ ClueCon 2021
Janus + NDI @ ClueCon 2021Lorenzo Miniero
 
Insertable Streams and E2EE @ ClueCon2020
Insertable Streams and E2EE @ ClueCon2020Insertable Streams and E2EE @ ClueCon2020
Insertable Streams and E2EE @ ClueCon2020Lorenzo Miniero
 
WebRTC security+more @ KamailioWorld 2018
WebRTC security+more @ KamailioWorld 2018WebRTC security+more @ KamailioWorld 2018
WebRTC security+more @ KamailioWorld 2018Lorenzo Miniero
 
Multistream in Janus @ CommCon 2019
Multistream in Janus @ CommCon 2019Multistream in Janus @ CommCon 2019
Multistream in Janus @ CommCon 2019Lorenzo Miniero
 
Fuzzing RTC @ Kamailio World 2019
Fuzzing RTC @ Kamailio World 2019Fuzzing RTC @ Kamailio World 2019
Fuzzing RTC @ Kamailio World 2019Lorenzo Miniero
 
SIP/WebRTC load testing @ KamailioWorld 2017
SIP/WebRTC load testing @ KamailioWorld 2017SIP/WebRTC load testing @ KamailioWorld 2017
SIP/WebRTC load testing @ KamailioWorld 2017Lorenzo Miniero
 
FOSDEM2018 Janus Lua plugin presentation
FOSDEM2018 Janus Lua plugin presentationFOSDEM2018 Janus Lua plugin presentation
FOSDEM2018 Janus Lua plugin presentationLorenzo Miniero
 
IETF remote participation via Meetecho @ WebRTC Meetup Stockholm
IETF remote participation via Meetecho @ WebRTC Meetup StockholmIETF remote participation via Meetecho @ WebRTC Meetup Stockholm
IETF remote participation via Meetecho @ WebRTC Meetup StockholmLorenzo Miniero
 
Janus @ WebRTC Meetup Stockholm
Janus @ WebRTC Meetup StockholmJanus @ WebRTC Meetup Stockholm
Janus @ WebRTC Meetup StockholmLorenzo Miniero
 
Scaling WebRTC applications with Janus
Scaling WebRTC applications with JanusScaling WebRTC applications with Janus
Scaling WebRTC applications with JanusLorenzo Miniero
 
Janus: an open source and general purpose WebRTC (gateway) server
Janus: an open source and general purpose WebRTC (gateway) serverJanus: an open source and general purpose WebRTC (gateway) server
Janus: an open source and general purpose WebRTC (gateway) serverDevDay
 
Janus/SIP @ OpenSIPS 2019
Janus/SIP @ OpenSIPS 2019Janus/SIP @ OpenSIPS 2019
Janus/SIP @ OpenSIPS 2019Lorenzo Miniero
 
Janus/SIP @ OpenSIPS 2017
Janus/SIP @ OpenSIPS 2017Janus/SIP @ OpenSIPS 2017
Janus/SIP @ OpenSIPS 2017Lorenzo Miniero
 
Turning live events to virtual with Janus
Turning live events to virtual with JanusTurning live events to virtual with Janus
Turning live events to virtual with JanusLorenzo Miniero
 
Janus Workshop @ ClueCon 2020
Janus Workshop @ ClueCon 2020Janus Workshop @ ClueCon 2020
Janus Workshop @ ClueCon 2020Lorenzo Miniero
 

Was ist angesagt? (20)

Janus/HOMER/HEPIC @ OpenSIPS18
Janus/HOMER/HEPIC @ OpenSIPS18Janus/HOMER/HEPIC @ OpenSIPS18
Janus/HOMER/HEPIC @ OpenSIPS18
 
Can WebRTC help musicians? @ FOSDEM 2021
Can WebRTC help musicians? @ FOSDEM 2021Can WebRTC help musicians? @ FOSDEM 2021
Can WebRTC help musicians? @ FOSDEM 2021
 
WHIP WebRTC Broadcasting @ FOSDEM 2022
WHIP WebRTC Broadcasting @ FOSDEM 2022WHIP WebRTC Broadcasting @ FOSDEM 2022
WHIP WebRTC Broadcasting @ FOSDEM 2022
 
WebRTC, RED and Janus @ ClueCon21
WebRTC, RED and Janus @ ClueCon21WebRTC, RED and Janus @ ClueCon21
WebRTC, RED and Janus @ ClueCon21
 
Janus + NDI @ ClueCon 2021
Janus + NDI @ ClueCon 2021Janus + NDI @ ClueCon 2021
Janus + NDI @ ClueCon 2021
 
Janus @ ClueCon 2019
Janus @ ClueCon 2019Janus @ ClueCon 2019
Janus @ ClueCon 2019
 
Insertable Streams and E2EE @ ClueCon2020
Insertable Streams and E2EE @ ClueCon2020Insertable Streams and E2EE @ ClueCon2020
Insertable Streams and E2EE @ ClueCon2020
 
WebRTC security+more @ KamailioWorld 2018
WebRTC security+more @ KamailioWorld 2018WebRTC security+more @ KamailioWorld 2018
WebRTC security+more @ KamailioWorld 2018
 
Multistream in Janus @ CommCon 2019
Multistream in Janus @ CommCon 2019Multistream in Janus @ CommCon 2019
Multistream in Janus @ CommCon 2019
 
Fuzzing RTC @ Kamailio World 2019
Fuzzing RTC @ Kamailio World 2019Fuzzing RTC @ Kamailio World 2019
Fuzzing RTC @ Kamailio World 2019
 
SIP/WebRTC load testing @ KamailioWorld 2017
SIP/WebRTC load testing @ KamailioWorld 2017SIP/WebRTC load testing @ KamailioWorld 2017
SIP/WebRTC load testing @ KamailioWorld 2017
 
FOSDEM2018 Janus Lua plugin presentation
FOSDEM2018 Janus Lua plugin presentationFOSDEM2018 Janus Lua plugin presentation
FOSDEM2018 Janus Lua plugin presentation
 
IETF remote participation via Meetecho @ WebRTC Meetup Stockholm
IETF remote participation via Meetecho @ WebRTC Meetup StockholmIETF remote participation via Meetecho @ WebRTC Meetup Stockholm
IETF remote participation via Meetecho @ WebRTC Meetup Stockholm
 
Janus @ WebRTC Meetup Stockholm
Janus @ WebRTC Meetup StockholmJanus @ WebRTC Meetup Stockholm
Janus @ WebRTC Meetup Stockholm
 
Scaling WebRTC applications with Janus
Scaling WebRTC applications with JanusScaling WebRTC applications with Janus
Scaling WebRTC applications with Janus
 
Janus: an open source and general purpose WebRTC (gateway) server
Janus: an open source and general purpose WebRTC (gateway) serverJanus: an open source and general purpose WebRTC (gateway) server
Janus: an open source and general purpose WebRTC (gateway) server
 
Janus/SIP @ OpenSIPS 2019
Janus/SIP @ OpenSIPS 2019Janus/SIP @ OpenSIPS 2019
Janus/SIP @ OpenSIPS 2019
 
Janus/SIP @ OpenSIPS 2017
Janus/SIP @ OpenSIPS 2017Janus/SIP @ OpenSIPS 2017
Janus/SIP @ OpenSIPS 2017
 
Turning live events to virtual with Janus
Turning live events to virtual with JanusTurning live events to virtual with Janus
Turning live events to virtual with Janus
 
Janus Workshop @ ClueCon 2020
Janus Workshop @ ClueCon 2020Janus Workshop @ ClueCon 2020
Janus Workshop @ ClueCon 2020
 

Ähnlich wie Talk@JanusCon2019: Janus, WebRTC and ML - Fantastic technologies and how to mix them!

FIWARE Tech Summit - Stream Processing with Kurento Media Server
FIWARE Tech Summit - Stream Processing with Kurento Media ServerFIWARE Tech Summit - Stream Processing with Kurento Media Server
FIWARE Tech Summit - Stream Processing with Kurento Media ServerFIWARE
 
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE
 
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE
 
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE
 
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward
 
Python Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on FlinkPython Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on FlinkAljoscha Krettek
 
Socket Programming using Java
Socket Programming using JavaSocket Programming using Java
Socket Programming using JavaRahul Hada
 
Streaming your Lyft Ride Prices - Flink Forward SF 2019
Streaming your Lyft Ride Prices - Flink Forward SF 2019Streaming your Lyft Ride Prices - Flink Forward SF 2019
Streaming your Lyft Ride Prices - Flink Forward SF 2019Thomas Weise
 
Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...
Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...
Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...Flink Forward
 
Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...
Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...
Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...Flink Forward
 
Real-Time Web applications with WebSockets
Real-Time Web applications with WebSocketsReal-Time Web applications with WebSockets
Real-Time Web applications with WebSocketsStanislav Zozulia
 
Chromium: NaCl and Pepper API
Chromium: NaCl and Pepper APIChromium: NaCl and Pepper API
Chromium: NaCl and Pepper APIChang W. Doh
 
P4+ONOS SRv6 tutorial.pptx
P4+ONOS SRv6 tutorial.pptxP4+ONOS SRv6 tutorial.pptx
P4+ONOS SRv6 tutorial.pptxtampham61268
 
Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQICS
 
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...Aljoscha Krettek
 
MM_Conferencing.ppt
MM_Conferencing.pptMM_Conferencing.ppt
MM_Conferencing.pptVideoguy
 
OpenShift Origin Community Day (Boston) Extending OpenShift Origin: Build You...
OpenShift Origin Community Day (Boston) Extending OpenShift Origin: Build You...OpenShift Origin Community Day (Boston) Extending OpenShift Origin: Build You...
OpenShift Origin Community Day (Boston) Extending OpenShift Origin: Build You...OpenShift Origin
 
OpenShift Origin Community Day (Boston) Writing Cartridges V2 by Jhon Honce
OpenShift Origin Community Day (Boston) Writing Cartridges V2 by Jhon Honce OpenShift Origin Community Day (Boston) Writing Cartridges V2 by Jhon Honce
OpenShift Origin Community Day (Boston) Writing Cartridges V2 by Jhon Honce Diane Mueller
 

Ähnlich wie Talk@JanusCon2019: Janus, WebRTC and ML - Fantastic technologies and how to mix them! (20)

FIWARE Tech Summit - Stream Processing with Kurento Media Server
FIWARE Tech Summit - Stream Processing with Kurento Media ServerFIWARE Tech Summit - Stream Processing with Kurento Media Server
FIWARE Tech Summit - Stream Processing with Kurento Media Server
 
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
 
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
 
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
 
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
 
Multi Streaming Player
Multi Streaming PlayerMulti Streaming Player
Multi Streaming Player
 
Python Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on FlinkPython Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on Flink
 
Socket Programming using Java
Socket Programming using JavaSocket Programming using Java
Socket Programming using Java
 
Streaming your Lyft Ride Prices - Flink Forward SF 2019
Streaming your Lyft Ride Prices - Flink Forward SF 2019Streaming your Lyft Ride Prices - Flink Forward SF 2019
Streaming your Lyft Ride Prices - Flink Forward SF 2019
 
Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...
Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...
Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...
 
Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...
Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...
Flink Forward San Francisco 2019: Streaming your Lyft Ride Prices - Thomas We...
 
Real-Time Web applications with WebSockets
Real-Time Web applications with WebSocketsReal-Time Web applications with WebSockets
Real-Time Web applications with WebSockets
 
Chromium: NaCl and Pepper API
Chromium: NaCl and Pepper APIChromium: NaCl and Pepper API
Chromium: NaCl and Pepper API
 
P4+ONOS SRv6 tutorial.pptx
P4+ONOS SRv6 tutorial.pptxP4+ONOS SRv6 tutorial.pptx
P4+ONOS SRv6 tutorial.pptx
 
Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQ
 
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
 
MM_Conferencing.ppt
MM_Conferencing.pptMM_Conferencing.ppt
MM_Conferencing.ppt
 
Prashant Resume
Prashant ResumePrashant Resume
Prashant Resume
 
OpenShift Origin Community Day (Boston) Extending OpenShift Origin: Build You...
OpenShift Origin Community Day (Boston) Extending OpenShift Origin: Build You...OpenShift Origin Community Day (Boston) Extending OpenShift Origin: Build You...
OpenShift Origin Community Day (Boston) Extending OpenShift Origin: Build You...
 
OpenShift Origin Community Day (Boston) Writing Cartridges V2 by Jhon Honce
OpenShift Origin Community Day (Boston) Writing Cartridges V2 by Jhon Honce OpenShift Origin Community Day (Boston) Writing Cartridges V2 by Jhon Honce
OpenShift Origin Community Day (Boston) Writing Cartridges V2 by Jhon Honce
 

Kürzlich hochgeladen

Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝soniya singh
 
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )Pooja Nehwal
 
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779Delhi Call girls
 
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptxMohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptxmohammadalnahdi22
 
Mathematics of Finance Presentation.pptx
Mathematics of Finance Presentation.pptxMathematics of Finance Presentation.pptx
Mathematics of Finance Presentation.pptxMoumonDas2
 
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdf
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdfCTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdf
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdfhenrik385807
 
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...Kayode Fayemi
 
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Microsoft Copilot AI for Everyone - created by AI
Microsoft Copilot AI for Everyone - created by AIMicrosoft Copilot AI for Everyone - created by AI
Microsoft Copilot AI for Everyone - created by AITatiana Gurgel
 
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night EnjoyCall Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night EnjoyPooja Nehwal
 
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...Hasting Chen
 
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...Sheetaleventcompany
 
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Pooja Nehwal
 
Presentation on Engagement in Book Clubs
Presentation on Engagement in Book ClubsPresentation on Engagement in Book Clubs
Presentation on Engagement in Book Clubssamaasim06
 
Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Vipesco
 
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024eCommerce Institute
 
George Lever - eCommerce Day Chile 2024
George Lever -  eCommerce Day Chile 2024George Lever -  eCommerce Day Chile 2024
George Lever - eCommerce Day Chile 2024eCommerce Institute
 
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara ServicesVVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara ServicesPooja Nehwal
 
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdfOpen Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdfhenrik385807
 
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...NETWAYS
 

Kürzlich hochgeladen (20)

Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
 
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
 
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
 
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptxMohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptx
 
Mathematics of Finance Presentation.pptx
Mathematics of Finance Presentation.pptxMathematics of Finance Presentation.pptx
Mathematics of Finance Presentation.pptx
 
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdf
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdfCTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdf
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdf
 
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
 
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Microsoft Copilot AI for Everyone - created by AI
Microsoft Copilot AI for Everyone - created by AIMicrosoft Copilot AI for Everyone - created by AI
Microsoft Copilot AI for Everyone - created by AI
 
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night EnjoyCall Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
 
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...
 
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
 
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
 
Presentation on Engagement in Book Clubs
Presentation on Engagement in Book ClubsPresentation on Engagement in Book Clubs
Presentation on Engagement in Book Clubs
 
Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510
 
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
 
George Lever - eCommerce Day Chile 2024
George Lever -  eCommerce Day Chile 2024George Lever -  eCommerce Day Chile 2024
George Lever - eCommerce Day Chile 2024
 
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara ServicesVVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
 
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdfOpen Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
 
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
 

Talk@JanusCon2019: Janus, WebRTC and ML - Fantastic technologies and how to mix them!

  • 1. Janus, WebRTC & AI Fantastic Technologies and How to Mix Them! Paolo Saviano Full Stack developer @Meetecho psaviano@meetecho.com
  • 2. WebRTC and Artificial Intelligence? ● Absolutely fascinating matter Real Time Computer Vision & Sound Recognition Data collection and live elaboration Broadcasting experience customized by users ● A lot of scenarios with different requirements Massive broadcasting, small videorooms, device networks Device constraints, Time constraints… Must choose! ● Make it simple! Remove constraints Explore the results 2
  • 3. What we wanted from this project ● Handle media in a comfortable way Receive and elaborate the Janus RTP stream without (too much) manipulation ● Minimize the client side effort Avoid client-side elaboration Do not overload the client’s bandwidth ● Something generic Make an API/SDK/WHATEVER intended to fit as many scenarios as possible ● Play in the home pitch using known languages and environments 3
  • 4. ● Handle media in a comfortable way Receive and elaborate the Janus RTP stream without (too much) manipulation ● Minimize the client side effort Avoid client-side elaboration Do not overload the client’s bandwidth ● Something generic Make an API/SDK/WHATEVER intended to fit as many scenarios as possible ● Play in the home pitch using known languages and environments What we wanted from this project 3 ffmpeg
  • 5. ● Handle media in a comfortable way Receive and elaborate the Janus RTP stream without (too much) manipulation ● Minimize the client side effort Avoid client-side elaboration Do not overload the client’s bandwidth ● Something generic Make an API/SDK/WHATEVER intended to fit as many scenarios as possible ● Play in the home pitch using known languages and environments What we wanted from this project 3 server-side ffmpeg
  • 6. ● Handle media in a comfortable way Receive and elaborate the Janus RTP stream without (too much) manipulation ● Minimize the client side effort Avoid client-side elaboration Do not overload the client’s bandwidth ● Something generic Make an API/SDK/WHATEVER intended to fit as many scenarios as possible ● Play in the home pitch using known languages and environments What we wanted from this project 3 server-side modularity :) ffmpeg
  • 7. ● Handle media in a comfortable way Receive and elaborate the Janus RTP stream without (too much) manipulation ● Minimize the client side effort Avoid client-side elaboration Do not overload the client’s bandwidth ● Something generic Make an API/SDK/WHATEVER intended to fit as many scenarios as possible ● Play in the home pitch using known languages and environments What we wanted from this project JavaScript-ish modularity :) 3 server-side ffmpeg
  • 8. Technologies Recap ● Media Capture (WebRTC) Janus WebRTC Server (http://github.com/meetecho/janus-gateway) ● Language TypeScript (https://www.typescriptlang.org) ● Server NodeJS (https://nodejs.org) ● Media elaboration and Sampling fluent-ffmpeg (https://github.com/fluent-ffmpeg/node-fluent-ffmpeg) 4
  • 9. Architecture ● The Janus Videoroom Plugin WebRTC entrypoint for media producers Forwards received stream as RTP stream WebRTC Client Janus VideoRoom 5
  • 10. Architecture ● The Janus Videoroom Plugin WebRTC entrypoint for media producers Forwards received stream as RTP stream ● The Stream Elaborator Elaborates received RTP streams Returns elaboration results as UDP messages 5 RTP WebRTC Client Janus VideoRoom
  • 11. Architecture ● The Janus Videoroom Plugin WebRTC entrypoint for media producers Forwards received stream as RTP stream ● The Stream Elaborator Elaborates received RTP streams Returns elaboration results as UDP messages ● The Janus Streaming Plugin WebRTC entrypoint for media receivers Forwards received streams (RTP & UDP) to WebRTC clients through media stream or datachannels RTP RTP UDP Janus streaming WebRTC Client WebRTC Client 5 Janus VideoRoom
  • 12. Breaking up the flow Receive media elaboration Handle Results 6
  • 13. elaboration Breaking up the flow Receive media Handle Results ● Deal with different media Handle both audio and video RTP streams ● Divergent options for each kind of media Customizable listening port, video or audio codecs, resolution or sampling… ● Prepare and push data to the elaboration step 6
  • 14. elaboration Breaking up the flow Receive media Handle Results ● Execute the elaboration Use a local library to achieve the results and propagate them Use an external cognitive service ● Transform received data Fit the machine learning model expected input Optionally preprocess the data for features extraction and normalization 6
  • 15. elaboration Breaking up the flow Receive media Handle Results ● Define what we need to do Send results back to the Janus Streaming plugin or save them locally ● Postprocess the results Marshall the results in the format required for the usage, if needed 6
  • 16. Breaking up the flow Receive media elaboration Handle Results ● Common tasks Bootstrapping, Configuration and Tearing down tasks. ● Common ability Controllability, observability, isolation, replicability. 6
  • 17. Breaking up the flow Receive media elaboration Handle Results Input Output I.a. Module 6
  • 18. Breaking up the flow Receive media elaboration Handle Results Input Output Channels I.a. Module 6
  • 19. Breaking up the flow Receive media elaboration Handle Results Input Output I.a. Module Channels Producer Consumer/Producer Consumer 6
  • 20. Module Input Breaking up the flow Receive media elaboration Handle Results Output Janus Janus Receiver Sender I.a. Module 6
  • 21. Video Input Udp Output I.A. Module Breaking up the flow 7 I.A. Module Audio Input I.A. Module
  • 22. The Node Interface 8 export interface Node { ID: string; config: Configuration; controlChannel: Channel; children: string[]; prepare(...options: any[]): void; start(): void; stop(): void; teardown(...options: any[]): void; handleControls(chunk: Buffer): void; setControls(controlChannel: Channel): void; }
  • 23. The Producer/Consumer Interfaces 9 export interface Producer { outputChannel: Channel; propagate(result: Detection): void; } export interface Consumer { inputChannel: Channel; elaborate(chunk: Buffer): void; } ● Nodes relationship and runtime No references to setup, teardown and internal state The elaborate method will be triggered each time a new data is available Two nodes are connected when their input/output channels are pipelined
  • 24. Channels 10 ● Transform class extended It’s a type of Node Stream object Transfers a Buffer in a One-Way flow Could register a transformation function and save a state between transformation ● Provides utility methods type Transformation = (data: Buffer, ref?: any) => Promise<Buffer|Buffer[]>;
  • 25. The Sender/Receiver/Module Interfaces 11 ● Lifecycle of the node Invoked automatically Have to be implemented by developers, if needed Should handle how the node will use external libraries export interface Module { moduleStart(): void; modulePrepare(...options: any[]): void; moduleStop(): void; }
  • 26. The Sender/Receiver/Module Interfaces 12 export interface Receiver { getSource(): any; sourceStart(): void; sourcePrepare(...options: any[]): void; sourceStop(): void; } export interface Sender { getSink(): any; sinkStart(): void; sinkPrepare(...options: any[]): void; sinkStop(): void; }
  • 27. ● Three kind of implemented supernodes Shown interfaces are already implemented in Input, Elaboration and Output supernodes Supernodes 13 abstract class Input<T extends Configuration> implements Node, Receiver, Producer abstract class Output<T extends Configuration> implements Node, Sender, Consumer abstract class Elaborator<T extends Configuration> implements Node, Module, Producer, Consumer
  • 28. Configuration 14 ● An abstract Configuration class An abstract class with utility methods only ● Inherited classes requirements Translate the json in a simple class that contains properties we are looking for Optionally add some extra get/set methods or additional utility functions ● The LoadConfiguration function A static function capable of loading configuration properties from a json file LoadConfiguration<T extends Configuration> (source: string, constructor: new () => T): T
  • 29. Configuration 15 constructor(ID: string, confPath: string, confConstructor: new () => T) { this.ID = ID; this.config = LoadConfiguration(confPath, confConstructor); ... } ● Superclasses constructors Loads automatically the provided configuration file into the declared Configuration class
  • 30. Extending the Input Node 16 ● Bootstrap the ffmpeg object Use the sourcePrepare method to initialize a ffmpeg instance with fluent-ffmpeg Add listeners for all event ● Configure the node Specialize the ffmpeg pipe with the options declared into the Configuration class Compose the right SDP in order to receive RTP stream correctly ● Forward the data Invoking the sourceStart the ffmepg output is streamed to the outputChannel directly The audio node will forward chunks of 640Kb (20ms) The video node will decode and serve video as pictures
  • 31. Extending the Input Node 17 import ffmpeg from 'fluent-ffmpeg'; sourcePrepare = (): void => { let sourcePipe = ffmpeg(); sourcePipe .input(this.config.sdp) .native() ... this.receiver = sourcePipe; } sourceStart = (): void => { this.receiver.pipe(this.outputChannel); }
  • 32. Extending the Elaborator Node 18 ● No boundaries This kind of supernode could execute a very large variety of tasks Just pay attention to the time required by the execution ● Use an external service I.E. Azure, Google, AWS cognitive services Put in place a third party SDK in the modulePrepare function The elaborate method will implement data dispatch to the remote service Then wait for the async results and push them downstream ● Use higher-level library Demand the interaction with machine learning models to the library internal code Wrap the API into the above methods
  • 33. Extending the Elaborator Node 19 elaborate = (chunk: Buffer): void => { var data = tf.tensor3d(new Int32Array(chunk.buffer), [...]); this.model.estimateSinglePose(data).then((estimation) => { const res = new PosenetDetection(estimation); this.propagate(res); }); }; ● TensorflowJS Load the model into modulePrepare Apply a data transformation into the inputChannel to serve data as a Tensor Do the prediction in the elaborate function Push results using the propagate method
  • 34. Extending the Output Node 20 ● Stream results back to the Janus Streaming Plugin When sinkPrepare is invoked, a new UDP socket is created When data is received, the elaborate function will simply send data to Janus ● Too large data? Define a transformation function in inputChannel capable of splitting data into chunks
  • 35. Public API - Build the Network 21 ● An object to rule them all The NetAPI object keeps track of allocated nodes in a Map A Controller object capable to send message on the controlChannel ● A factory pattern Allocate a new node by passing its class and the configuration file path Inject into the constructor a list of options, like parents list Automatically wire the nodes to its parents and call its prepare method factory = <T extends Node> (layer: new (ID: string, configurationPath: string, ...extra: any[]) => T, configurationPath: string, constructorOptions: NodeConstructorOptions = { parents: [] }) : T
  • 36. Public API - Build the Network 22 const V_Input = NetAPI.factory( VideoInputNode, '/sample_configs/video-config.json', { ID: 'video_input_1' } ); const Posenet = NetAPI.factory( PosenetNode, '/sample_configs/posenet-config.json', { ID: 'posenet_module_1', parents: [V_Input] } ); const UDPSink = NetAPI.factory( UDPNode, '/sample_configs/udp-config.json', { ID: 'udp_output_1', parents: [Posenet] } );
  • 37. Public API - Control the Network 23 ● Controlling a node A status message is sent by the controller over the shared controlChannel The recipient of this message is written into the message Only the recipient will change its status, the message is dropped by the others The state of each node is retained both from the controller and the node itself ● Start and stop a node When a node change its status, one among its start or stop methods is invoked NetAPI.activate("input_video_1", "module_posenet_1", "output_udp_1");
  • 39. Emotion recognition using third party service 25
  • 40. Object Detection loading a Tensorflow model 26
  • 41. Use a trained LBPHFaceRecognizer 27
  • 42. What’s Next? ● Measurements Provide the capability to evaluate delays introduced by elaboration ● Work directly on Stream Allow video and audio elaboration live ● Online Training Use the controlChannel in order to dispatch rewards ● Other modules, other languages Increase the numbers of nodes available out-of-the-box ● Improve API Create a network dynamically by feeding a file to API, or by using a graphic tool 28