
Scalable Live Video Streaming Using NGINX and MPEG-DASH/HLS - slederer
https://www.nginx.com/blog/scalable-live-video-streaming-nginx-plus-bitmovin/
======
vhiremath4
"but for ease of reading we refer to NGINX Plus throughout"

Uhuh. Suuuure. :p

~~~
bcryptd
I also would hesitate to call it "Live" without showing how to adjust for GOP
sizes, key frames, B and I frames, etc.

------
bcryptd
The one thing I've always wanted from nginx-rtmp was the ability to pull from
a source input instead of running a separate process with ffmpeg to push the
stream over. If they could get that working my life would become less
complicated quickly.

~~~
jc4p
yeah I use nginx-rtmp for local video capturing (basically the functionality
of a mirror) and the lag that needing to re-encode + chunk + starting off at
the beginning of the chunks in the playlist introduces is meh. I think I'm
going to transition my project over to WebRTC though, since the mobile device
I'm using to display the video can handle that now.

~~~
rawnlq
iOS still doesn't support webrtc...

~~~
jc4p
Neither does a lot of Android! Luckily the product I'm using uses
[https://crosswalk-project.org/](https://crosswalk-project.org/) \-- that
sounded like an ad!

------
alexcroox
I wish there was a decent HTML5 low latency (< 2s) solution. Nothing comes
close to RTMP + Flash still.

~~~
dmm
The scalability of DASH/HLS comes from the fact that the video segments are
just static files sitting on a http server so they can be cached and
distributed with the many techniques for serving static files over http.

If you don't need the scalability of DASH/HLS you can use the WebRTC apis for
low latency streaming, usually <1s. WebRTC can be used for client-server
applications just as easily as peer-to-peer using a gateway like Janus[1].

[1] [https://janus.conf.meetecho.com/](https://janus.conf.meetecho.com/)

~~~
alexcroox
Yer I've looked into WebRTC before but the browser support isn't good enough
yet :(

~~~
dmm
What browser doesn't support WebRTC but does support flash/RTMP ?

~~~
alexcroox
Internet Explorer 9, 10, 11...

------
aleksanb
The setup seems rather similar to [https://github.com/arut/nginx-rtmp-
module](https://github.com/arut/nginx-rtmp-module) which I've used in the
past. Perhaps they've bundled it with Nginx Plus without crediting the
original authors? The project has a bit too permissive license for my taste.

~~~
benwilber0
Roman Arutyunyan is (or was previously) an engineer at nginx when he developed
nginx-rtmp.

[https://www.youtube.com/watch?v=1boJWioxsWc](https://www.youtube.com/watch?v=1boJWioxsWc)

~~~
gshulegaard
I work at Nginx, although not on the core development team, and to the best of
my knowledge Roman Arutyunyan is still an engineer with us.

------
callmeed
This looks cool. I'm very interested in live video but can someone enlighten
me on the creation side of this equation?

How do I create an RTMP stream in the first place?

What camera can/should I use? Can I use webcam? Is there an iOS app that can
do it?

What hardware/software is needed to create this RTMP stream that I'll be
pushing to nginx?

~~~
dylz
ffmpeg, vlc, OBS Studio (this one is probably easiest; you can just add an
image or add a webcam source etc then configure a rtmp url to push to)

~~~
ericcholis
Wirecast from Telestream is a good paid option as well.

~~~
jacquesm
Wowza is another one. It scales very well.

------
nickysielicki
Lots of people in here commenting about nginx plus, but can anyone recommend a
free alternative to BITMOVIN?

~~~
corobo
I had the same wonder and through some digging found videojs-contrib-dash[1]
which uses dash.js, referenced on the bitmovin site[2]. I'm going to give this
a go and see what does and doesn't work.

[1] [https://github.com/videojs/videojs-contrib-
dash](https://github.com/videojs/videojs-contrib-dash)

[2] [https://bitmovin.com/mpeg-dash-open-source-player-
tools/](https://bitmovin.com/mpeg-dash-open-source-player-tools/)

------
jordanbaucke
Anyone have any insight on RTMP + HLS / MPEG-DASH -> WebRTC? Ala www.beam.pro
(what they call FTL)?

------
NEDM64
Is there a way to mux subtitles written on the fly?

For example, I want to mux a subtitle stream, with the real time clock in it,
into a video stream.

~~~
kalimoxto
ffmpeg can do that fairly easily. To adjust the command in the example, you
need to to take the srt file and pass it as a second -i input file. There's
some helpful guides on how to do that if you search around.

e.g.
[https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/s...](https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/subtitle_options)

~~~
NEDM64
But I don't have a subtitles file. I would need it to read from a stream, not
a static file.

~~~
nitrogen
Try having it read from a fifo instead.

~~~
NEDM64
But how? I've searched the documentation.

------
mountaineer22
How does this compare to Wowza?

~~~
bcryptd
It's not running on Java so it should be faster with the same hardware.

~~~
jacquesm
There may be a lot to complain about with Java but it is _insanely_ efficient
when it comes to serving data out a network port. Wowza will scale well beyond
most companies' needs, I've used their stuff for years and it is the one
program that convinced me that Java actually can be very efficient for
applications like these.

------
kasparsklavins
Working on a similar product but using peer to peer live video streaming.
Since the data does not touch the server, there are no scaling problems.

~~~
slederer
There are a couple of cool P2P companies out there like
[http://www.streamroot.io/](http://www.streamroot.io/) or
[https://www.peer5.com/](https://www.peer5.com/)

------
newman314
FYI. The rtmp module broke recently with the recent nginx 1.11.0 release.

------
excalibur
I thought this project was shut down.

[http://www.coderag.com/hooli-lays-off-hundreds-of-
employees-...](http://www.coderag.com/hooli-lays-off-hundreds-of-employees-
dissolves-entire-nucleus-division/)

