SlideShare a Scribd company logo
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!!!

More Related Content

What's hot

Janus/HOMER/HEPIC @ OpenSIPS18
Janus/HOMER/HEPIC @ OpenSIPS18Janus/HOMER/HEPIC @ OpenSIPS18
Janus/HOMER/HEPIC @ OpenSIPS18
Lorenzo Miniero
 
Can WebRTC help musicians? @ FOSDEM 2021
Can WebRTC help musicians? @ FOSDEM 2021Can WebRTC help musicians? @ FOSDEM 2021
Can WebRTC help musicians? @ FOSDEM 2021
Lorenzo Miniero
 
WHIP WebRTC Broadcasting @ FOSDEM 2022
WHIP WebRTC Broadcasting @ FOSDEM 2022WHIP WebRTC Broadcasting @ FOSDEM 2022
WHIP WebRTC Broadcasting @ FOSDEM 2022
Lorenzo Miniero
 
WebRTC, RED and Janus @ ClueCon21
WebRTC, RED and Janus @ ClueCon21WebRTC, RED and Janus @ ClueCon21
WebRTC, RED and Janus @ ClueCon21
Lorenzo Miniero
 
Janus + NDI @ ClueCon 2021
Janus + NDI @ ClueCon 2021Janus + NDI @ ClueCon 2021
Janus + NDI @ ClueCon 2021
Lorenzo Miniero
 
Janus @ ClueCon 2019
Janus @ ClueCon 2019Janus @ ClueCon 2019
Janus @ ClueCon 2019
Lorenzo Miniero
 
Insertable Streams and E2EE @ ClueCon2020
Insertable Streams and E2EE @ ClueCon2020Insertable Streams and E2EE @ ClueCon2020
Insertable Streams and E2EE @ ClueCon2020
Lorenzo Miniero
 
WebRTC security+more @ KamailioWorld 2018
WebRTC security+more @ KamailioWorld 2018WebRTC security+more @ KamailioWorld 2018
WebRTC security+more @ KamailioWorld 2018
Lorenzo Miniero
 
Multistream in Janus @ CommCon 2019
Multistream in Janus @ CommCon 2019Multistream in Janus @ CommCon 2019
Multistream in Janus @ CommCon 2019
Lorenzo Miniero
 
Fuzzing RTC @ Kamailio World 2019
Fuzzing RTC @ Kamailio World 2019Fuzzing RTC @ Kamailio World 2019
Fuzzing RTC @ Kamailio World 2019
Lorenzo Miniero
 
SIP/WebRTC load testing @ KamailioWorld 2017
SIP/WebRTC load testing @ KamailioWorld 2017SIP/WebRTC load testing @ KamailioWorld 2017
SIP/WebRTC load testing @ KamailioWorld 2017
Lorenzo Miniero
 
FOSDEM2018 Janus Lua plugin presentation
FOSDEM2018 Janus Lua plugin presentationFOSDEM2018 Janus Lua plugin presentation
FOSDEM2018 Janus Lua plugin presentation
Lorenzo 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 Stockholm
Lorenzo Miniero
 
Janus @ WebRTC Meetup Stockholm
Janus @ WebRTC Meetup StockholmJanus @ WebRTC Meetup Stockholm
Janus @ WebRTC Meetup Stockholm
Lorenzo Miniero
 
Scaling WebRTC applications with Janus
Scaling WebRTC applications with JanusScaling WebRTC applications with Janus
Scaling WebRTC applications with Janus
Lorenzo 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) server
DevDay
 
Janus/SIP @ OpenSIPS 2019
Janus/SIP @ OpenSIPS 2019Janus/SIP @ OpenSIPS 2019
Janus/SIP @ OpenSIPS 2019
Lorenzo Miniero
 
Janus/SIP @ OpenSIPS 2017
Janus/SIP @ OpenSIPS 2017Janus/SIP @ OpenSIPS 2017
Janus/SIP @ OpenSIPS 2017
Lorenzo 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 Janus
Lorenzo Miniero
 
Janus Workshop @ ClueCon 2020
Janus Workshop @ ClueCon 2020Janus Workshop @ ClueCon 2020
Janus Workshop @ ClueCon 2020
Lorenzo Miniero
 

What's hot (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
 

Similar to 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 Server
FIWARE
 
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
 
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
 
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
 
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
 
Multi Streaming Player
Multi Streaming PlayerMulti Streaming Player
Multi Streaming Player
Guillaume Chabin
 
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
Aljoscha Krettek
 
Socket Programming using Java
Socket Programming using JavaSocket Programming using Java
Socket Programming using Java
Rahul Hada
 
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
 
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
Thomas 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
 
Real-Time Web applications with WebSockets
Real-Time Web applications with WebSocketsReal-Time Web applications with WebSockets
Real-Time Web applications with WebSockets
Stanislav Zozulia
 
Chromium: NaCl and Pepper API
Chromium: NaCl and Pepper APIChromium: NaCl and Pepper API
Chromium: NaCl and Pepper API
Chang W. Doh
 
P4+ONOS SRv6 tutorial.pptx
P4+ONOS SRv6 tutorial.pptxP4+ONOS SRv6 tutorial.pptx
P4+ONOS SRv6 tutorial.pptx
tampham61268
 
Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQ
ICS
 
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.ppt
Videoguy
 
Prashant Resume
Prashant ResumePrashant Resume
Prashant Resume
Prashant Desai
 
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
 
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
 

Similar to 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
 
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...
 
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...
 
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) 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
 
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...
 

Recently uploaded

The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
OECD Directorate for Financial and Enterprise Affairs
 
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
OECD Directorate for Financial and Enterprise Affairs
 
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
OECD Directorate for Financial and Enterprise Affairs
 
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdfBRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
Robin Haunschild
 
Carrer goals.pptx and their importance in real life
Carrer goals.pptx  and their importance in real lifeCarrer goals.pptx  and their importance in real life
Carrer goals.pptx and their importance in real life
artemacademy2
 
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussionArtificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussionArtificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
SkillCertProExams
 
Gamify it until you make it Improving Agile Development and Operations with ...
Gamify it until you make it  Improving Agile Development and Operations with ...Gamify it until you make it  Improving Agile Development and Operations with ...
Gamify it until you make it Improving Agile Development and Operations with ...
Ben Linders
 
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
OECD Directorate for Financial and Enterprise Affairs
 
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
kekzed
 
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussionPro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
IEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdfIEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdf
Claudio Gallicchio
 
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussion
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussionPro-competitive Industrial Policy – LANE – June 2024 OECD discussion
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
OECD Directorate for Financial and Enterprise Affairs
 
Disaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other usesDisaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other uses
RIDHIMAGARG21
 
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
gpww3sf4
 
Proposal: The Ark Project and The BEEP Inc
Proposal: The Ark Project and The BEEP IncProposal: The Ark Project and The BEEP Inc
Proposal: The Ark Project and The BEEP Inc
Raheem Muhammad
 
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
 
Using-Presentation-Software-to-the-Fullf.pptx
Using-Presentation-Software-to-the-Fullf.pptxUsing-Presentation-Software-to-the-Fullf.pptx
Using-Presentation-Software-to-the-Fullf.pptx
kainatfatyma9
 

Recently uploaded (20)

The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
 
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
 
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
 
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdfBRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
 
Carrer goals.pptx and their importance in real life
Carrer goals.pptx  and their importance in real lifeCarrer goals.pptx  and their importance in real life
Carrer goals.pptx and their importance in real life
 
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussionArtificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
 
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussionArtificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
 
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
 
Gamify it until you make it Improving Agile Development and Operations with ...
Gamify it until you make it  Improving Agile Development and Operations with ...Gamify it until you make it  Improving Agile Development and Operations with ...
Gamify it until you make it Improving Agile Development and Operations with ...
 
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
 
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
怎么办理(lincoln学位证书)英国林肯大学毕业证文凭学位证书原版一模一样
 
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussionPro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
 
IEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdfIEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdf
 
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussion
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussionPro-competitive Industrial Policy – LANE – June 2024 OECD discussion
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussion
 
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
 
Disaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other usesDisaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other uses
 
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
 
Proposal: The Ark Project and The BEEP Inc
Proposal: The Ark Project and The BEEP IncProposal: The Ark Project and The BEEP Inc
Proposal: The Ark Project and The BEEP Inc
 
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
 
Using-Presentation-Software-to-the-Fullf.pptx
Using-Presentation-Software-to-the-Fullf.pptxUsing-Presentation-Software-to-the-Fullf.pptx
Using-Presentation-Software-to-the-Fullf.pptx
 

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