flavioribeiro / nginx-audio-track-for-hls-module

:sound: Nginx module that generates audio track for HTTP Live Streaming (HLS) streams on the fly.
GNU General Public License v3.0
136 stars 17 forks source link

Nginx 1.12.2 Compilation Error #31

Open fabiobergamo opened 6 years ago

fabiobergamo commented 6 years ago

good afternoon, I'm having trouble compiling the module, lua-nginx-module / nginx-audio-track-for-hls-module I am using Centos7, when giving the ./configure command and adding the path I get this message

configuring additional modules adding module in / root / nginx-rtmp-vlc

ngx_rtmp_module was configured adding module in /root/lua-nginx-module-0.10.12rc2 checking for Lua library ... not found checking for Lua library in / usr / local / ... not found checking for Lua library in / usr / local / ... not found checking for Lua library in / usr / pkg / ... not found checking for Lua library in / opt / local / ... not found checking for Lua library in / usr / local / * / lua51 / ... not found checking for Lua library in / usr / ... not found checking for LuaJIT library in / usr / local / ... found checking for export symbols by default (-E) ... found checking for export symbols by default (--export-all-symbols) ... not found found for SO_PASSCRED ... found found for attribute (constructor) ... found found for malloc_trim ... found ngx_http_lua_module was configured adding module in / root / nginx-audio-track-for-hls-module ngx_http_aac_module was configured found for PCRE library ... found found for PCRE JIT support ... found found for openSSL library found found for zlib library found creating objs / Makefile with the make command -o objs / addon / nginx-audio-track-for-hls-module / ngx_http_aac_module. /root/nginx-audio-track-for-hls-module/ngx_http_aac_module.c /root/nginx-audio-track-for-hls-module/ngx_http_aac_module.c: In function ângx_http_aac_extract_audioâ: /root/nginx-audio-track-for-hls-module/ngx_http_aac_module.c:210:5: error: âavcodec_copy_contextâ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:4098) [-Werror = deprecated-declarations] avcodec_copy_context (output_audio_stream-> codec, input_audio_stream-> codec); ^ /root/nginx-audio-track-for-hls-module/ngx_http_aac_module.c:210:5: error: âcodecâ is deprecated (declared at /usr/local/include/libavformat/avformat.h:876) [-Werror = deprecated-declarations] /root/nginx-audio-track-for-hls-module/ngx_http_aac_module.c:210:5: error: âcodecâ is deprecated (declared at /usr/local/include/libavformat/avformat.h:876) [-Werror = deprecated-declarations] /root/nginx-audio-track-for-hls-module/ngx_http_aac_module.c:223:13: error: âav_free_packetâ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:4336) [-Werror = deprecated-declarations] av_free_packet (& new_packet); ^ /root/nginx-audio-track-for-hls-module/ngx_http_aac_module.c:225:9: error: âav_free_packetâ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:4336) [-Werror = deprecated-declarations] av_free_packet (& packet); ^ /root/nginx-audio-track-for-hls-module/ngx_http_aac_module.c:211:26: error: ignoring return value of âavformat_write_headerâ, declared with attribute warn_unused_result [-Werror = unused-result] avformat_write_header (output_format_context, NULL); ^ cc1: all warnings being treated as errors make [1]: [objs / addon / nginx-audio-track-for-hls-module / ngx_http_aac_module.o] Error 1 make [1]: Exiting the directory `/root/nginx-1.13.8 ' make: [build] Error 2

Any solution for avodec obsolete?

fabiobergamo commented 6 years ago

Hello friends, i was able to compile nginx with the audio_track module, but now I get this error when adding the settings in my .conf file - "nginx: [error] aac module: output format must be defined in /usr/local/nginx/conf/nginx.conf:66"

how to fix this problem? thank you

flavioribeiro commented 6 years ago

you need to add this to your nginx.conf:

    ngx_hls_audio_track_output_format "adts";
    ngx_hls_audio_track_output_header "audio/aac";
flavioribeiro commented 6 years ago

tell us if it works, if so, please close this issue!

fabiobergamo commented 6 years ago

Thanks for your help! My nginx continues to generate .ts files my conf

location ~ -audio\.m3u8$ {
            default_type application/vnd.apple.mpegurl;
            content_by_lua '
            local base_m3u8_url = ngx.var.uri:gsub("-audio.m3u8", ".m3u8")
            local res = ngx.location.capture(base_m3u8_url)
            local new_body = res.body:gsub("\.ts", "-audio.aac")
            ngx.print(new_body)
            ';
            }

            location ~ (-audio\.aac)$ {
             rewrite ^(.*)-audio\.ts$ /$1.aac break;
             ngx_hls_audio_track;
             ngx_hls_audio_track_rootpath "/tmp/hls";
             ngx_hls_audio_track_output_format "adts";
             ngx_hls_audio_track_output_header "audio/aac";

            expires 10m;
            }

thank you!

fabiobergamo commented 6 years ago

my complete .conf file ----------------------------------------->

user root; worker_processes auto;

pid logs/nginx.pid;

events { worker_connections 1024; }

rtmp { server { listen 1935; chunk_size 4000;

 application radio1 {
     live on;
 exec on;
 allow publish 10.1.1.190;
 exec_pull /usr/bin/ffmpeg -i http://10.1.1.190:8000/playlist  -f flv rtmp://10.1.1.190/radio1/playlist;
 exec_push /usr/bin/ffmpeg -i rtmp://10.1.1.190/radio1/playlist -vn -c:a libfdk_aac -ab 128k -f flv -rtmp_live live rtmp://10.1.1.190:1935/hls/playlist;

}

 application radio2 {
     live on;
 exec on;
     allow publish 10.1.1.190;
 exec_pull /usr/bin/ffmpeg -i http://10.1.1.190:8000/blink182  -f flv rtmp://10.1.1.190/radio2/blink182;
     exec_push /usr/bin/ffmpeg -i rtmp://10.1.1.190/radio2/blink182 -vn -c:a libfdk_aac -ab 128k -f flv -rtmp_live live rtmp://10.1.1.190:1935/hls/blink182;

}

 application radio3 {
     live on;
 exec on;
     allow publish 10.1.1.190;
     exec_pull /usr/bin/ffmpeg -i http://10.1.1.190:8000/rock  -f flv rtmp://10.1.1.190/radio3/rock;
     exec_push /usr/bin/ffmpeg -i rtmp://10.1.1.190/radio3/rock -vn -c:a libfdk_aac -ab 128k -f flv -rtmp_live live rtmp://10.1.1.190:1935/hls/rock;

}

     application hls {
 live on;
 hls on;
 hls_path /tmp/hls;
 hls_fragment 10;
 hls_playlist_length 60;
 hls_continuous off;

} } } http {

include       mime.types;
default_type  application/octet-stream;

keepalive_timeout  65;

include /usr/local/nginx/sites-enabled/*.conf;
server_names_hash_bucket_size 64;

gzip_vary on;

server {
    listen       8080;
    server_name _ 10.1.1.190; 
chunked_transfer_encoding on;   

     location /hls {

 add_header 'Access-Control-Allow-Origin' "*";
     add_header Access-Control-Expose-Headers "Date";

 types {
        application/vnd.apple.mpegurl m3u8;
        video/mp2t ts;
    }     

    location ~ -audio\.m3u8$ {
        default_type application/vnd.apple.mpegurl;
        content_by_lua '
        local base_m3u8_url = ngx.var.uri:gsub("-audio.m3u8", ".m3u8")
        local res = ngx.location.capture(base_m3u8_url)
        local new_body = res.body:gsub("\.ts", "-audio.ts")
        ngx.print(new_body)
        ';
    }

    location ~ (-audio\.ts)$ {
    rewrite ^(.*)-audio\.ts$ /$1.aac break;

        ngx_hls_audio_track;
        ngx_hls_audio_track_rootpath "/tmp/hls";
        ngx_hls_audio_track_output_format "adts";
    ngx_hls_audio_track_output_header "audio/aac";

    expires 10m;
    }

        root /tmp;
        add_header Cache-Control no-cache;
        }

    location /crossdomain.xml {
        alias /usr/local/nginx/html/crossdomain.xml;
    }   

    location /stat.xsl {
        root /root/nginx-rtmp-vlc/;
    }

    location / {
        root  /usr/local/nginx/html;
        index index.php index.html index.htm;
}

    error_page  404              /404.html;

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/local/nginx/html;
    }

    location ~ \.php$ {
        proxy_pass   http://127.0.0.1;
    }

location ~ \.php$ {
    root /usr/local/nginx/html;
include fastcgi.conf;
try_files $uri =404;
    fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
} 

    location ~ /\.ht {
        deny  all;

}
}
} ------------------------------------------->

the .ts file does not play in my VLC PLAYER, analyzing the messages I get 'ts error: libdvbpsi error (PSI decoder): TS discontinuity (received 0, expected 15) for PID 0 ts error: libdvbpsi error (PSI decoder): TS discontinuity (received 0, expected 15) for PID 4095 '

fabiobergamo commented 6 years ago

Can someone help me with my problem ?!