sergey-dryabzhinsky / nginx-rtmp-module

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

HE-AAC SBR breakup when using audio only stream #52

Open andrew867 opened 8 years ago

andrew867 commented 8 years ago

I'd like to let you know that your branch of nginx-rtmp-module has the same issue as arut's original version. I'm actually using your version when testing this issue.

The gist of it is that when using an audio only stream with HE-AAC from libfdk_aac there's SBR breakup when the player transitions between TS files. When using libaacplus this doesn't happen. The only difference I can see is that nginx-rtmp-module's status screen recognizes libfdk_aac's stream as HE-AAC but recognizes libaacplus's stream as LC-AAC.

There's some more information over here: https://github.com/arut/nginx-rtmp-module/issues/521

andrew867 commented 8 years ago

As I mentioned above in the other issue (https://github.com/arut/nginx-rtmp-module/issues/521) when looking at the MPEG TS that is created from the rtmp-module, it is not formed correctly for an audio only source. The best option for this is to scrap the static TS remuxing code (as it contains a bunch of byte arrays for the TS file headers and other data) and use libav functions (https://github.com/libav/libav/blob/master/libavformat/mpegts.c) or ffmpeg to do it right and create a proper stream.

matiaspl commented 8 years ago

The libav muxer wasn't too efficient in creating HLS ready segments when nginx-rtmp was kicking off (a lot of muxing overhead compared to nginx-rtmp). At some point somebody pointed that out on the ffmpeg mailing lists, but I'm not sure if this issue was addressed in the end.

2015-12-29 5:12 GMT+01:00 andrew867 notifications@github.com:

As I mentioned above in the other issue (arut#521 https://github.com/arut/nginx-rtmp-module/issues/521) when looking at the MPEG TS that is created from the rtmp-module, it is not formed correctly for an audio only source. The best option for this is to scrap the static TS remuxing code (as it contains a bunch of byte arrays for the TS file headers and other data) and use libav functions ( https://github.com/libav/libav/blob/master/libavformat/mpegts.c) or ffmpeg to do it right and create a proper stream.

— Reply to this email directly or view it on GitHub https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/issues/52#issuecomment-167715502 .

andrew867 commented 8 years ago

I lack the programming knowledge to make any changes to nginx-rtmp but this might be of interest to someone else. I haven't tried it yet but ffmpeg should be able to create a live HLS stream:

http://stackoverflow.com/questions/27227175/ffmpeg-http-live-streaming-remove-old-segments

matiaspl commented 8 years ago

If you look at the commits of the original nginx-rtmp from around 2012/13, this was the way to go before Andrei wrote the native muxer. Wiki suggested running a similar script on on_publish event.

2015-12-29 21:20 GMT+01:00 andrew867 notifications@github.com:

I lack the programming knowledge to make any changes to nginx-rtmp but this might be of interest to someone else. I haven't tried it yet but ffmpeg should be able to create a live HLS stream:

http://stackoverflow.com/questions/27227175/ffmpeg-http-live-streaming-remove-old-segments

— Reply to this email directly or view it on GitHub https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/issues/52#issuecomment-167868703 .

chriswiggins commented 8 years ago

Hey @andrew867 - This should be fixed in the latest master branch (specifically with PR #106)

Give it a go and let me know how you get on?

andrew867 commented 8 years ago

@chriswiggins Looks like it's working now, have a listen to a test stream here: http://aliant.ath.cx:8088/hls/movie.m3u8

It's a re-encoding of a local radio station's MP3 Shoutcast stream. The ffmpeg command I'm using is: ffmpeg -loglevel verbose -re -i http://209.95.50.189:8025/ -vn -c:a libfdk_aac -movflags +faststart -profile:a aac_he_v2 -f flv rtmp://localhost:1935/hls/movie

andrew867 commented 8 years ago

@chriswiggins Looks like the stream does not work properly on my iPhone 5s iOS 9.3.1, do you have any iDevices to try it out on?

andrew867 commented 8 years ago

I ran Apple Media Stream Validator and it returned this:

andrew$ mediastreamvalidator -V http://aliant.ath.cx:8088/hls/movie.m3u8
mediastreamvalidator: Beta Version 1.1(151117)

[/hls/movie.m3u8] Started root playlist download
[/hls/movie.m3u8] Started media playlist download
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 20977  Size: 74824 bytes Duration: 9.9850 sec Bitrate: 7493.6405
[/hls/movie.m3u8] SequenceNum: 20978  Size: 74636 bytes Duration: 9.9850 sec Bitrate: 7474.8122
[/hls/movie.m3u8] SequenceNum: 20979  Size: 74448 bytes Duration: 9.9850 sec Bitrate: 7455.9840
[/hls/movie.m3u8] SequenceNum: 20980  Size: 74072 bytes Duration: 9.9850 sec Bitrate: 7418.3275
[/hls/movie.m3u8] SequenceNum: 20981  Size: 74636 bytes Duration: 9.9840 sec Bitrate: 7475.5609
[/hls/movie.m3u8] SequenceNum: 20982  Size: 74636 bytes Duration: 9.9840 sec Bitrate: 7475.5609
[/hls/movie.m3u8] SequenceNum: 20983  Size: 74824 bytes Duration: 9.9840 sec Bitrate: 7494.3910
[/hls/movie.m3u8] SequenceNum: 20984  Size: 74824 bytes Duration: 9.9840 sec Bitrate: 7494.3910
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 20985  Size: 74636 bytes Duration: 9.9840 sec Bitrate: 7475.5609
[/hls/movie.m3u8] SequenceNum: 20986  Size: 74448 bytes Duration: 9.9840 sec Bitrate: 7456.7308
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 20987  Size: 74824 bytes Duration: 9.9840 sec Bitrate: 7494.3910
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 20988  Size: 74824 bytes Duration: 9.9840 sec Bitrate: 7494.3910
[/hls/movie.m3u8] SequenceNum: 20989  Size: 74636 bytes Duration: 9.9840 sec Bitrate: 7475.5609
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 20990  Size: 74636 bytes Duration: 9.9840 sec Bitrate: 7475.5609
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 20991  Size: 74824 bytes Duration: 9.9840 sec Bitrate: 7494.3910
[/hls/movie.m3u8] SequenceNum: 20992  Size: 74824 bytes Duration: 9.9840 sec Bitrate: 7494.3910
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 20993  Size: 74636 bytes Duration: 9.9840 sec Bitrate: 7475.5609
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 20994  Size: 74824 bytes Duration: 9.9840 sec Bitrate: 7494.3910
[/hls/movie.m3u8] SequenceNum: 20995  Size: 74824 bytes Duration: 9.9840 sec Bitrate: 7494.3910
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 20996  Size: 74824 bytes Duration: 9.9840 sec Bitrate: 7494.3910
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 20997  Size: 74824 bytes Duration: 9.9840 sec Bitrate: 7494.3910
[/hls/movie.m3u8] SequenceNum: 20998  Size: 74636 bytes Duration: 9.9840 sec Bitrate: 7475.5609
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 20999  Size: 74824 bytes Duration: 9.9840 sec Bitrate: 7494.3910
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 21000  Size: 74824 bytes Duration: 9.9840 sec Bitrate: 7494.3910
[/hls/movie.m3u8] SequenceNum: 21001  Size: 74824 bytes Duration: 9.9850 sec Bitrate: 7493.6405
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 21002  Size: 74636 bytes Duration: 9.9850 sec Bitrate: 7474.8122
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 21003  Size: 74824 bytes Duration: 9.9850 sec Bitrate: 7493.6405
[/hls/movie.m3u8] SequenceNum: 21004  Size: 74824 bytes Duration: 9.9850 sec Bitrate: 7493.6405
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 21005  Size: 74824 bytes Duration: 9.9850 sec Bitrate: 7493.6405
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 21006  Size: 74824 bytes Duration: 9.9850 sec Bitrate: 7493.6405
[/hls/movie.m3u8] SequenceNum: 21007  Size: 74824 bytes Duration: 9.9850 sec Bitrate: 7493.6405
[/hls/movie.m3u8] parsed media segment count: 30, duration: 309.515
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 21008  Size: 74824 bytes Duration: 9.9850 sec Bitrate: 7493.6405
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 21009  Size: 74824 bytes Duration: 9.9850 sec Bitrate: 7493.6405
[/hls/movie.m3u8] SequenceNum: 21010  Size: 74824 bytes Duration: 9.9850 sec Bitrate: 7493.6405
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 21011  Size: 74824 bytes Duration: 9.9850 sec Bitrate: 7493.6405
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch
[/hls/movie.m3u8] Received media playlist response
[/hls/movie.m3u8] SequenceNum: 21012  Size: 74824 bytes Duration: 9.9850 sec Bitrate: 7493.6405
[/hls/movie.m3u8] SequenceNum: 21013  Size: 74824 bytes Duration: 9.9850 sec Bitrate: 7493.6405
[/hls/movie.m3u8] All media files delivered, waiting until next playlist fetch

--------------------------------------------------------------------------------
http://aliant.ath.cx:8088/hls/movie.m3u8
--------------------------------------------------------------------------------
Processed 37 out of 37 segments
Average segment duration: 9.984358
Total segment bitrates (all discontinuties): average: 59.88 kb/s, max: 59.96 kb/s

Discontinuity: sequence: 1, parsed segment count: 1 of 1, duration: 9.985 sec, average: 59.80 kb/s, max: 59.80 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 2, parsed segment count: 1 of 1, duration: 9.985 sec, average: 59.65 kb/s, max: 59.65 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 3, parsed segment count: 1 of 1, duration: 9.985 sec, average: 59.35 kb/s, max: 59.35 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 4, parsed segment count: 1 of 1, duration: 9.985 sec, average: 59.80 kb/s, max: 59.80 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 5, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.80 kb/s, max: 59.80 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 6, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.96 kb/s, max: 59.96 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 7, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.96 kb/s, max: 59.96 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 8, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.80 kb/s, max: 59.80 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 9, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.65 kb/s, max: 59.65 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 10, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.96 kb/s, max: 59.96 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 11, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.96 kb/s, max: 59.96 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 12, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.80 kb/s, max: 59.80 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 13, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.80 kb/s, max: 59.80 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 14, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.96 kb/s, max: 59.96 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 15, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.96 kb/s, max: 59.96 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 16, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.80 kb/s, max: 59.80 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 17, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.96 kb/s, max: 59.96 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 18, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.96 kb/s, max: 59.96 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 19, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.96 kb/s, max: 59.96 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 20, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.96 kb/s, max: 59.96 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 21, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.80 kb/s, max: 59.80 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 22, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.96 kb/s, max: 59.96 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 23, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.96 kb/s, max: 59.96 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 24, parsed segment count: 1 of 1, duration: 9.984 sec, average: 59.95 kb/s, max: 59.95 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 25, parsed segment count: 1 of 1, duration: 9.985 sec, average: 59.80 kb/s, max: 59.80 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 26, parsed segment count: 1 of 1, duration: 9.985 sec, average: 59.95 kb/s, max: 59.95 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 27, parsed segment count: 1 of 1, duration: 9.985 sec, average: 59.95 kb/s, max: 59.95 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 28, parsed segment count: 1 of 1, duration: 9.985 sec, average: 59.95 kb/s, max: 59.95 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 29, parsed segment count: 1 of 1, duration: 9.985 sec, average: 59.95 kb/s, max: 59.95 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 30, parsed segment count: 1 of 1, duration: 9.985 sec, average: 59.95 kb/s, max: 59.95 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 31, parsed segment count: 1 of 1, duration: 9.985 sec, average: 59.95 kb/s, max: 59.95 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 32, parsed segment count: 1 of 1, duration: 9.985 sec, average: 59.95 kb/s, max: 59.95 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 33, parsed segment count: 1 of 1, duration: 9.985 sec, average: 59.95 kb/s, max: 59.95 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 34, parsed segment count: 1 of 1, duration: 9.985 sec, average: 59.95 kb/s, max: 59.95 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 35, parsed segment count: 1 of 1, duration: 9.985 sec, average: 59.95 kb/s, max: 59.95 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 36, parsed segment count: 1 of 1, duration: 9.985 sec, average: 59.95 kb/s, max: 59.95 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)

Discontinuity: sequence: 37, parsed segment count: 1 of 1, duration: 9.985 sec, average: 0.00 kb/s, max: 0.00 kb/s
Track ID: 1
Audio Codec: AAC-HEv2
Audio sample rate: 44100 Hz
Audio channel layout: Stereo (L R)
andrew867 commented 8 years ago

So I've been playing around with other RTMP servers that can remux to HLS and figured out it may be an issue with using a ffmpeg source and remuxing to MPEG-TS based on waiting for keyframes.

Using the following SRS config and ffmpeg command line it works fine, but if I turn the hls_wait_keyframe option off it causes SBR breakup in the same way as nginx-rtmp-module.

ffmpeg -loglevel verbose -re -i http://209.95.50.189:8025/ -vn -c:a libfdk_aac -profile:a aac_he_v2 -b:a 48k -f flv rtmp://localhost:1935/hls/coast

SRS config:

listen              1935;
max_connections     1000;
vhost __defaultVhost__ {
    hls {
        enabled         on;
        hls_fragment    10;
        hls_window      60;
        hls_path        /home/streaminghls;
        hls_m3u8_file   [app]/[stream].m3u8;
        hls_ts_file     [app]/[stream]-[seq].ts;
        hls_wait_keyframe       off;
    }
}

nginx-rtmp-module config:

        application hls {
            live on;
            hls on;
            hls_fragment 10s;
            hls_playlist_length 2m;
            hls_fragment_slicing plain;
            hls_path /home/hls;
        }

Test stream on SRS: http://104.233.127.242/hls/coast.m3u8

Test stream on nginx-rtmp-module: http://aliant.ath.cx:8088/hls/coast.m3u8

chriswiggins commented 8 years ago

Can you try wait_video on; in RTMP config?

On 14/06/2016, at 3:14 AM, andrew867 notifications@github.com<mailto:notifications@github.com> wrote:

So I've been playing around with other RTMP servers that can remux to HLS and figured out it may be an issue with using a ffmpeg source and remuxing to MPEG-TS based on waiting for keyframes.

Using the following SRS config and ffmpeg command line it works fine, but if I turn the hls_wait_keyframe option off it causes SBR breakup in the same way as nginx-rtmp-module.

ffmpeg -loglevel verbose -re -i http://209.95.50.189:8025/ -vn -c:a libfdk_aac -profile:a aac_he_v2 -b:a 48k -f flv rtmp://localhost:1935/hls/coast

SRS config:

listen 1935; max_connections 1000; vhost defaultVhost { hls { enabled on; hls_fragment 10; hls_window 60; hls_path /home/streaminghls; hls_m3u8_file [app]/[stream].m3u8; hls_ts_file [app]/[stream]-[seq].ts; hls_wait_keyframe off; } }

nginx-rtmp-module config:

    application hls {
        live on;
        hls on;
        hls_fragment 10s;
        hls_playlist_length 2m;
        hls_fragment_slicing plain;
        hls_path /home/hls;
    }

Test stream on SRS: http://104.233.127.242/hls/coast.m3u8

Test stream on nginx-rtmp-module: http://aliant.ath.cx:8088/hls/coast.m3u8

You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/sergey-dryabzhinsky/nginx-rtmp-module/issues/52#issuecomment-225611749, or mute the threadhttps://github.com/notifications/unsubscribe/ACsxER1C7tDK1ko7nQB8WXkz-peRlZ50ks5qLXO-gaJpZM4GnKpZ.

andrew867 commented 8 years ago

wait_video on; on the HLS application doesn't seem to make a difference.