首页 > 其他分享 >angie vod_module 试用

angie vod_module 试用

时间:2023-11-02 17:24:49浏览次数:38  
标签:vod load http modules module so angie

因为angie 已经内置了不少方便的模块(包含了vod 模块),vod 对于视频的处理是一个很常用的模块(m3u8 播放)主要进行下测试

环境准备

基于docker-compose 部署,核心是配置

  • vod 配置
    主要包含了核心配置以及特定协议支持配置angie 为了与nginx 不一样,使用了不同的名称
  • angie.conf
 
# package: angie-module-auth-jwt
#load_module modules/ngx_http_auth_jwt_module.so;
 
# package: angie-module-auth-spnego
#load_module modules/ngx_http_auth_spnego_module.so;
 
# package: angie-module-brotli
#load_module modules/ngx_http_brotli_filter_module.so;
#load_module modules/ngx_http_brotli_static_module.so;
 
# package: angie-module-cache-purge
#load_module modules/ngx_http_cache_purge_module.so;
 
# package: angie-module-dav-ext
#load_module modules/ngx_http_dav_ext_module.so;
 
# package: angie-module-echo
#load_module modules/ngx_http_echo_module.so;
 
# package: angie-module-enhanced-memcached
#load_module modules/ngx_http_enhanced_memcached_module.so;
 
# package: angie-module-eval
#load_module modules/ngx_http_eval_module.so;
 
# package: angie-module-geoip2
#load_module modules/ngx_http_geoip2_module.so;
#load_module modules/ngx_stream_geoip2_module.so;
 
# package: angie-module-headers-more
#load_module modules/ngx_http_headers_more_filter_module.so;
 
# package: angie-module-image-filter
#load_module modules/ngx_http_image_filter_module.so;
 
# package: angie-module-keyval
#load_module modules/ngx_http_keyval_module.so;
 
# package: angie-module-lua
#load_module modules/ngx_http_lua_module.so;
#load_module modules/ngx_stream_lua_module.so;
 
# package: angie-module-ndk
#load_module modules/ndk_http_module.so;
 
# package: angie-module-njs
#load_module modules/ngx_http_js_module.so;
#load_module modules/ngx_stream_js_module.so;
 
# package: angie-module-perl
#load_module modules/ngx_http_perl_module.so;
 
# package: angie-module-redis2
#load_module modules/ngx_http_redis2_module.so;
 
# package: angie-module-rtmp
#load_module modules/ngx_rtmp_module.so;
 
# package: angie-module-set-misc
#load_module modules/ngx_http_set_misc_module.so;
 
# package: angie-module-subs
#load_module modules/ngx_http_subs_filter_module.so;
 
# package: angie-module-upload
#load_module modules/ngx_http_upload_module.so;
 
# package: angie-module-vod
load_module modules/ngx_http_vod_module.so;
 
# package: angie-module-xslt
#load_module modules/ngx_http_xslt_filter_module.so;
 
user  angie;
worker_processes  auto;
worker_rlimit_nofile 65536;
 
error_log  /var/log/angie/error.log notice;
 
events {
    worker_connections  65536;
}
   
http {
    include       /etc/angie/mime.types;
    default_type  application/octet-stream;
 
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
 
    log_format extended '$remote_addr - $remote_user [$time_local] "$request" '
                        '$status $body_bytes_sent "$http_referer" rt="$request_time" '
                        '"$http_user_agent" "$http_x_forwarded_for" '
                        'h="$host" sn="$server_name" ru="$request_uri" u="$uri" '
                        'ucs="$upstream_cache_status" ua="$upstream_addr" us="$upstream_status" '
                        'uct="$upstream_connect_time" urt="$upstream_response_time"';
 
    access_log  /var/log/angie/access.log  main;
 
    sendfile        on;
    #tcp_nopush     on;
 
    keepalive_timeout  65;
    vod_mode                           local;
    vod_metadata_cache                 metadata_cache 16m;
    vod_response_cache                 response_cache 512m;
    vod_last_modified_types            *;
    vod_segment_duration               9000;
    vod_align_segments_to_key_frames   on;
    vod_dash_fragment_file_name_prefix "segment";
    vod_hls_segment_file_name_prefix   "segment";
 
    vod_manifest_segment_durations_mode accurate;
 
    open_file_cache          max=1000 inactive=5m;
    open_file_cache_valid    2m;
    open_file_cache_min_uses 1;
    open_file_cache_errors   on;
    #gzip  on;
 
    include /etc/angie/http.d/*.conf;
}
 
#stream {
#    include /etc/angie/stream.d/*.conf;
#}
  • default.conf
    特定站点开启hls 支持
 
server {
    listen       80;
    server_name  localhost;
 
    #access_log  /var/log/angie/host.access.log  main;
 
    location / {
        root   /usr/share/angie/html;
        index  index.html index.htm;
    }
 
    location /status/ {
        api     /status/;
        allow   127.0.0.1;
        deny    all;
    }
 
    #error_page  404              /404.html;
 
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/angie/html;
    }
    location /hls/ {
            vod hls;
            alias /opt/static/videos/;
            add_header Access-Control-Allow-Headers '*';
            add_header Access-Control-Allow-Origin '*';
            add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
    }   
 
    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}
 
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}
 
    # deny access to .htaccess files, if Apache's document root
    # concurs with angie's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}
  • web site 直接支持hls 播放
    基于了hls video 库
    index.html
 
<html>
  <head>
    <title>angie vod module learning </title>
  </head>
 
  <body>
    <script src="hls.js"></script>
 
    <center>
      <h1> angie vod module learning </h1>
      <video height="600" id="video" controls></video>
    </center>
 
    <script>
      var video = document.getElementById('video');
      if (Hls.isSupported()) {
        var hls = new Hls({
          debug: true,
        });
        hls.loadSource('http://localhost/hls/1.mp4/master.m3u8');
        hls.attachMedia(video);
        hls.on(Hls.Events.MEDIA_ATTACHED, function () {
          video.muted = true;
          video.play();
        });
      }
      // hls.js is not supported on platforms that do not have Media Source Extensions (MSE) enabled.
      // When the browser has built-in HLS support (check using `canPlayType`), we can provide an HLS manifest (i.e. .m3u8 URL) directly to the video element through the `src` property.
      // This is using the built-in support of the plain video element, without using hls.js.
      else if (video.canPlayType('application/vnd.apple.mpegurl')) {
        video.src = 'http://localhost/hls/1.mp4/master.m3u8';
        video.addEventListener('canplay', function () {
          video.play();
        });
      }
    </script>
</html>

启动&效果

  • 启动
docker-compose up -d
  • 效果

说明

为了方便体验,我直接构建了一个完整的docker 镜像,直接可以使用dalongrong/angie:1.3.1-alpine-vod,但是默认模块在构建上似乎有一个问题
目前还好属于警告

audio_encoder_process_init: failed to get AAC encoder, audio encoding is disabled. recompile libavcodec with libfdk_aac to enable it

参考资料

https://github.com/rongfengliang/angie_vod_module_learning
https://angie.software/en/install/#install-docker
https://github.com/webserver-llc/angie
https://github.com/kaltura/nginx-vod-module
https://hub.docker.com/repository/docker/dalongrong/angie

标签:vod,load,http,modules,module,so,angie
From: https://www.cnblogs.com/rongfengliang/p/17805845.html

相关文章

  • angie docker 镜像试用
    主要是试用下官方的docker镜像环境准备docker-composeversion:"3"services:angie:image:docker.angie.software/angie:1.3.1-rockyports:-"80:80"-"443:443"启动&效果启动do......
  • linux CentOS ModuleNotFoundError: No module named '_ctypes
    Yesthatworkedforme,ImadesurethesepackagesareinstalledonmyCentos7:sudoyuminstall-yzlib-develbzip2-developenssl-develncurses-develsqlite-develreadline-develtk-develgdbm-develdb4-devellibpcap-develxz-develexpat-devellibffi-dev......
  • Python:报错——ModuleNotFoundError: No module named 'encodings'
    运行Python报错:FatalPythonerror:Py_Initialize:unabletoloadthefilesystemcodecModuleNotFoundError:Nomodulenamed'encodings' 处理步骤:1.Files>>>Setting>>>Project>>>PythonInterpreter >>>AddInterpret......
  • module 'tensorflow.compat.v2' has no attribute '__internal__
    fromkeras.utilsimportto_categorical module'tensorflow.compat.v2'hasnoattribute'__internal__fromkeras.utilsimportto_categorical $pythontesterr.py UsingTensorFlowbackend.Traceback(mostrecentcalllast): File"testerr.......
  • 解决Python报错ImportError: No module named ‘xxxx‘问题
    BASE_DIR=os.path.dirname(os.getcwd())#用来从jupyter默认地址中脱离出来importsyssys.path.append(BASE_DIR)sys.path.append('E:\CV_Paper_fuxian\lesson\B_VGG')#把文件所在的相对路径要添加进去。才不会报错然后运行,就完美解决了。......
  • fetchMetadata: sill resolveWithNewModule [email protected] checking installable s
    在使用vue-element-admin,npm安装时一直卡在这里报错换源,跟换安装方式都不能解决。最后找到问题,这个是由于安装tui-editor时报错,解决的办法是删掉package.json的tui-editor配置项,之后再次安装大家可以查下tui-editor是干什么用的,不需要就直接删了,然后安装 ......
  • 2023-10-27 Module not found: Error: Can't resolve 'D:/xx/xx/src/pages/yyy/zzz' i
    问题描述:react+antd+umi业务中删掉了一个文件夹,重新编译报错。报错:在'D:\xx\xx\src\.umi\core'路径里面无法找到模块zzz。原因:是因为你只是把本地文件zzz给删了,但是在route.js里面还保留着它的路径,所以umi识别不到就报错了。解决方案:在route.js文件里找到zzz的路径,将之删掉再重......
  • 'main' attribute cannot be used in a module that contains top-level code 问题解
    核心是@main注解在main.swift文件中,可以重新命名下参考资料https://stackoverflow.com/questions/73431031/swift-cli-app-main-attribute-cannot-be-used-in-a-module-that-contains-top-leve......
  • git之复合指令和submodule
    1.别名设置在路径C:\Progfiles\Git\etc\profile.d\aliases.sh里面通过alias设置了一个复合指令 aliasgsync='date;gitpullmmaster;gitadd.;gitcommit-m"sync-desk";gitpushmmaster' 2.在git仓库中有submodule,但是不知从什么时候开始,在一台机器上gsync后,在另......
  • module2 review note
    Module2TheHtDFrecipeconsistsofthefollowingsteps:Step1:Writethestub,includingsignatureandpurposeStep2:DefineexamplesStep3:WritethetemplateStep4:CodethefunctionbodyStep5:TestanddebuguntilcorrectStep1:Writethestub......