sergey-dryabzhinsky / nginx-rtmp-module

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

Creating multiple playlist from same live stream #183

Open nitinbhadauria opened 8 years ago

nitinbhadauria commented 8 years ago

Hello Everyone,

I am trying to convert the same live stream into portable and landscape resolutions (which i am able to do with below ffmpeg command) and create different playlist for both. which partially works.

Problem is both playlist have reference for all resolutions. Some one else tried to do so ?

Configuration

exec ffmpeg -i rtmp://127.0.0.1:1935/$app/$name -async 1 -vsync -1 -filter_complex '[0:v]split=5[m1][m2][m3][m4][tmp]; [tmp]crop=in_w-320:in_h[crp];[crp]split=3[c1][c2][c3]' \
  -map '[m1]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 284x160 -b:v 120k -maxrate 120k -bufsize 120k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_160p \
  -map '[m2]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 426x240 -b:v 320k -maxrate 320k -bufsize 320k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_240p \
  -map '[m3]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 640x360 -b:v 650k -maxrate 650k -bufsize 650k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_360p \
  -map '[m4]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 1280x720 -b:v 2550k -maxrate 2550k -bufsize 2550k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_720p \
  -map '[c1]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 160x284 -b:v 120k -maxrate 120k -bufsize 120k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_p_284p \
  -map '[c2]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 240x426 -b:v 320k -maxrate 320k -bufsize 320k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_p_426p \
  -map '[c3]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 360x640 -b:v 650k -maxrate 650k -bufsize 650k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_p_640p ;

HLS Folder

root@ip-172-31-38-215:~# ls -ltr /mnt/live/ total 36 drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_240p drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_160p -rw-r--r-- 1 nobody nogroup 806 Sep 5 11:17 test_p.m3u8 drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_p_640p drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_p_426p drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_p_284p -rw-r--r-- 1 nobody nogroup 792 Sep 5 11:17 test.m3u8 drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_720p drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_360p

Playlist for portable

root@ip-172-31-38-215:~# cat /mnt/live/test_p.m3u8

EXTM3U

EXT-X-VERSION:3

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=123488,RESOLUTION=284x160

test_p_160p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=234368,RESOLUTION=426x240

test_p_240p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=577088,RESOLUTION=640x360

test_p_360p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=2048000,RESOLUTION=1280x720

test_p_720p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=234368,RESOLUTION=426x240

test_p_284p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=577088,RESOLUTION=640x360

test_p_426p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=2048000,RESOLUTION=1280x720

test_p_640p/index.m3u8

Playlist for Landscap

root@ip-172-31-38-215:~# cat /mnt/live/test.m3u8

EXTM3U

EXT-X-VERSION:3

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=123488,RESOLUTION=284x160

test_160p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=234368,RESOLUTION=426x240

test_240p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=577088,RESOLUTION=640x360

test_360p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=2048000,RESOLUTION=1280x720

test_720p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=234368,RESOLUTION=426x240

test_284p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=577088,RESOLUTION=640x360

test_426p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=2048000,RESOLUTION=1280x720

chriswiggins commented 8 years ago

What does your nginx.conf file look like? The playlists being generated like this is actually desirable for some instances, as it allows the device to automatically choose different playlists based on available bandwidth

Sent from my iPhone

On 6/09/2016, at 12:19 AM, nitinbhadauria notifications@github.com<mailto:notifications@github.com> wrote:

Hello Everyone,

I am trying to convert the same live stream into portable and landscape resolutions (which i am able to do with below ffmpeg command) and create different playlist for both. which partially works.

Problem is both playlist have reference for all resolutions. Some one else tried to do so ?

Configuration

exec ffmpeg -i rtmp://127.0.0.1:1935/$app/$name -async 1 -vsync -1 -filter_complex '[0:v]split=5[m1][m2][m3][m4][tmp]; [tmp]crop=in_w-320:in_h[crp];[crp]split=3[c1][c2][c3]' \ -map '[m1]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 284x160 -b:v 120k -maxrate 120k -bufsize 120k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_160p \ -map '[m2]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 426x240 -b:v 320k -maxrate 320k -bufsize 320k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_240p \ -map '[m3]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 640x360 -b:v 650k -maxrate 650k -bufsize 650k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_360p \ -map '[m4]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 1280x720 -b:v 2550k -maxrate 2550k -bufsize 2550k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_720p \ -map '[c1]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 160x284 -b:v 120k -maxrate 120k -bufsize 120k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_p_284p \ -map '[c2]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 240x426 -b:v 320k -maxrate 320k -bufsize 320k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_p_426p \ -map '[c3]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 360x640 -b:v 650k -maxrate 650k -bufsize 650k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_p_640p ;

HLS Folder

root@ip-172-31-38-215:~# ls -ltr /mnt/live/ total 36 drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_240p drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_160p -rw-r--r-- 1 nobody nogroup 806 Sep 5 11:17 test_p.m3u8 drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_p_640p drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_p_426p drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_p_284p -rw-r--r-- 1 nobody nogroup 792 Sep 5 11:17 test.m3u8 drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_720p drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_360p

Playlist for portable

root@ip-172-31-38-215:~# cat /mnt/live/test_p.m3u8

EXTM3U

EXT-X-VERSION:3

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=123488,RESOLUTION=284x160

test_p_160p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=234368,RESOLUTION=426x240

test_p_240p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=577088,RESOLUTION=640x360

test_p_360p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=2048000,RESOLUTION=1280x720

test_p_720p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=234368,RESOLUTION=426x240

test_p_284p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=577088,RESOLUTION=640x360

test_p_426p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=2048000,RESOLUTION=1280x720

test_p_640p/index.m3u8

Playlist for Landscap

root@ip-172-31-38-215:~# cat /mnt/live/test.m3u8

EXTM3U

EXT-X-VERSION:3

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=123488,RESOLUTION=284x160

test_160p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=234368,RESOLUTION=426x240

test_240p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=577088,RESOLUTION=640x360

test_360p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=2048000,RESOLUTION=1280x720

test_720p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=234368,RESOLUTION=426x240

test_284p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=577088,RESOLUTION=640x360

test_426p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,BANDWIDTH=2048000,RESOLUTION=1280x720

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/183, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACsxEZHleZO_2zy9rwAVjtst1csc0plgks5qnAjjgaJpZM4J1BQ0.

matiaspl commented 8 years ago

They look as they should to me too. If you want a particular single quality playlist use the ones referenced in the master playlists.

Matt

5 wrz 2016 20:30 "Chris Wiggins" notifications@github.com napisał(a):

What does your nginx.conf file look like? The playlists being generated like this is actually desirable for some instances, as it allows the device to automatically choose different playlists based on available bandwidth

Sent from my iPhone

On 6/09/2016, at 12:19 AM, nitinbhadauria <notifications@github.com< mailto:notifications@github.com>> wrote:

Hello Everyone,

I am trying to convert the same live stream into portable and landscape resolutions (which i am able to do with below ffmpeg command) and create different playlist for both. which partially works.

Problem is both playlist have reference for all resolutions. Some one else tried to do so ?

Configuration

exec ffmpeg -i rtmp://127.0.0.1:1935/$app/$name -async 1 -vsync -1 -filter_complex '[0:v]split=5[m1][m2][m3][m4][tmp]; [tmp]crop=in_w-320:in_h[crp];[crp]split=3[c1][c2][c3]' \ -map '[m1]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 284x160 -b:v 120k -maxrate 120k -bufsize 120k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_160p \ -map '[m2]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 426x240 -b:v 320k -maxrate 320k -bufsize 320k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_240p \ -map '[m3]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 640x360 -b:v 650k -maxrate 650k -bufsize 650k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_360p \ -map '[m4]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 1280x720 -b:v 2550k -maxrate 2550k -bufsize 2550k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_720p \ -map '[c1]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 160x284 -b:v 120k -maxrate 120k -bufsize 120k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_p_284p \ -map '[c2]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 240x426 -b:v 320k -maxrate 320k -bufsize 320k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_p_426p \ -map '[c3]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 360x640 -b:v 650k -maxrate 650k -bufsize 650k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_p_640p ;

HLS Folder

root@ip-172-31-38-215:~# ls -ltr /mnt/live/ total 36 drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_240p drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_160p -rw-r--r-- 1 nobody nogroup 806 Sep 5 11:17 test_p.m3u8 drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_p_640p drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_p_426p drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_p_284p -rw-r--r-- 1 nobody nogroup 792 Sep 5 11:17 test.m3u8 drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_720p drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_360p

Playlist for portable

root@ip-172-31-38-215:~# cat /mnt/live/test_p.m3u8

EXTM3U

EXT-X-VERSION:3

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=123488,RESOLUTION=284x160 test_p_160p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=234368,RESOLUTION=426x240 test_p_240p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=577088,RESOLUTION=640x360 test_p_360p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=2048000,RESOLUTION=1280x720 test_p_720p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=234368,RESOLUTION=426x240 test_p_284p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=577088,RESOLUTION=640x360 test_p_426p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=2048000,RESOLUTION=1280x720 test_p_640p/index.m3u8

Playlist for Landscap

root@ip-172-31-38-215:~# cat /mnt/live/test.m3u8

EXTM3U

EXT-X-VERSION:3

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=123488,RESOLUTION=284x160 test_160p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=234368,RESOLUTION=426x240 test_240p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=577088,RESOLUTION=640x360 test_360p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=2048000,RESOLUTION=1280x720 test_720p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=234368,RESOLUTION=426x240 test_284p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=577088,RESOLUTION=640x360 test_426p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=2048000,RESOLUTION=1280x720

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/183, or mute the thread< https://github.com/notifications/unsubscribe-auth/ACsxEZHleZO_ 2zy9rwAVjtst1csc0plgks5qnAjjgaJpZM4J1BQ0>.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/issues/183#issuecomment-244796565, or mute the thread https://github.com/notifications/unsubscribe-auth/AB049sDy7DshMmIfHOb4fJL7qgcXkyBFks5qnF_NgaJpZM4J1BQ0 .

nitinbhadauria commented 8 years ago

It has generated 2 playlists, test.m3u8 and test_p.m3u8 as desired.

But I want _p once in _p.m3u8 and rest in other.

What I am doing here is making 2 adaptive playlists, one for viewers in landscape mode and other in portrait.

If I keep all aspect ratio in same playlist landscape viewer might see portrait depending on network bandwidth.

This is how I tried to do it.

For test.m3u8 hls_variant _160p BANDWIDTH=288000; hls_variant _360p BANDWIDTH=1228000;

For test_p hls_variant _p_248p BANDWIDTH=288000; hls_variant _p_426p BANDWIDTH=1228000;

Nitin B.

Sent from my iPhone

On 06-Sep-2016, at 12:06 AM, Mateusz Starzak notifications@github.com wrote:

They look as they should to me too. If you want a particular single quality playlist use the ones referenced in the master playlists.

Matt

5 wrz 2016 20:30 "Chris Wiggins" notifications@github.com napisał(a):

What does your nginx.conf file look like? The playlists being generated like this is actually desirable for some instances, as it allows the device to automatically choose different playlists based on available bandwidth

Sent from my iPhone

On 6/09/2016, at 12:19 AM, nitinbhadauria <notifications@github.com< mailto:notifications@github.com>> wrote:

Hello Everyone,

I am trying to convert the same live stream into portable and landscape resolutions (which i am able to do with below ffmpeg command) and create different playlist for both. which partially works.

Problem is both playlist have reference for all resolutions. Some one else tried to do so ?

Configuration

exec ffmpeg -i rtmp://127.0.0.1:1935/$app/$name -async 1 -vsync -1 -filter_complex '[0:v]split=5[m1][m2][m3][m4][tmp]; [tmp]crop=in_w-320:in_h[crp];[crp]split=3[c1][c2][c3]' \ -map '[m1]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 284x160 -b:v 120k -maxrate 120k -bufsize 120k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_160p \ -map '[m2]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 426x240 -b:v 320k -maxrate 320k -bufsize 320k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_240p \ -map '[m3]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 640x360 -b:v 650k -maxrate 650k -bufsize 650k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_360p \ -map '[m4]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 1280x720 -b:v 2550k -maxrate 2550k -bufsize 2550k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_720p \ -map '[c1]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 160x284 -b:v 120k -maxrate 120k -bufsize 120k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_p_284p \ -map '[c2]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 240x426 -b:v 320k -maxrate 320k -bufsize 320k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_p_426p \ -map '[c3]' -acodec copy -c:v libx264 -c:a aac -preset veryfast -profile:v baseline -vsync cfr -s 360x640 -b:v 650k -maxrate 650k -bufsize 650k -threads 0 -r 30 -f flv rtmp://127.0.0.1:1935/live/$name_p_640p ;

HLS Folder

root@ip-172-31-38-215:~# ls -ltr /mnt/live/ total 36 drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_240p drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_160p -rw-r--r-- 1 nobody nogroup 806 Sep 5 11:17 test_p.m3u8 drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_p_640p drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_p_426p drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_p_284p -rw-r--r-- 1 nobody nogroup 792 Sep 5 11:17 test.m3u8 drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_720p drwxr--r-- 2 nobody nogroup 4096 Sep 5 11:17 test_360p

Playlist for portable

root@ip-172-31-38-215:~# cat /mnt/live/test_p.m3u8

EXTM3U

EXT-X-VERSION:3

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=123488,RESOLUTION=284x160 test_p_160p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=234368,RESOLUTION=426x240 test_p_240p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=577088,RESOLUTION=640x360 test_p_360p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=2048000,RESOLUTION=1280x720 test_p_720p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=234368,RESOLUTION=426x240 test_p_284p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=577088,RESOLUTION=640x360 test_p_426p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=2048000,RESOLUTION=1280x720 test_p_640p/index.m3u8

Playlist for Landscap

root@ip-172-31-38-215:~# cat /mnt/live/test.m3u8

EXTM3U

EXT-X-VERSION:3

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=123488,RESOLUTION=284x160 test_160p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=234368,RESOLUTION=426x240 test_240p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=577088,RESOLUTION=640x360 test_360p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=2048000,RESOLUTION=1280x720 test_720p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=234368,RESOLUTION=426x240 test_284p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=577088,RESOLUTION=640x360 test_426p/index.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,CLOSED-CAPTIONS=NONE,

BANDWIDTH=2048000,RESOLUTION=1280x720

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/183, or mute the thread< https://github.com/notifications/unsubscribe-auth/ACsxEZHleZO_ 2zy9rwAVjtst1csc0plgks5qnAjjgaJpZM4J1BQ0>.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/issues/183#issuecomment-244796565, or mute the thread https://github.com/notifications/unsubscribe-auth/AB049sDy7DshMmIfHOb4fJL7qgcXkyBFks5qnF_NgaJpZM4J1BQ0 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

matiaspl commented 8 years ago

Ok, now I get your point. I don't remeber how the compare function in hls module works, but try not using _ as a separator in names of the streams. I.e. use $name-p_462p and $name_360p. I recall the same thing happened to me a while ago and I think this was the solution.

Matt

matiaspl commented 8 years ago

Oh, and check if you don't have any missing colons, they can lead to weird results too.

Matt

2016-09-05 22:04 GMT+02:00 Mateusz Starzak mstarzak@gmail.com:

Ok, now I get your point. I don't remeber how the compare function in hls module works, but try not using _ as a separator in names of the streams. I.e. use $name-p_462p and $name_360p. I recall the same thing happened to me a while ago and I think this was the solution.

Matt

nitinbhadauria commented 8 years ago

just to update, both of them didn't help.

This is my config from nginx

# Instruct clients to adjust resolution according to bandwidth
hls_variant _240p BANDWIDTH=234368,RESOLUTION=426x240;
hls_variant _360p BANDWIDTH=577088,RESOLUTION=640x360;
hls_variant _720p BANDWIDTH=2048000,RESOLUTION=1280x720;

# Instruct clients to adjust resolution according to bandwidth
hls_variant _284p BANDWIDTH=234368,RESOLUTION=160x284;
hls_variant _426p BANDWIDTH=577088,RESOLUTION=240x426;
hls_variant _640p BANDWIDTH=2048000,RESOLUTION=360x640;
matiaspl commented 8 years ago

I think with your config nginx has no way to tell the difference between your portrait and landscape variants. The easiest way would be to add a second appplication, send all portrait streams there and set hls_variant in both applications accordingly so that they don't mix. On the other hand you can leave things as they are and make your master playlist creation script and run it for example with exec_publish as we did it in the 'old days' when nginx-rtmp didn't have its' hls module and multibitrate segmentation was done through ffmpeg.

Matt

nitinbhadauria commented 8 years ago

yes, i am creating different application's for all them.

But i will still try the exec_publish option. if you have any reference where i can start.

Also, is it possible to find the aspect ratio of source and run the ffmpeg command according.