Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7430799
  • 博文数量: 1758
  • 博客积分: 18684
  • 博客等级: 上将
  • 技术积分: 16252
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-02 10:28
个人简介

啥也没写

文章分类

全部博文(1758)

文章存档

2024年(4)

2023年(44)

2022年(39)

2021年(46)

2020年(43)

2019年(27)

2018年(44)

2017年(50)

2016年(47)

2015年(15)

2014年(21)

2013年(43)

2012年(143)

2011年(228)

2010年(263)

2009年(384)

2008年(246)

2007年(30)

2006年(38)

2005年(2)

2004年(1)

分类: 系统运维

2021-05-13 14:03:18

异步实现执行命令
git clone github.com/juce/sockproc.git
cd sockproc
make
./sockproc /tmp/shell.sock
chmod 0666 /tmp/shell.sock
cd ..

git clone github.com/juce/lua-resty-shell.git
cp lua-resty-shell/lib/resty/shell.lua /usr/local/share/lua/5.1/resty/shell2.lua
cd ..

yum -y localinstall --nogpgcheck download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
yum -y install ffmpeg ffmpeg-devel

在fastdfs上面添加avinfo功能
    location /file1/M00 {
        root /data/fastdfs_data/data/;
        set $avinfo 0;
        if ($args ~ "avinfo"){
            set $avinfo "${avinfo}1";
        }
        if ($uri ~ "/[a-zA-Z0-9]+/[a-zA-Z0-9]+(/[a-zA-Z0-9]+/[a-zA-Z0-9]+.*)") {
            set $file $document_root$1;
            set $avinfo "${avinfo}1";
        } 
        if ($avinfo = "011") {
            content_by_lua '
                ngx.header.content_type = "application/json";
                local shell = require("resty.shell2");
                local args = {
                    socket = "unix:/tmp/shell.sock",
                }
                local targetFile = ngx.var.file
                local command = "ffprobe -v quiet -print_format json -show_format -show_streams " .. targetFile
                local status, out, err = shell.execute(command, args)
                --- ngx.say(package.path);
                --- ngx.say(package.cpath);
                ngx.say(out);
            ';
        }
        ngx_fastdfs_module;
    }

访问
域名/file1/M00/02/05/oYYBAGAPtsuAdlf1ABj4W8LbwdQ894.mp3?avinfo


阅读(14844) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~