arut / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
13.39k stars 3.51k forks source link

RTMP Adaptive Bitrate Streaming - has anyone done it? #1231

Open djevo1 opened 6 years ago

djevo1 commented 6 years ago

It is my understanding that rtmp supports the ability to stream using adaptive bitrates. Has anyone attempted this using the nginx rtmp modules. it is pretty straightforward with hls, where you can define each stream using an hls_variant directive, but not so much for rtmp.

pblvrt commented 6 years ago

Its not possible to use adaptive bitrate with RTMP. There are various technical reasons for this not being possible, but for me even attempting this is out of the question.

RTMP video playback is not supported by most browsers since it depends on flash.

On the other hand hls is widely supported both for on desktop and on mobile, and it easy to implement both on the server side and on the client side.

Why do you want to attempt creating an adaptive bitrate rtmp stream?

lieff commented 6 years ago

It's possible. On streaming side I use:

    int n = 0;
    ioctl(socket, TIOCOUTQ, &n);

to obtain streamer socket fullness and detect TCP stalls. When socket fullness near to zero then there no network problems and some logic tries to increase bit-rate. When socket fullness is growing - logic decides to decrease bit-rate. It works very well on linux, android, ios, macos. I do not know how to do it on windows though.