sergey-dryabzhinsky / nginx-rtmp-module

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

HLS Adaptative Bitrate (VOD HLS) #161

Open leleobhz opened 8 years ago

leleobhz commented 8 years ago

Hello,

Its possible to deploy with this module the HLS Adaptative Bitrate with automatic m3u8 generation?

Eg.;

#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1280000
http://example.com/low.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2560000
http://example.com/mid.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=7680000
http://example.com/hi.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=65000,CODECS="mp4a.40.5"
http://example.com/audio-only.m3u8

Thanks!

chriswiggins commented 8 years ago

Yes it is. See the HLS section in the wiki for the hls_variant information :-)

On 28/06/2016, at 1:49 AM, Leonardo Amaral notifications@github.com<mailto:notifications@github.com> wrote:

Hello,

Its possible to deploy with this module the HLS Adaptative Bitrate with automatic m3u8 generation?

Eg.;

EXTM3U

EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1280000

http://example.com/low.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2560000

http://example.com/mid.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=7680000

http://example.com/hi.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=65000,CODECS="mp4a.40.5"

http://example.com/audio-only.m3u8

Thanks!

You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/sergey-dryabzhinsky/nginx-rtmp-module/issues/161, or mute the threadhttps://github.com/notifications/unsubscribe/ACsxEZ0fzC__Rrl2N_vDBIT8vkEzBJCnks5qP9TWgaJpZM4I_HHu.

leleobhz commented 8 years ago

Hello!

Yes it is. See the HLS section in the wiki for the hls_variant information :-)

I did the following configuration in my server:

        application bb07 {
                access_log /var/log/nginx/rtmp/access_log_bb07;
                live on;
#               meta on;
#               publish_notify on;
#               drop_idle_publisher 10s;
#               play_restart on;
#               idle_streams off;

                hls on;
                hls_nested on;
                hls_path /tmp/bb07/hls;
                hls_playlist_length 120s;
                hls_continuous on;
                hls_fragment_naming system;
                hls_sync 100ms;

                dash on;
                dash_nested on;
                dash_playlist_length 120s;
                dash_path /tmp/bb07/dash;

                hls_variant _low BANDWIDTH=288000; # Low bitrate, sub-SD resolution
                hls_variant _mid BANDWIDTH=448000; # Medium bitrate, SD resolution
                hls_variant _high BANDWIDTH=1152000; # High bitrate, higher-than-SD resolution
                hls_variant _hd720 BANDWIDTH=2048000; # High bitrate, HD 720p resolution
                hls_variant _src BANDWIDTH=4096000; # Source bitrate, source resolution
        }

but /tmp/bb07/hls is like the following:

root@vSRV01:/tmp# tree /tmp/bb07/
/tmp/bb07/
├── dash
│   ├── bb07
│   │   ├── 0.m4a
│   │   ├── 0.m4v
│   │   ├── 6125.m4a
│   │   ├── 6125.m4v
│   │   ├── index.mpd
│   │   ├── init.m4a
│   │   ├── init.m4v
│   │   ├── raw.m4a
│   │   └── raw.m4v
│   ├── bb07_hd720
│   │   ├── 0.m4a
│   │   ├── 0.m4v
│   │   ├── index.mpd
│   │   ├── init.m4a
│   │   ├── init.m4v
│   │   ├── raw.m4a
│   │   └── raw.m4v
│   ├── bb07_high
│   │   ├── 0.m4a
│   │   ├── 0.m4v
│   │   ├── index.mpd
│   │   ├── init.m4a
│   │   ├── init.m4v
│   │   ├── raw.m4a
│   │   └── raw.m4v
│   ├── bb07_low
│   │   ├── 0.m4a
│   │   ├── 0.m4v
│   │   ├── index.mpd
│   │   ├── init.m4a
│   │   ├── init.m4v
│   │   ├── raw.m4a
│   │   └── raw.m4v
│   └── bb07_mid
│       ├── 0.m4a
│       ├── 0.m4v
│       ├── index.mpd
│       ├── init.m4a
│       ├── init.m4v
│       ├── raw.m4a
│       └── raw.m4v
└── hls
    ├── bb07
    │   ├── 1467043030523.ts
    │   ├── 1467043036374.ts
    │   ├── 1467043047810.ts
    │   └── index.m3u8
    ├── bb07_hd720
    │   ├── 1467043030685.ts
    │   ├── 1467043040318.ts
    │   └── index.m3u8
    ├── bb07_high
    │   ├── 1467043030655.ts
    │   ├── 1467043040294.ts
    │   └── index.m3u8
    ├── bb07_low
    │   ├── 1467043030616.ts
    │   ├── 1467043040267.ts
    │   └── index.m3u8
    ├── bb07.m3u8
    └── bb07_mid
        ├── 1467043030628.ts
        ├── 1467043040278.ts
        └── index.m3u8

12 directories, 54 files

For HLS is working (The nginx server could not create the file for permissions issues) but dash does not export the multi bitrate. What is needed to make dash also suport adaptative in the mpd?

Also, I see hls_variant need to specify bandwidth. This can be filled automatically based on stream bitrate?

Thanks!

chriswiggins commented 8 years ago

DASH doesn't have variable bitrate support yet as far as I know so it wont work for that.

I will look into being able to determine HLS bitrates automatically