SlideShare a Scribd company logo
MADRID · NOV 27-28 · 2015
Realtime video streaming
MADRID · NOV 27-28 · 2015
the opensource way
Iván Belmonte
MADRID · NOV 27-28 · 2015
Github: ibelmonte
Sysdivision
Twitter: @sysdivision
Website: http://sysdivision.com
Twitter: @ibelmonte
Iván Belmonte
MADRID · NOV 27-28 · 2015
Real time weather reporting system for outdoor sports.
2 main elements:
- HD cameras in surfing spots (beaches)
- Weather stations in surfing spots
GOAL:
Weather forecast typically fails. Spotfav gives you a
window to your spot, to check the weather conditions
before moving.
MADRID · NOV 27-28 · 2015
What forecast says the day before
MADRID · NOV 27-28 · 2015
What you expect when you take your car to go to the spot
MADRID · NOV 27-28 · 2015
What’s actually going on
MADRID · NOV 27-28 · 2015
IMPORTANT NOTE:
I’m a backend developer/sysadmin
I know nothing about video and audio processing
In this project I am A VICTIM
MADRID · NOV 27-28 · 2015
Video manipulation and transmission is complex
- Plenty of difficult concepts: encoding, muxing,
transcoding, encapsulation, bitrates, fps…
- Different media servers, different players, some codecs
may not be supported
- Several transmission protocols depending on your needs:
RTP, RTSP, RTMP, HLS, HDS, Shoutcast, HTML5…
Added complexity: LIVE streaming
MADRID · NOV 27-28 · 2015
Looking for a standard setup
Most common case: H264 over RTSP
Affiliates: get this if you want to get
connected to our network
MADRID · NOV 27-28 · 2015
There are several options
Commercial:
Adobe media server, Wowza, Flussonic, Flumotion…
SaaS:
Ustream, Justin.tv (defunct)…
Open source:
ffmpeg, ffserver, libav, Live555, Red5, crtmpd, vlc,
Erlyvideo…
MADRID · NOV 27-28 · 2015
OUR SCENARIO
1 Camera, H264 over RTSP
1. The goal
Embed the camera in a website and also in a smartphone app
2. Nice to have
Not permanently connected (connect on demand)
Tolerant to network cuts
3. Science fiction
Be able to filter by referral (avoid other websites to
embed our cameras)
MADRID · NOV 27-28 · 2015
STEP 1: WEB player (RTMP)
MADRID · NOV 27-28 · 2015
ROUND 1
A javascript serving a Directx (wtf?) script.
MADRID · NOV 27-28 · 2015
ROUND 1
Cons:
- The camera has a limited pool of connections available.
Visitors exceeding this poll get rejected.
Works?
- In some browsers
MADRID · NOV 27-28 · 2015
ROUND 2
A VLC cli process reading the RTSP, transcoding and
publishing an RTMP stream in a socket
MADRID · NOV 27-28 · 2015
ROUND 2
Works?
- YES…
MADRID · NOV 27-28 · 2015
ROUND 2
Works?
- YES… for 1 camera.
MADRID · NOV 27-28 · 2015
ROUND 2
Works?
- YES… for 1 camera.
What if more cameras?
- 1 VLC process for each camera.
MADRID · NOV 27-28 · 2015
ROUND 2
Round 2 version with multiple cameras
MADRID · NOV 27-28 · 2015
ROUND 2
Cons:
- A lot of processes in the server eating memory as hungry
animals.
- VLC is unable to recover from network cuts.
- Each VLC process opens a socket in a different port, which
in my case is a mess as I’m hosting the VLC processes inside
a container and then routing the outside in.
- VLC is permanently connected to the camera
MADRID · NOV 27-28 · 2015
AND THEN ONE DAY…
Adobe updates flash player, breaks my streamings
MADRID · NOV 27-28 · 2015
BROKEN STREAMING
Two possible reasons:
1. Something is wrong with my VLC command
vlc-wrapper	-vvv	h,p://camera.ip.address/cgi-bin/faststream.jpg?stream=full&fps=16&size=640x480&preview"	-sout	
	'#transcode{vcodec=FLV1,vb=800,ab=32,fps=16,width=640,height=480,acodec=none}:duplicate{dst=std{access=h,p{mime=video/x-
flv},mux=ffmpeg{mux=flv},dst=LINUX.BOX.IP.ADDRESS:8080/stream.flv},dst=display}'
2. Something is wrong with the new version of Flash
MADRID · NOV 27-28 · 2015
BROKEN STREAMING
Two possible reasons:
1. Something is wrong with my VLC command
vlc-wrapper	-vvv	h,p://camera.ip.address/cgi-bin/faststream.jpg?stream=full&fps=16&size=640x480&preview"	-sout	
	'#transcode{vcodec=FLV1,vb=800,ab=32,fps=16,width=640,height=480,acodec=none}:duplicate{dst=std{access=h,p{mime=video/x-
flv},mux=ffmpeg{mux=flv},dst=LINUX.BOX.IP.ADDRESS:8080/stream.flv},dst=display}'
2. Something is wrong with the new version of Flash
Of course option 2. I contacted Adobe:
- ME: your upgrade has a bug and it broke my streamings
- ADOBE: …(silence)
MADRID · NOV 27-28 · 2015
ROUND 3
A super cool media server capable to encapsulate H264 RSTP
into RTMP for flash players: Erlyvideo.
MADRID · NOV 27-28 · 2015
ROUND 3
Pros:
- Written in Erlang: amazingly light and fast
- Connects to the source on demand
- One process, several cameras
- Tolerant to network cuts (due to the previous point)
- Referrer filtering
Cons:
- Documented in russian (partially translated into
english). Support forums also 80% russian.
- HLS support (for smartphone apps) only supported in its
new commercial version: Flussonic.
MADRID · NOV 27-28 · 2015
STEP 2: Smartphone app (HLS)
MADRID · NOV 27-28 · 2015
Nginx RTMP module
An Nginx module capable to read streams in several formats
as input, store them and then serve them encapsulated in
other protocols (eg: HLS)
MADRID · NOV 27-28 · 2015
Nginx RTMP module
Works?
- YES, perfectly
Cons:
- Not very well documented
- Not tolerant to network cuts
- Unable to regain lost connectivity
MADRID · NOV 27-28 · 2015
Overall vision
MADRID · NOV 27-28 · 2015
Service schema
A video source. A separate server for each streaming
format. A website visitor and an smartphone user.
MADRID · NOV 27-28 · 2015
An automated process
Using linux containers and some glue code everything can
play together in an automated way
MADRID · NOV 27-28 · 2015
CONSLUSIONS
MADRID · NOV 27-28 · 2015
What I would do now if starting from scratch
1. Do it the opensource way: there are powerful tools
2. Look for a single solution for both web and mobile
(probably libav, ffmpeg or Red5)
3. Spend time looking for a solution capable to serve also
HTML5 formats (Mp4, Webm, Ogg)
MADRID · NOV 27-28 · 2015
THANK YOU!

More Related Content

PDF
Adrian Mouat - Microservice deployment techniques
PDF
Media Resource Sharing Through the Media Controller API
PDF
Using ssh as portal - The CMS CRAB over glideinWMS experience
PPTX
KEY
Nosql redis-mongo
PDF
Video Streaming
KEY
Erlang&rails
PDF
RTSP Protocol Analysis Of A Streaming Thorugh IPv6 Network
Adrian Mouat - Microservice deployment techniques
Media Resource Sharing Through the Media Controller API
Using ssh as portal - The CMS CRAB over glideinWMS experience
Nosql redis-mongo
Video Streaming
Erlang&rails
RTSP Protocol Analysis Of A Streaming Thorugh IPv6 Network

Viewers also liked (17)

DOC
Remote monitoring system
PDF
RTSP Streaming Server - Demo Streaming RTSP Protocol Over IPv6 Network
PPTX
2011_12_4K research in PSNC
PDF
FFMPEG TOOLS
KEY
Http streaming
PDF
Internationalization(i18n) of Web Page
PDF
Remote Management of Embedded Android Devices
PPT
FFMPEG on android
PDF
Streaming Media Server Setup Manual
PPT
Lecture Slides for Location based Services [Android]
PPT
PPTX
Operational Agriculture Monitoring System Using Remote Sensing
PDF
Location-Based Services on Android
DOCX
Location Tracking of Android Device Based on SMS.
PPTX
Internet of things for Smart Home
PDF
Smart Home technologies
PPTX
Smart homes
Remote monitoring system
RTSP Streaming Server - Demo Streaming RTSP Protocol Over IPv6 Network
2011_12_4K research in PSNC
FFMPEG TOOLS
Http streaming
Internationalization(i18n) of Web Page
Remote Management of Embedded Android Devices
FFMPEG on android
Streaming Media Server Setup Manual
Lecture Slides for Location based Services [Android]
Operational Agriculture Monitoring System Using Remote Sensing
Location-Based Services on Android
Location Tracking of Android Device Based on SMS.
Internet of things for Smart Home
Smart Home technologies
Smart homes
Ad

Similar to Realtime video streaming the open source way (20)

PPS
Moving Pictures - Web 2.0 Expo NYC
PPTX
Multimedia Streaming Architecture
PPTX
Media Content Delivery Systems
PDF
WebRTC Real time media P2P, Server, Infrastructure, and Platform
PDF
Mobile Smart Streaming
PDF
How to video.
PDF
Streaming with Varnish
PDF
Building your own simple live streaming platform. Slides form BOS video meetu...
PDF
Rebaca's Video Delivery Expertise Overview
PDF
Serverless Media Workflow
PDF
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
PDF
Frame accurate video client in the browser
PDF
WebRTC support in WebKitGTK and WPEWebKit with GStreamer: Status update
PDF
The Beginning - Jan 20 2009
PPTX
Video Transcoding with Raspberry Pi
PDF
20 Years of Streaming in 20 Minutes
PDF
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
PDF
FIWARE Tech Summit - Stream Processing with Kurento Media Server
PDF
Helix Universal Server v15
Moving Pictures - Web 2.0 Expo NYC
Multimedia Streaming Architecture
Media Content Delivery Systems
WebRTC Real time media P2P, Server, Infrastructure, and Platform
Mobile Smart Streaming
How to video.
Streaming with Varnish
Building your own simple live streaming platform. Slides form BOS video meetu...
Rebaca's Video Delivery Expertise Overview
Serverless Media Workflow
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
Frame accurate video client in the browser
WebRTC support in WebKitGTK and WPEWebKit with GStreamer: Status update
The Beginning - Jan 20 2009
Video Transcoding with Raspberry Pi
20 Years of Streaming in 20 Minutes
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Tech Summit - Stream Processing with Kurento Media Server
Helix Universal Server v15
Ad

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPT
Teaching material agriculture food technology
PDF
Modernizing your data center with Dell and AMD
PDF
Empathic Computing: Creating Shared Understanding
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
KodekX | Application Modernization Development
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
The AUB Centre for AI in Media Proposal.docx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Teaching material agriculture food technology
Modernizing your data center with Dell and AMD
Empathic Computing: Creating Shared Understanding
Advanced methodologies resolving dimensionality complications for autism neur...
Encapsulation_ Review paper, used for researhc scholars
Unlocking AI with Model Context Protocol (MCP)
Building Integrated photovoltaic BIPV_UPV.pdf
Machine learning based COVID-19 study performance prediction
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
NewMind AI Monthly Chronicles - July 2025
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Review of recent advances in non-invasive hemoglobin estimation
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Per capita expenditure prediction using model stacking based on satellite ima...
KodekX | Application Modernization Development
Understanding_Digital_Forensics_Presentation.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Spectral efficient network and resource selection model in 5G networks

Realtime video streaming the open source way

  • 1. MADRID · NOV 27-28 · 2015 Realtime video streaming MADRID · NOV 27-28 · 2015 the opensource way Iván Belmonte
  • 2. MADRID · NOV 27-28 · 2015 Github: ibelmonte Sysdivision Twitter: @sysdivision Website: http://sysdivision.com Twitter: @ibelmonte Iván Belmonte
  • 3. MADRID · NOV 27-28 · 2015 Real time weather reporting system for outdoor sports. 2 main elements: - HD cameras in surfing spots (beaches) - Weather stations in surfing spots GOAL: Weather forecast typically fails. Spotfav gives you a window to your spot, to check the weather conditions before moving.
  • 4. MADRID · NOV 27-28 · 2015 What forecast says the day before
  • 5. MADRID · NOV 27-28 · 2015 What you expect when you take your car to go to the spot
  • 6. MADRID · NOV 27-28 · 2015 What’s actually going on
  • 7. MADRID · NOV 27-28 · 2015 IMPORTANT NOTE: I’m a backend developer/sysadmin I know nothing about video and audio processing In this project I am A VICTIM
  • 8. MADRID · NOV 27-28 · 2015 Video manipulation and transmission is complex - Plenty of difficult concepts: encoding, muxing, transcoding, encapsulation, bitrates, fps… - Different media servers, different players, some codecs may not be supported - Several transmission protocols depending on your needs: RTP, RTSP, RTMP, HLS, HDS, Shoutcast, HTML5… Added complexity: LIVE streaming
  • 9. MADRID · NOV 27-28 · 2015 Looking for a standard setup Most common case: H264 over RTSP Affiliates: get this if you want to get connected to our network
  • 10. MADRID · NOV 27-28 · 2015 There are several options Commercial: Adobe media server, Wowza, Flussonic, Flumotion… SaaS: Ustream, Justin.tv (defunct)… Open source: ffmpeg, ffserver, libav, Live555, Red5, crtmpd, vlc, Erlyvideo…
  • 11. MADRID · NOV 27-28 · 2015 OUR SCENARIO 1 Camera, H264 over RTSP 1. The goal Embed the camera in a website and also in a smartphone app 2. Nice to have Not permanently connected (connect on demand) Tolerant to network cuts 3. Science fiction Be able to filter by referral (avoid other websites to embed our cameras)
  • 12. MADRID · NOV 27-28 · 2015 STEP 1: WEB player (RTMP)
  • 13. MADRID · NOV 27-28 · 2015 ROUND 1 A javascript serving a Directx (wtf?) script.
  • 14. MADRID · NOV 27-28 · 2015 ROUND 1 Cons: - The camera has a limited pool of connections available. Visitors exceeding this poll get rejected. Works? - In some browsers
  • 15. MADRID · NOV 27-28 · 2015 ROUND 2 A VLC cli process reading the RTSP, transcoding and publishing an RTMP stream in a socket
  • 16. MADRID · NOV 27-28 · 2015 ROUND 2 Works? - YES…
  • 17. MADRID · NOV 27-28 · 2015 ROUND 2 Works? - YES… for 1 camera.
  • 18. MADRID · NOV 27-28 · 2015 ROUND 2 Works? - YES… for 1 camera. What if more cameras? - 1 VLC process for each camera.
  • 19. MADRID · NOV 27-28 · 2015 ROUND 2 Round 2 version with multiple cameras
  • 20. MADRID · NOV 27-28 · 2015 ROUND 2 Cons: - A lot of processes in the server eating memory as hungry animals. - VLC is unable to recover from network cuts. - Each VLC process opens a socket in a different port, which in my case is a mess as I’m hosting the VLC processes inside a container and then routing the outside in. - VLC is permanently connected to the camera
  • 21. MADRID · NOV 27-28 · 2015 AND THEN ONE DAY… Adobe updates flash player, breaks my streamings
  • 22. MADRID · NOV 27-28 · 2015 BROKEN STREAMING Two possible reasons: 1. Something is wrong with my VLC command vlc-wrapper -vvv h,p://camera.ip.address/cgi-bin/faststream.jpg?stream=full&fps=16&size=640x480&preview" -sout '#transcode{vcodec=FLV1,vb=800,ab=32,fps=16,width=640,height=480,acodec=none}:duplicate{dst=std{access=h,p{mime=video/x- flv},mux=ffmpeg{mux=flv},dst=LINUX.BOX.IP.ADDRESS:8080/stream.flv},dst=display}' 2. Something is wrong with the new version of Flash
  • 23. MADRID · NOV 27-28 · 2015 BROKEN STREAMING Two possible reasons: 1. Something is wrong with my VLC command vlc-wrapper -vvv h,p://camera.ip.address/cgi-bin/faststream.jpg?stream=full&fps=16&size=640x480&preview" -sout '#transcode{vcodec=FLV1,vb=800,ab=32,fps=16,width=640,height=480,acodec=none}:duplicate{dst=std{access=h,p{mime=video/x- flv},mux=ffmpeg{mux=flv},dst=LINUX.BOX.IP.ADDRESS:8080/stream.flv},dst=display}' 2. Something is wrong with the new version of Flash Of course option 2. I contacted Adobe: - ME: your upgrade has a bug and it broke my streamings - ADOBE: …(silence)
  • 24. MADRID · NOV 27-28 · 2015 ROUND 3 A super cool media server capable to encapsulate H264 RSTP into RTMP for flash players: Erlyvideo.
  • 25. MADRID · NOV 27-28 · 2015 ROUND 3 Pros: - Written in Erlang: amazingly light and fast - Connects to the source on demand - One process, several cameras - Tolerant to network cuts (due to the previous point) - Referrer filtering Cons: - Documented in russian (partially translated into english). Support forums also 80% russian. - HLS support (for smartphone apps) only supported in its new commercial version: Flussonic.
  • 26. MADRID · NOV 27-28 · 2015 STEP 2: Smartphone app (HLS)
  • 27. MADRID · NOV 27-28 · 2015 Nginx RTMP module An Nginx module capable to read streams in several formats as input, store them and then serve them encapsulated in other protocols (eg: HLS)
  • 28. MADRID · NOV 27-28 · 2015 Nginx RTMP module Works? - YES, perfectly Cons: - Not very well documented - Not tolerant to network cuts - Unable to regain lost connectivity
  • 29. MADRID · NOV 27-28 · 2015 Overall vision
  • 30. MADRID · NOV 27-28 · 2015 Service schema A video source. A separate server for each streaming format. A website visitor and an smartphone user.
  • 31. MADRID · NOV 27-28 · 2015 An automated process Using linux containers and some glue code everything can play together in an automated way
  • 32. MADRID · NOV 27-28 · 2015 CONSLUSIONS
  • 33. MADRID · NOV 27-28 · 2015 What I would do now if starting from scratch 1. Do it the opensource way: there are powerful tools 2. Look for a single solution for both web and mobile (probably libav, ffmpeg or Red5) 3. Spend time looking for a solution capable to serve also HTML5 formats (Mp4, Webm, Ogg)
  • 34. MADRID · NOV 27-28 · 2015 THANK YOU!