nginx-hls-module
nginx-hls-module copied to clipboard
ios compatibility
some mp4 do not play well on iOS:
http://124.207.162.208:5678/hntv.m3u8
the origin mp4 can download at here: http://124.207.162.208:5678/hntv.mp4
Original mp4 is broken.
vlc hntv.mp4 -v
[0x7faf70c01768] ts demux error: MPEG-4 descriptor not found
[0x7faf70001128] filesystem access warning: unimplemented query 4097 in control
[0x7faf70e36698] avcodec decoder warning: waiting for extra data for codec MPEG AAC Audio
...
[0x7faf70c849c8] avcodec decoder warning: disabling direct rendering
[0x7faf7c001ce8] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 300 ms)
[0x7faf7c001ce8] main input error: ES_OUT_RESET_PCR called
[0x6c3118] main audio output warning: playback way too early (-981656): playing silence
[0x7faf7c001ce8] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 650 ms)
[0x7faf7c001ce8] main input error: ES_OUT_RESET_PCR called
[0x6c3118] main audio output warning: playback way too early (-976443): playing silence
my output:
$ vlc hntv.mp4 -v
VLC media player 2.1.4 Rincewind (revision 2.1.4-0-g2a072be)
[0xa0148f8] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[0xa0b5648] qt4 interface error: Unable to load extensions module
[0xb6a03030] mp4 demux warning: elst box found
[0xb6a03030] mp4 demux warning: CTTS table
[0xb6a03030] mp4 demux warning: elst box found
[0xb6a03030] mp4 demux warning: elst old=0 new=1
[0xb6a03030] mp4 demux warning: elst old=0 new=1
Fontconfig warning: FcPattern object size does not accept value "0"
[0xa08a468] alsa audio output warning: device cannot be paused
Fontconfig warning: FcPattern object size does not accept value "0"
Fontconfig warning: FcPattern object size does not accept value "0"
Fontconfig warning: FcPattern object size does not accept value "0"
[0xb11f3f30] avcodec decoder warning: disabling direct rendering
[0xa0acad0] main vout display error: Failed to resize display
[0xa0acad0] main vout display error: Failed to resize display
du -b /opt/nginx-streaming/html/hntv.mp4
204354631 /opt/nginx-streaming/html/hntv.mp4
@rounce
you may redownload the mp4 file.
and here is a smaller file: http://124.207.162.208:5678/j2.m3u8 http://124.207.162.208:5678/j2.mp4
I have fixed this bug. The problem is "Duplicate AUD nal unit problem".
Apple ipad doesn't play for now , you have posted a hotfix?
newestbie , i download your branch https://github.com/newestbie/nginx-hls-module , but when compile have issue In file included from /usr/local/nginx/nginx-hls-module-master/src/ngx_http_streaming_module.c:14:0: /usr/local/nginx/nginx-hls-module-master/src/output_ts.h:25:22: fatal error: redefine.h: No such file or directory compilation terminated. make[1]: *** [objs/addon/src/ngx_http_streaming_module.o] Error 1 make[1]: Leaving directory `/usr/local/nginx/nginx-1.7.5' make: *** [build] Error 2
i comment //#include "redefine.h" compile success, but stil does't work on apple devices ... can you please help us :)
@arty777 this issue has nothing to do with the fixes that newestbie made. It has been there since the beginning, and is easy to fix. The problem is in Mime type. This module does not send the mime type header for m3u8 by itself, so your browser on IOS doesn't know how to handle the m3u8 I was able to solve that by compiling in the "headers_more" module for NGINX, and add the header "Content-Type: application/vnd.apple.mpegurl" to the m3u8 location. After that it runs fine, even with the older "not fixed" versions of this module.
nginx conf include mime.types by default: inside of mime.types application/vnd.apple.mpegurl m3u8; Thus, the default nginx configuration already provides the required Content-Type
In theory it does, but when you check the m3u8 location for your module with curl, you will find out that the content type header is missing.
I guess it has to do with the m3u8 not being a real file but is generated on the fly.
The only way I could solve that (and it works fine so no problems there) is to force-include the header at the m3u8 location.
without 3-rd part module "headers_more"
location /hdd0/{ add_header Content-Type application/vnd.apple.mpegurl; ....
curl -I http://192.168.88.2:81/hdd0/video/long.m3u8
HTTP/1.1 200 OK Server: nginx Date: Thu, 25 Sep 2014 08:40:24 GMT Content-Length: 60987 Last-Modified: Wed, 02 Apr 2014 03:07:00 GMT Connection: close mod_hls: version=0.9 Content-Type: application/vnd.apple.mpegurl
without "add_header Content-Type application/vnd.apple.mpegurl;"
curl -I http://192.168.88.2:81/hdd0/video/long.m3u8 HTTP/1.1 200 OK Server: nginx Date: Thu, 25 Sep 2014 08:41:51 GMT Content-Length: 60987 Last-Modified: Wed, 02 Apr 2014 03:07:00 GMT Connection: close mod_hls: version=0.9
You're right headers_more is not required, my mistake. I had to use it for other custom headers and used it for this header as well but you can do without, like you did.
Your post however clearly shows what I meant ;) So including the Content-type header is for sure the solution.
rounce , bug with last (today) commit /ssd/web/nginx/nginx-hls-module-master/src/ngx_http_streaming_module.c /ssd/web/nginx/nginx-hls-module-master/src/ngx_http_streaming_module.c: In function ‘ngx_streaming_handler’: /ssd/web/nginx/nginx-hls-module-master/src/ngx_http_streaming_module.c:184:38: error: pointer targets in assignment differ in signedness [-Werror=pointer-sign] cc1: all warnings being treated as errors make[1]: *** [objs/addon/src/ngx_http_streaming_module.o] Error 1 make[1]: Leaving directory `/ssd/web/nginx/nginx-1.7.5' make: *** [build] Error 2
Nice, location /hdd0/ { #add_header Content-Type application/vnd.apple.mpegurl; ...
root@strana:/usr/local/nginx/work/nginx1# curl -I http://192.168.88.2:81/hdd0/video/long.m3u8 HTTP/1.1 200 OK Server: nginx Date: Thu, 25 Sep 2014 10:55:17 GMT Content-Type: application/vnd.apple.mpegurl Content-Length: 60987 Last-Modified: Wed, 02 Apr 2014 03:07:00 GMT Connection: close mod_hls: version=0.9
work and compile fine , but still does't work on apple device , can anyone please test from apple device , any video from https://vkino.net , thank you
When access from ipad i see this in log access 192.168.88.107 - - [25/Sep/2014:19:36:29 +0300] "GET /hdd0/video/long.m3u8 HTTP/1.1" 200 60987 "-" "AppleCoreMedia/1.0.0.10A407 (iPad; U; CPU OS 6_0 like Mac OS X; ru_ru)" "-" 192.168.88.107 - - [25/Sep/2014:19:36:29 +0300] "GET /hdd0/video/long.m3u8 HTTP/1.1" 200 60987 "-" "AppleCoreMedia/1.0.0.10A407 (iPad; U; CPU OS 6_0 like Mac OS X; ru_ru)" "-" 192.168.88.107 - - [25/Sep/2014:19:36:29 +0300] "GET /hdd0/video/long.m3u8 HTTP/1.1" 200 60987 "-" "AppleCoreMedia/1.0.0.10A407 (iPad; U; CPU OS 6_0 like Mac OS X; ru_ru)" "-" 192.168.88.107 - - [25/Sep/2014:19:36:29 +0300] "GET /hdd0/video/long.m3u8 HTTP/1.1" 200 60987 "-" "AppleCoreMedia/1.0.0.10A407 (iPad; U; CPU OS 6_0 like Mac OS X; ru_ru)" "-" 192.168.88.107 - - [25/Sep/2014:19:36:29 +0300] "GET /hdd0/video/long.m3u8 HTTP/1.1" 200 60987 "-" "AppleCoreMedia/1.0.0.10A407 (iPad; U; CPU OS 6_0 like Mac OS X; ru_ru)" "-"
error log /nginx1/log# tail -f ./error.log |grep -i error 2014/09/25 19:36:29 [debug] 20787#0: accept mutex lock failed: 1 2014/09/25 19:36:29 [debug] 20787#0: epoll del event: fd:6 op:2 ev:00000000 2014/09/25 19:36:29 [debug] 20787#0: epoll timer: 500 2014/09/25 19:36:29 [debug] 20787#0: epoll: fd:11 ev:2011 d:00007F9BD65981B0 2014/09/25 19:36:29 [debug] 20787#0: epoll_wait() error on fd:11 ev:2011 2014/09/25 19:36:29 [debug] 20788#0: epoll_wait() error on fd:8 ev:2011 2014/09/25 19:36:29 [debug] 20788#0: epoll_wait() error on fd:8 ev:2011 2014/09/25 19:36:29 [debug] 20788#0: epoll_wait() error on fd:13 ev:2011 2014/09/25 19:36:29 [debug] 20788#0: epoll_wait() error on fd:8 ev:2011 2014/09/25 19:36:29 [debug] 20788#0: epoll_wait() error on fd:8 ev:2011
and wideo doesn't work on ipad , can you please help
try to open up the direct m3u8 link in Safari on a Mac (not in another browser and not on a PC!) If that runs your video it shows you at least that the m3u8 module is working fine. On the website you link to all video is shown in a Flash player so if that is the only way to show it, it will never run on an Apple device, since IOS devices do not support Flash and will never run the player, let alone the video. You need to use a player application that is at least multi platform and has support for both native HTML5 (to support IOS, Android and probably some more devices or browsers out there) and fall back to flash when HTML 5 is not supported. That is the only way to get it running on all devices. Google is your friend, there are many of these around. Last but not least, also make sure you have no crossdomain issues. These are also very common when serving m3u8 and videofiles from different locations or embedded in portal sites. Depending on what CDN is used (or even your own CDN) these can mostly be easlily fixed.
@arty777
I forgot comment out #include "redefine.h"
Can you play this url? http://125.39.67.194/j.m3u8
@thevideoxpress @rounce
my issue is not MIME issue.
http://125.39.67.194:81/j.m3u8
made by rounce's original code. it can not play well on iOS.
you can download the mp4 file at here: http://125.39.67.194:81/j.mp4
The mp4 file was copied from a flv file using "ffmpeg -a copy". The issue look like DTS/PTS problem, but it isn't.
@thevideoxpress , ofcourse i try from safari on ipad , and doesn't play, site vkino.net can understand if you come with apple device , and if it's tru - use htm5 player. @newestbie , i try http://125.39.67.194:81/j.m3u8 direct play from ipad , i see 1-st screen , and after have continius "download" not play ...
new news :)
directly (.m3u8) work, after i change hls_length 1; on hls_length 10;
but in the same time i have this error on error.log on debug mode: 2014/09/28 21:57:15 [debug] 29990#0: epoll_wait() error on fd:6 ev:2015 2014/09/28 21:57:15 [debug] 29990#0: epoll_wait() error on fd:6 ev:2015 2014/09/28 21:57:16 [debug] 29990#0: epoll_wait() error on fd:6 ev:2015 2014/09/28 21:57:18 [debug] 29990#0: epoll_wait() error on fd:6 ev:2015 2014/09/28 21:57:19 [debug] 29990#0: epoll_wait() error on fd:6 ev:2011 2014/09/28 21:57:20 [debug] 29990#0: epoll_wait() error on fd:6 ev:2011 2014/09/28 21:57:20 [debug] 29989#0: epoll_wait() error on fd:10 ev:2019
please close issue , all files play on apple ios fine .
@arty777
http://125.39.67.194:81/j.m3u8
does this url play on apple ios fine?
@newestbie , i see only black screen , but maybe this a connectivity issue ... or something else
all video from https://vkino.net work fine from iPad ! (hls module work)